Fixed a logic error in Module::ResolveSymbolContextForAddress(). Asking an address if its offet is greater than zero doesn't actually correctly tell us wether the address is section offset or not. A symbol could be the first symbol in a section and its offset can be zero. Also, a non-section offset lldb_private::Address can have a NULL section and calling GetOffset() will return the absolute address. To really test if an address is section offset clients should use Address::IsSectionOffset(). Also simplified the code that backs the address up by one to use the Address::Slide() function.

llvm-svn: 190955
This commit is contained in:
Greg Clayton 2013-09-18 20:03:31 +00:00
parent 756e1ff676
commit edfaae3956
1 changed files with 2 additions and 2 deletions

View File

@ -499,10 +499,10 @@ Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve
// symbol lookup for disassembly and unwind.
if (resolve_scope & eSymbolContextSymbol && !(resolved_flags & eSymbolContextSymbol) &&
resolve_scope & eSymbolContextFunction && !(resolved_flags & eSymbolContextFunction) &&
so_addr.GetOffset() > 0)
so_addr.IsSectionOffset())
{
Address previous_addr = so_addr;
previous_addr.SetOffset(so_addr.GetOffset() - 1);
previous_addr.Slide(-1);
const uint32_t flags = sym_vendor->ResolveSymbolContext (previous_addr, resolve_scope, sc);
if (flags & eSymbolContextSymbol)