Skip to content

[lldb] Display breakpoint locations using display name #90297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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/Symbol/SymbolContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class SymbolContext {
Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr,
bool show_fullpaths, bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
bool show_function_display_name = false,
std::optional<Stream::HighlightSettings> settings = std::nullopt) const;

/// Get the address range contained within a symbol context.
Expand Down
4 changes: 4 additions & 0 deletions lldb/include/lldb/Target/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ class Language : public PluginInterface {
return mangled.GetMangledName();
}

virtual ConstString GetDisplayDemangledName(Mangled mangled) const {
return mangled.GetDemangledName();
}

virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on,
Stream &s);

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Breakpoint/BreakpointLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void BreakpointLocation::GetDescription(Stream *s,
else
s->PutCString("where = ");
sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address,
false, true, false, true, true);
false, true, false, true, true, true);
} else {
if (sc.module_sp) {
s->EOL();
Expand Down
5 changes: 3 additions & 2 deletions lldb/source/Core/Address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
pointer_sc.symbol != nullptr) {
s->PutCString(": ");
pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false,
false, true, true, settings);
false, true, true, false,
settings);
}
}
}
Expand Down Expand Up @@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
sc.DumpStopContext(s, exe_scope, *this, show_fullpaths,
show_module, show_inlined_frames,
show_function_arguments, show_function_name,
settings);
false, settings);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to limit the initial scope of changes to just breakpoint locations. It may be that we want to change this to true, but it has not be discussed (or audited, or tested) and so I am not confident in changing this too.

} else {
// We found a symbol but it was in a different section so it
// isn't the symbol we should be showing, just show the section
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Core/Mangled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const {
}

ConstString Mangled::GetDisplayDemangledName() const {
if (Language *lang = Language::FindPlugin(GuessLanguage()))
return lang->GetDisplayDemangledName(*this);
return GetDemangledName();
}

Expand Down
13 changes: 11 additions & 2 deletions lldb/source/Symbol/SymbolContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ bool SymbolContext::DumpStopContext(
Stream *s, ExecutionContextScope *exe_scope, const Address &addr,
bool show_fullpaths, bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
bool show_function_display_name,
std::optional<Stream::HighlightSettings> settings) const {
bool dumped_something = false;
if (show_module && module_sp) {
Expand All @@ -93,6 +94,8 @@ bool SymbolContext::DumpStopContext(
ConstString name;
if (!show_function_arguments)
name = function->GetNameNoArguments();
if (!name && show_function_display_name)
name = function->GetDisplayName();
if (!name)
name = function->GetName();
if (name)
Expand Down Expand Up @@ -146,7 +149,8 @@ bool SymbolContext::DumpStopContext(
const bool show_function_name = true;
return inline_parent_sc.DumpStopContext(
s, exe_scope, inline_parent_addr, show_fullpaths, show_module,
show_inlined_frames, show_function_arguments, show_function_name);
show_inlined_frames, show_function_arguments, show_function_name,
show_function_display_name);
}
} else {
if (line_entry.IsValid()) {
Expand All @@ -164,7 +168,12 @@ bool SymbolContext::DumpStopContext(
dumped_something = true;
if (symbol->GetType() == eSymbolTypeTrampoline)
s->PutCString("symbol stub for: ");
s->PutCStringColorHighlighted(symbol->GetName().GetStringRef(), settings);
ConstString name;
if (show_function_display_name)
name = symbol->GetDisplayName();
if (!name)
name = symbol->GetName();
s->PutCStringColorHighlighted(name.GetStringRef(), settings);
}

if (addr.IsValid() && symbol->ValueIsAddress()) {
Expand Down