Resubmitting 240466 after fixing the linux test suite failures.

A few extras were fixed

- Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. 
- Since some places want to access the address as a reference, I added a few new functions to symbol:
    Address &Symbol::GetAddressRef();
    const Address &Symbol::GetAddressRef() const;

Linux test suite passes just fine now.

<rdar://problem/21494354>

llvm-svn: 240702
This commit is contained in:
Greg Clayton
2015-06-25 21:46:34 +00:00
parent aed187c76e
commit 358cf1ea30
48 changed files with 1175 additions and 469 deletions

View File

@@ -137,10 +137,11 @@ SBSymbol::GetInstructions (SBTarget target, const char *flavor_string)
}
if (m_opaque_ptr->ValueIsAddress())
{
ModuleSP module_sp (m_opaque_ptr->GetAddress().GetModule());
const Address &symbol_addr = m_opaque_ptr->GetAddressRef();
ModuleSP module_sp = symbol_addr.GetModule();
if (module_sp)
{
AddressRange symbol_range (m_opaque_ptr->GetAddress(), m_opaque_ptr->GetByteSize());
AddressRange symbol_range (symbol_addr, m_opaque_ptr->GetByteSize());
const bool prefer_file_cache = false;
sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (),
NULL,
@@ -172,7 +173,7 @@ SBSymbol::GetStartAddress ()
SBAddress addr;
if (m_opaque_ptr && m_opaque_ptr->ValueIsAddress())
{
addr.SetAddress (&m_opaque_ptr->GetAddress());
addr.SetAddress (&m_opaque_ptr->GetAddressRef());
}
return addr;
}
@@ -186,7 +187,7 @@ SBSymbol::GetEndAddress ()
lldb::addr_t range_size = m_opaque_ptr->GetByteSize();
if (range_size > 0)
{
addr.SetAddress (&m_opaque_ptr->GetAddress());
addr.SetAddress (&m_opaque_ptr->GetAddressRef());
addr->Slide (m_opaque_ptr->GetByteSize());
}
}