aboutsummaryrefslogtreecommitdiffstats
path: root/source/Core/Address.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/Address.cpp')
-rw-r--r--source/Core/Address.cpp55
1 files changed, 34 insertions, 21 deletions
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp
index 0da83eb98edb..a3912bef5a6e 100644
--- a/source/Core/Address.cpp
+++ b/source/Core/Address.cpp
@@ -261,6 +261,24 @@ bool Address::ResolveAddressUsingFileSections(addr_t file_addr,
return false; // Failed to resolve this address to a section offset value
}
+/// if "addr_range_ptr" is not NULL, then fill in with the address range of the function.
+bool Address::ResolveFunctionScope(SymbolContext &sym_ctx,
+ AddressRange *addr_range_ptr) {
+ constexpr SymbolContextItem resolve_scope =
+ eSymbolContextFunction | eSymbolContextSymbol;
+
+ if (!(CalculateSymbolContext(&sym_ctx, resolve_scope) & resolve_scope)) {
+ if (addr_range_ptr)
+ addr_range_ptr->Clear();
+ return false;
+ }
+
+ if (!addr_range_ptr)
+ return true;
+
+ return sym_ctx.GetAddressRange(resolve_scope, 0, false, *addr_range_ptr);
+}
+
ModuleSP Address::GetModule() const {
lldb::ModuleSP module_sp;
SectionSP section_sp(GetSection());
@@ -475,23 +493,19 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
switch (sect_type) {
case eSectionTypeData:
if (module_sp) {
- SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
- if (sym_vendor) {
- Symtab *symtab = sym_vendor->GetSymtab();
- if (symtab) {
- const addr_t file_Addr = GetFileAddress();
- Symbol *symbol =
- symtab->FindSymbolContainingFileAddress(file_Addr);
- if (symbol) {
- const char *symbol_name = symbol->GetName().AsCString();
- if (symbol_name) {
- s->PutCString(symbol_name);
- addr_t delta =
- file_Addr - symbol->GetAddressRef().GetFileAddress();
- if (delta)
- s->Printf(" + %" PRIu64, delta);
- showed_info = true;
- }
+ if (Symtab *symtab = module_sp->GetSymtab()) {
+ const addr_t file_Addr = GetFileAddress();
+ Symbol *symbol =
+ symtab->FindSymbolContainingFileAddress(file_Addr);
+ if (symbol) {
+ const char *symbol_name = symbol->GetName().AsCString();
+ if (symbol_name) {
+ s->PutCString(symbol_name);
+ addr_t delta =
+ file_Addr - symbol->GetAddressRef().GetFileAddress();
+ if (delta)
+ s->Printf(" + %" PRIu64, delta);
+ showed_info = true;
}
}
}
@@ -985,10 +999,9 @@ AddressClass Address::GetAddressClass() const {
if (module_sp) {
ObjectFile *obj_file = module_sp->GetObjectFile();
if (obj_file) {
- // Give the symbol vendor a chance to add to the unified section list
- // and to symtab from symbol file
- if (SymbolVendor *vendor = module_sp->GetSymbolVendor())
- vendor->GetSymtab();
+ // Give the symbol file a chance to add to the unified section list
+ // and to the symtab.
+ module_sp->GetSymtab();
return obj_file->GetAddressClass(GetFileAddress());
}
}