Symbols that have the section index of SHN_ABS were previously creating extra top level sections that contained the value of the symbol as if the symbol's value was an address. As far as I can tell, these symbol's values are not addresses, even if they do have a size. To make matters worse, adding these extra sections can stop address lookups from succeeding if the symbol's value + size overlaps with an existing section as these sections get mapped into memory when the image is loaded by the dynamic loader. This can cause stack frames to appear empty as the address lookup fails completely. This patch: - doesn't create a section for any SHN_ABS symbols - makes symbols that are absolute have values that are not addresses - add accessors to SBSymbol to get the value and size of a symbol as raw integers. Prevoiusly there was no way to access a symbol's value from a SBSymbol because the only accessors were: SBAddress SBSymbol::GetStartAddress(); SBAddress SBSymbol::GetEndAddress(); and these accessors would return an invalid SBAddress if the symbol's value wasn't an address - Adds a test to ensure no ".absolute.<symbol-name>" sections are created - Adds a test to test the new SBSymbol APIs Differential Revision: https://reviews.llvm.org/D131705
99 lines
3.3 KiB
C++
99 lines
3.3 KiB
C++
//===-- SWIG Interface for SBSymbol -----------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace lldb {
|
|
|
|
%feature("docstring",
|
|
"Represents the symbol possibly associated with a stack frame.
|
|
:py:class:`SBModule` contains SBSymbol(s). SBSymbol can also be retrieved from :py:class:`SBFrame` ."
|
|
) SBSymbol;
|
|
class SBSymbol
|
|
{
|
|
public:
|
|
|
|
SBSymbol ();
|
|
|
|
~SBSymbol ();
|
|
|
|
SBSymbol (const lldb::SBSymbol &rhs);
|
|
|
|
bool
|
|
IsValid () const;
|
|
|
|
explicit operator bool() const;
|
|
|
|
|
|
const char *
|
|
GetName() const;
|
|
|
|
const char *
|
|
GetDisplayName() const;
|
|
|
|
const char *
|
|
GetMangledName () const;
|
|
|
|
lldb::SBInstructionList
|
|
GetInstructions (lldb::SBTarget target);
|
|
|
|
lldb::SBInstructionList
|
|
GetInstructions (lldb::SBTarget target, const char *flavor_string);
|
|
|
|
SBAddress
|
|
GetStartAddress ();
|
|
|
|
SBAddress
|
|
GetEndAddress ();
|
|
|
|
uint64_t GetValue();
|
|
|
|
uint64_t GetSize();
|
|
|
|
uint32_t
|
|
GetPrologueByteSize ();
|
|
|
|
SymbolType
|
|
GetType ();
|
|
|
|
bool
|
|
GetDescription (lldb::SBStream &description);
|
|
|
|
bool
|
|
IsExternal();
|
|
|
|
bool
|
|
IsSynthetic();
|
|
|
|
bool
|
|
operator == (const lldb::SBSymbol &rhs) const;
|
|
|
|
bool
|
|
operator != (const lldb::SBSymbol &rhs) const;
|
|
|
|
STRING_EXTENSION(SBSymbol)
|
|
|
|
#ifdef SWIGPYTHON
|
|
%pythoncode %{
|
|
def get_instructions_from_current_target (self):
|
|
return self.GetInstructions (target)
|
|
|
|
name = property(GetName, None, doc='''A read only property that returns the name for this symbol as a string.''')
|
|
mangled = property(GetMangledName, None, doc='''A read only property that returns the mangled (linkage) name for this symbol as a string.''')
|
|
type = property(GetType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSymbolType") that represents the type of this symbol.''')
|
|
addr = property(GetStartAddress, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this symbol.''')
|
|
end_addr = property(GetEndAddress, None, doc='''A read only property that returns an lldb object that represents the end address (lldb.SBAddress) for this symbol.''')
|
|
prologue_size = property(GetPrologueByteSize, None, doc='''A read only property that returns the size in bytes of the prologue instructions as an unsigned integer.''')
|
|
instructions = property(get_instructions_from_current_target, None, doc='''A read only property that returns an lldb object that represents the instructions (lldb.SBInstructionList) for this symbol.''')
|
|
external = property(IsExternal, None, doc='''A read only property that returns a boolean value that indicates if this symbol is externally visiable (exported) from the module that contains it.''')
|
|
synthetic = property(IsSynthetic, None, doc='''A read only property that returns a boolean value that indicates if this symbol was synthetically created from information in module that contains it.''')
|
|
%}
|
|
#endif
|
|
|
|
};
|
|
|
|
} // namespace lldb
|