Skip to content

Commit 7ec8a33

Browse files
authored
[lldb] Display breakpoint locations using display name (#90297)
Adds a `show_function_display_name` parameter to `SymbolContext::DumpStopContext`. This parameter defaults to false, but `BreakpointLocation::GetDescription` sets it to true. This is NFC in mainline lldb, and will be used to modify how Swift breakpoint locations are printed.
1 parent e37bd6c commit 7ec8a33

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

lldb/include/lldb/Symbol/SymbolContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class SymbolContext {
158158
Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr,
159159
bool show_fullpaths, bool show_module, bool show_inlined_frames,
160160
bool show_function_arguments, bool show_function_name,
161+
bool show_function_display_name = false,
161162
std::optional<Stream::HighlightSettings> settings = std::nullopt) const;
162163

163164
/// Get the address range contained within a symbol context.

lldb/source/Breakpoint/BreakpointLocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void BreakpointLocation::GetDescription(Stream *s,
507507
else
508508
s->PutCString("where = ");
509509
sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address,
510-
false, true, false, true, true);
510+
false, true, false, true, true, true);
511511
} else {
512512
if (sc.module_sp) {
513513
s->EOL();

lldb/source/Core/Address.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,8 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
645645
pointer_sc.symbol != nullptr) {
646646
s->PutCString(": ");
647647
pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false,
648-
false, true, true, settings);
648+
false, true, true, false,
649+
settings);
649650
}
650651
}
651652
}
@@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
685686
sc.DumpStopContext(s, exe_scope, *this, show_fullpaths,
686687
show_module, show_inlined_frames,
687688
show_function_arguments, show_function_name,
688-
settings);
689+
false, settings);
689690
} else {
690691
// We found a symbol but it was in a different section so it
691692
// isn't the symbol we should be showing, just show the section

lldb/source/Symbol/SymbolContext.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ bool SymbolContext::DumpStopContext(
7373
Stream *s, ExecutionContextScope *exe_scope, const Address &addr,
7474
bool show_fullpaths, bool show_module, bool show_inlined_frames,
7575
bool show_function_arguments, bool show_function_name,
76+
bool show_function_display_name,
7677
std::optional<Stream::HighlightSettings> settings) const {
7778
bool dumped_something = false;
7879
if (show_module && module_sp) {
@@ -93,6 +94,8 @@ bool SymbolContext::DumpStopContext(
9394
ConstString name;
9495
if (!show_function_arguments)
9596
name = function->GetNameNoArguments();
97+
if (!name && show_function_display_name)
98+
name = function->GetDisplayName();
9699
if (!name)
97100
name = function->GetName();
98101
if (name)
@@ -146,7 +149,8 @@ bool SymbolContext::DumpStopContext(
146149
const bool show_function_name = true;
147150
return inline_parent_sc.DumpStopContext(
148151
s, exe_scope, inline_parent_addr, show_fullpaths, show_module,
149-
show_inlined_frames, show_function_arguments, show_function_name);
152+
show_inlined_frames, show_function_arguments, show_function_name,
153+
show_function_display_name);
150154
}
151155
} else {
152156
if (line_entry.IsValid()) {
@@ -164,7 +168,12 @@ bool SymbolContext::DumpStopContext(
164168
dumped_something = true;
165169
if (symbol->GetType() == eSymbolTypeTrampoline)
166170
s->PutCString("symbol stub for: ");
167-
s->PutCStringColorHighlighted(symbol->GetName().GetStringRef(), settings);
171+
ConstString name;
172+
if (show_function_display_name)
173+
name = symbol->GetDisplayName();
174+
if (!name)
175+
name = symbol->GetName();
176+
s->PutCStringColorHighlighted(name.GetStringRef(), settings);
168177
}
169178

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

0 commit comments

Comments
 (0)