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

@@ -422,7 +422,7 @@ RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind)
const Symbol *sym = module->FindFirstSymbolWithNameAndType(ConstString(hook_defn->symbol_name), eSymbolTypeCode);
addr_t addr = sym->GetAddress().GetLoadAddress(&target);
addr_t addr = sym->GetLoadAddress(&target);
if (addr == LLDB_INVALID_ADDRESS)
{
if(log)
@@ -542,7 +542,7 @@ RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp)
Error error;
uint32_t flag = 0x00000001U;
Target &target = GetProcess()->GetTarget();
addr_t addr = debug_present->GetAddress().GetLoadAddress(&target);
addr_t addr = debug_present->GetLoadAddress(&target);
GetProcess()->WriteMemory(addr, &flag, sizeof(flag), error);
if(error.Success())
{
@@ -597,7 +597,7 @@ RSModuleDescriptor::ParseRSInfo()
const Symbol *info_sym = m_module->FindFirstSymbolWithNameAndType(ConstString(".rs.info"), eSymbolTypeData);
if (info_sym)
{
const addr_t addr = info_sym->GetAddress().GetFileAddress();
const addr_t addr = info_sym->GetAddressRef().GetFileAddress();
const addr_t size = info_sym->GetByteSize();
const FileSpec fs = m_module->GetFileSpec();
@@ -809,7 +809,7 @@ RenderScriptRuntime::AttemptBreakpointAtKernelName(Stream &strm, const char* nam
}
}
addr_t bp_addr = kernel_sym->GetAddress().GetLoadAddress(&GetProcess()->GetTarget());
addr_t bp_addr = kernel_sym->GetLoadAddress(&GetProcess()->GetTarget());
if (bp_addr == LLDB_INVALID_ADDRESS)
{
error.SetErrorStringWithFormat("Could not locate load address for symbols of kernel '%s'.", name);