Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lldb/include/lldb/Target/StackID.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class StackID {

protected:
friend class StackFrame;
friend class SyntheticStackFrameList;

void SetPC(lldb::addr_t pc, Process *process);
void SetCFA(lldb::addr_t cfa, Process *process);
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Core/CoreProperties.td
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let Definition = "debugger" in {
Desc<"The default disassembly format string to use when disassembling instruction sequences.">;
def FrameFormat: Property<"frame-format", "FormatEntity">,
Global,
DefaultStringValue<"frame #${frame.index}: ${ansi.fg.cyan}${frame.pc}${ansi.normal}{ ${module.file.basename}{`${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${frame.is-artificial} [artificial]}\\\\n">,
DefaultStringValue<"frame #${frame.index}: {${ansi.fg.cyan}${frame.pc}${ansi.normal}}{ ${module.file.basename}{`}}{${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${frame.is-artificial} [artificial]}\\\\n">,
Desc<"The default frame format string to use when displaying stack frame information for threads.">;
def NotiftVoid: Property<"notify-void", "Boolean">,
Global,
Expand Down Expand Up @@ -235,7 +235,7 @@ let Definition = "debugger" in {
Desc<"If true, LLDB will automatically escape non-printable and escape characters when formatting strings.">;
def FrameFormatUnique: Property<"frame-format-unique", "FormatEntity">,
Global,
DefaultStringValue<"frame #${frame.index}: ${ansi.fg.cyan}${frame.pc}${ansi.normal}{ ${module.file.basename}{`${function.name-without-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${frame.is-artificial} [artificial]}\\\\n">,
DefaultStringValue<"frame #${frame.index}: {${ansi.fg.cyan}${frame.pc}${ansi.normal}}{ ${module.file.basename}{`}}{${function.name-without-args}{${frame.no-debug}${function.pc-offset}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${frame.is-artificial} [artificial]}\\\\n">,
Desc<"The default frame format string to use when displaying stack frame information for threads from thread backtrace unique.">;
def ShowAutosuggestion: Property<"show-autosuggestion", "Boolean">,
Global,
Expand Down
161 changes: 95 additions & 66 deletions lldb/source/Core/FormatEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1684,10 +1684,9 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
StackFrame *frame = exe_ctx->GetFramePtr();
if (frame) {
const Address &pc_addr = frame->GetFrameCodeAddress();
if (pc_addr.IsValid() || frame->IsSynthetic()) {
if (pc_addr.IsValid())
if (DumpAddressAndContent(s, sc, exe_ctx, pc_addr, false))
return true;
}
}
}
return false;
Expand Down Expand Up @@ -1808,70 +1807,91 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
return initial_function;

case Entry::Type::FunctionName: {
if (!sc)
return false;
if (sc) {
Language *language_plugin = nullptr;
bool language_plugin_handled = false;
StreamString ss;

Language *language_plugin = nullptr;
bool language_plugin_handled = false;
StreamString ss;
if (sc->function)
language_plugin = Language::FindPlugin(sc->function->GetLanguage());
else if (sc->symbol)
language_plugin = Language::FindPlugin(sc->symbol->GetLanguage());

if (sc->function)
language_plugin = Language::FindPlugin(sc->function->GetLanguage());
else if (sc->symbol)
language_plugin = Language::FindPlugin(sc->symbol->GetLanguage());
if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
*sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
*sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);
if (language_plugin_handled) {
s << ss.GetString();
return true;
}

if (language_plugin_handled) {
s << ss.GetString();
return true;
const char *name = sc->GetPossiblyInlinedFunctionName()
.GetName(Mangled::NamePreference::ePreferDemangled)
.AsCString();
if (name) {
s.PutCString(name);
return true;
}
}

const char *name = sc->GetPossiblyInlinedFunctionName()
.GetName(Mangled::NamePreference::ePreferDemangled)
.AsCString();
if (!name)
return false;

s.PutCString(name);

return true;
// Fallback to frame methods if available.
if (exe_ctx) {
StackFrame *frame = exe_ctx->GetFramePtr();
if (frame) {
const char *name = frame->GetFunctionName();
if (name) {
s.PutCString(name);
return true;
}
}
}
return false;
}

case Entry::Type::FunctionNameNoArgs: {
if (!sc)
return false;

Language *language_plugin = nullptr;
bool language_plugin_handled = false;
StreamString ss;
if (sc->function)
language_plugin = Language::FindPlugin(sc->function->GetLanguage());
else if (sc->symbol)
language_plugin = Language::FindPlugin(sc->symbol->GetLanguage());

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
*sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs,
ss);
if (sc) {
Language *language_plugin = nullptr;
bool language_plugin_handled = false;
StreamString ss;
if (sc->function)
language_plugin = Language::FindPlugin(sc->function->GetLanguage());
else if (sc->symbol)
language_plugin = Language::FindPlugin(sc->symbol->GetLanguage());

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
*sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs,
ss);

if (language_plugin_handled) {
s << ss.GetString();
return true;
}

if (language_plugin_handled) {
s << ss.GetString();
return true;
const char *name =
sc->GetPossiblyInlinedFunctionName()
.GetName(
Mangled::NamePreference::ePreferDemangledWithoutArguments)
.AsCString();
if (name) {
s.PutCString(name);
return true;
}
}

const char *name =
sc->GetPossiblyInlinedFunctionName()
.GetName(Mangled::NamePreference::ePreferDemangledWithoutArguments)
.AsCString();
if (!name)
return false;

s.PutCString(name);

return true;
// Fallback to frame methods if available.
if (exe_ctx) {
StackFrame *frame = exe_ctx->GetFramePtr();
if (frame) {
const char *name = frame->GetFunctionName();
if (name) {
s.PutCString(name);
return true;
}
}
}
return false;
}

case Entry::Type::FunctionPrefix:
Expand All @@ -1898,13 +1918,26 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
}

case Entry::Type::FunctionNameWithArgs: {
if (!sc)
return false;
if (sc) {
if (FormatFunctionNameForLanguage(s, exe_ctx, sc))
return true;

if (FormatFunctionNameForLanguage(s, exe_ctx, sc))
return true;
if (HandleFunctionNameWithArgs(s, exe_ctx, *sc))
return true;
}

return HandleFunctionNameWithArgs(s, exe_ctx, *sc);
// Fallback to frame methods if available.
if (exe_ctx) {
StackFrame *frame = exe_ctx->GetFramePtr();
if (frame) {
const char *name = frame->GetDisplayFunctionName();
if (name) {
s.PutCString(name);
return true;
}
}
}
return false;
}
case Entry::Type::FunctionMangledName: {
if (!sc)
Expand Down Expand Up @@ -1946,12 +1979,11 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
case Entry::Type::FunctionPCOffset:
if (exe_ctx) {
StackFrame *frame = exe_ctx->GetFramePtr();
if (frame) {
if (frame)
if (DumpAddressOffsetFromFunction(s, sc, exe_ctx,
frame->GetFrameCodeAddress(), false,
false, false))
return true;
}
}
return false;

Expand All @@ -1975,11 +2007,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,

case Entry::Type::LineEntryFile:
if (sc && sc->line_entry.IsValid()) {
Module *module = sc->module_sp.get();
if (module) {
if (DumpFile(s, sc->line_entry.GetFile(), (FileKind)entry.number))
return true;
}
if (DumpFile(s, sc->line_entry.GetFile(), (FileKind)entry.number))
return true;
}
return false;

Expand Down
Loading
Loading