[Lldb-commits] [lldb] r190955 - 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::IsSectionOffs...
Greg Clayton
gclayton at apple.com
Wed Sep 18 13:03:31 PDT 2013
Author: gclayton
Date: Wed Sep 18 15:03:31 2013
New Revision: 190955
URL: http://llvm.org/viewvc/llvm-project?rev=190955&view=rev
Log:
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.
Modified:
lldb/trunk/source/Core/Module.cpp
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=190955&r1=190954&r2=190955&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Sep 18 15:03:31 2013
@@ -499,10 +499,10 @@ Module::ResolveSymbolContextForAddress (
// 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)
More information about the lldb-commits
mailing list