Skip to content

🍒[lldb] Highlight function names in backtraces #10556

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
merged 28 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a1663c3
[lldb][FormatEntity][NFCI] Refactor FunctionNameWithArgs into helper …
Michael137 Apr 10, 2025
e16cdd3
[lldb][Format][NFCI] Refactor CPlusPlusLanguage::GetFunctionDisplayNa…
Michael137 Apr 11, 2025
a719c49
[lldb][Language] Change GetFunctionDisplayName to take SymbolContext …
Michael137 Apr 13, 2025
34bc8be
[lldb][Format] Display only the inlined frame name in backtraces if a…
Michael137 Apr 13, 2025
1a2f2d5
[lldb][Format][NFC] Factor FunctionNameWithArgs case out into helper …
Michael137 Apr 13, 2025
7f1e988
[lldb][test] Fix NativePDB/inline_sites_live.cpp inlined frame format
Michael137 Apr 14, 2025
d2ebe63
[lldb][Format][NFC] Remove unused FormatEntity::FormatCString
Michael137 Apr 14, 2025
2b60e9c
[ItaniumDemangle] Add customizable printLeft/printRight APIs to Outpu…
Michael137 Apr 17, 2025
1025be0
[ItaniumDemangle][test] Add test-cases for ref-qualified member point…
Michael137 Apr 23, 2025
0226820
[lldb] Implement TrackingOutputBuffer to track demangled name informa…
Michael137 Apr 7, 2025
8e5e1b2
[lldb][Mangled] Add API to force re-demangling a Mangled object (#131…
Michael137 Mar 10, 2025
268253b
[lldb][Mangled] Retrieve and cache demangled name info (#131836)
Michael137 Apr 7, 2025
3ddde4c
[lldb][Format] Introduce new frame-format variables for function part…
Michael137 Apr 11, 2025
b4c1a18
[lldb][CPlusPlus] Add plugin.cplusplus.display.function-name-format s…
Michael137 Apr 14, 2025
7c147e0
[lldb] Remove redundant DemangledNameInfo::operator==
Michael137 Apr 25, 2025
5fc9e5c
[lldb] Fix MangledTest build failure
Michael137 Apr 25, 2025
004abd1
[ItaniumDemangle][NFC] Add getter to ObjCProtoName::getProtocol
Michael137 Apr 25, 2025
265cbb3
[lldb][NFC] Add missing newline between function definitions
Michael137 Apr 25, 2025
a0cc261
[lldb][test] MangledTest: don't use designated initializers
Michael137 Apr 25, 2025
42e1c5c
[lldb][test] Skip Objective-C FrameFormat tests on Windows
Michael137 Apr 26, 2025
f342292
[lldb][test] Fix/XFAIL FrameFormat tests on Windows
Michael137 Apr 26, 2025
166d3e0
[lldb][test] Make sure we compile FrameFormat tests with DWARF
Michael137 Apr 26, 2025
64688bb
[lldb][test] Un-XFAIL TestCxxFrameFormat.test for now
Michael137 Apr 26, 2025
dc6e033
[lldb][test] XFAIL FrameFormat tests on Windows again
Michael137 Apr 26, 2025
91e761c
[lldb][CPlusPLus] Make C++ frame-format work without debug-info
Michael137 Apr 25, 2025
a06d362
[lldb] Highlight basenames in backtraces instead of PC value
Michael137 Apr 25, 2025
885c46e
[lldb][test] XFAIL TestCxxFrameFormat.test for Windows target
Michael137 Apr 26, 2025
0685cec
[lldb][Swift][NFC] Adjust GetFunctionDisplayName to take SymbolContex…
Michael137 Apr 27, 2025
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
Prev Previous commit
[lldb][Swift][NFC] Adjust GetFunctionDisplayName to take SymbolContex…
…t by reference

The API was changed upstream for the C++ plugin. This patch adjusts the
API implementation for Swift
  • Loading branch information
Michael137 committed Apr 27, 2025
commit 0685cec185cd9d18ac44c3b8d36fcdf9e0579418
26 changes: 13 additions & 13 deletions lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,54 +1699,54 @@ bool SwiftLanguage::IsUninitializedReference(ValueObject &valobj) {
}

bool SwiftLanguage::GetFunctionDisplayName(
const SymbolContext *sc, const ExecutionContext *exe_ctx,
const SymbolContext &sc, const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation, Stream &s) {
switch (representation) {
case Language::FunctionNameRepresentation::eName:
// No need to customize this.
return false;
case Language::FunctionNameRepresentation::eNameWithNoArgs: {
if (!sc->function)
if (!sc.function)
return false;
if (sc->function->GetLanguage() != eLanguageTypeSwift)
if (sc.function->GetLanguage() != eLanguageTypeSwift)
return false;
std::string display_name = SwiftLanguageRuntime::DemangleSymbolAsString(
sc->function->GetMangled().GetMangledName().GetStringRef(),
SwiftLanguageRuntime::eSimplified, sc, exe_ctx);
sc.function->GetMangled().GetMangledName().GetStringRef(),
SwiftLanguageRuntime::eSimplified, &sc, exe_ctx);
if (display_name.empty())
return false;
s << display_name;
return true;
}
case Language::FunctionNameRepresentation::eNameWithArgs: {
if (!sc->function)
if (!sc.function)
return false;
if (sc->function->GetLanguage() != eLanguageTypeSwift)
if (sc.function->GetLanguage() != eLanguageTypeSwift)
return false;
std::string display_name = SwiftLanguageRuntime::DemangleSymbolAsString(
sc->function->GetMangled().GetMangledName().GetStringRef(),
SwiftLanguageRuntime::eSimplified, sc, exe_ctx);
sc.function->GetMangled().GetMangledName().GetStringRef(),
SwiftLanguageRuntime::eSimplified, &sc, exe_ctx);
if (display_name.empty())
return false;
ExecutionContextScope *exe_scope =
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL;
const InlineFunctionInfo *inline_info = NULL;
VariableListSP variable_list_sp;
bool get_function_vars = true;
if (sc->block) {
Block *inline_block = sc->block->GetContainingInlinedBlock();
if (sc.block) {
Block *inline_block = sc.block->GetContainingInlinedBlock();

if (inline_block) {
get_function_vars = false;
inline_info = sc->block->GetInlinedFunctionInfo();
inline_info = sc.block->GetInlinedFunctionInfo();
if (inline_info)
variable_list_sp = inline_block->GetBlockVariableList(true);
}
}

if (get_function_vars) {
variable_list_sp =
sc->function->GetBlock(true).GetBlockVariableList(true);
sc.function->GetBlock(true).GetBlockVariableList(true);
}

if (inline_info) {
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Language/Swift/SwiftLanguage.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SwiftLanguage : public Language {

bool IsUninitializedReference(ValueObject &valobj) override;

bool GetFunctionDisplayName(const SymbolContext *sc,
bool GetFunctionDisplayName(const SymbolContext &sc,
const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation,
Stream &s) override;
Expand Down