aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core/FormatEntity.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-01-17 20:45:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-01-17 20:45:01 +0000
commit706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch)
tree4adf86a776049cbf7f69a1929c4babcbbef925eb /lldb/source/Core/FormatEntity.cpp
parent7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff)
Notes
Diffstat (limited to 'lldb/source/Core/FormatEntity.cpp')
-rw-r--r--lldb/source/Core/FormatEntity.cpp50
1 files changed, 39 insertions, 11 deletions
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index c90828f40989..7aa1eced34f3 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -125,6 +125,7 @@ static FormatEntity::Entry::Definition g_function_child_entries[] = {
ENTRY("name", FunctionName),
ENTRY("name-without-args", FunctionNameNoArgs),
ENTRY("name-with-args", FunctionNameWithArgs),
+ ENTRY("mangled-name", FunctionMangledName),
ENTRY("addr-offset", FunctionAddrOffset),
ENTRY("concrete-only-addr-offset-no-padding", FunctionAddrOffsetConcrete),
ENTRY("line-offset", FunctionLineOffset),
@@ -351,6 +352,7 @@ const char *FormatEntity::Entry::TypeToCString(Type t) {
ENUM_TO_CSTR(FunctionName);
ENUM_TO_CSTR(FunctionNameWithArgs);
ENUM_TO_CSTR(FunctionNameNoArgs);
+ ENUM_TO_CSTR(FunctionMangledName);
ENUM_TO_CSTR(FunctionAddrOffset);
ENUM_TO_CSTR(FunctionAddrOffsetConcrete);
ENUM_TO_CSTR(FunctionLineOffset);
@@ -414,9 +416,10 @@ static bool RunScriptFormatKeyword(Stream &s, const SymbolContext *sc,
return false;
}
-static bool DumpAddress(Stream &s, const SymbolContext *sc,
- const ExecutionContext *exe_ctx, const Address &addr,
- bool print_file_addr_or_load_addr) {
+static bool DumpAddressAndContent(Stream &s, const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ const Address &addr,
+ bool print_file_addr_or_load_addr) {
Target *target = Target::GetTargetFromContexts(exe_ctx, sc);
addr_t vaddr = LLDB_INVALID_ADDRESS;
if (exe_ctx && !target->GetSectionLoadList().IsEmpty())
@@ -1145,9 +1148,10 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
case Entry::Type::AddressFile:
case Entry::Type::AddressLoad:
case Entry::Type::AddressLoadOrFile:
- return (addr != nullptr && addr->IsValid() &&
- DumpAddress(s, sc, exe_ctx, *addr,
- entry.type == Entry::Type::AddressLoadOrFile));
+ return (
+ addr != nullptr && addr->IsValid() &&
+ DumpAddressAndContent(s, sc, exe_ctx, *addr,
+ entry.type == Entry::Type::AddressLoadOrFile));
case Entry::Type::ProcessID:
if (exe_ctx) {
@@ -1376,8 +1380,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
if (sc) {
CompileUnit *cu = sc->comp_unit;
if (cu) {
- // CompileUnit is a FileSpec
- if (DumpFile(s, *cu, (FileKind)entry.number))
+ if (DumpFile(s, cu->GetPrimaryFile(), (FileKind)entry.number))
return true;
}
}
@@ -1416,7 +1419,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
if (frame) {
const Address &pc_addr = frame->GetFrameCodeAddress();
if (pc_addr.IsValid()) {
- if (DumpAddress(s, sc, exe_ctx, pc_addr, false))
+ if (DumpAddressAndContent(s, sc, exe_ctx, pc_addr, false))
return true;
}
}
@@ -1744,6 +1747,31 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
}
return false;
+ case Entry::Type::FunctionMangledName: {
+ const char *name = nullptr;
+ if (sc->symbol)
+ name = sc->symbol->GetMangled()
+ .GetName(sc->symbol->GetLanguage(), Mangled::ePreferMangled)
+ .AsCString();
+ else if (sc->function)
+ name = sc->function->GetMangled()
+ .GetName(sc->symbol->GetLanguage(), Mangled::ePreferMangled)
+ .AsCString();
+
+ if (!name)
+ return false;
+ s.PutCString(name);
+
+ if (sc->block->GetContainingInlinedBlock()) {
+ if (const InlineFunctionInfo *inline_info =
+ sc->block->GetInlinedFunctionInfo()) {
+ s.PutCString(" [inlined] ");
+ inline_info->GetName(sc->function->GetLanguage()).Dump(&s);
+ }
+ }
+ return true;
+ }
+
case Entry::Type::FunctionAddrOffset:
if (addr) {
if (DumpAddressOffsetFromFunction(s, sc, exe_ctx, *addr, false, false,
@@ -1828,7 +1856,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
if (entry.type == Entry::Type::LineEntryEndAddress)
addr.Slide(sc->line_entry.range.GetByteSize());
- if (DumpAddress(s, sc, exe_ctx, addr, false))
+ if (DumpAddressAndContent(s, sc, exe_ctx, addr, false))
return true;
}
return false;
@@ -2309,7 +2337,7 @@ bool FormatEntity::FormatFileSpec(const FileSpec &file_spec, Stream &s,
llvm::StringRef variable_name,
llvm::StringRef variable_format) {
if (variable_name.empty() || variable_name.equals(".fullpath")) {
- file_spec.Dump(&s);
+ file_spec.Dump(s.AsRawOstream());
return true;
} else if (variable_name.equals(".basename")) {
s.PutCString(file_spec.GetFilename().AsCString(""));