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
12 changes: 12 additions & 0 deletions lldb/include/lldb/Target/StackFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,18 @@ class StackFrame : public ExecutionContextScope,
/// system implementation details this way.
bool IsHidden();

/// Get the frame's demangled name.
///
/// /// \return
/// A C-String containing the function demangled name. Can be null.
const char *GetFunctionName();

/// Get the frame's demangled display name.
///
/// /// \return
/// A C-String containing the function demangled display name. Can be null.
const char *GetDisplayFunctionName();

/// Query this frame to find what frame it is in this Thread's
/// StackFrameList.
///
Expand Down
58 changes: 6 additions & 52 deletions lldb/source/API/SBFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,12 +1173,8 @@ bool SBFrame::IsInlined() const {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock())) {
frame = exe_ctx.GetFramePtr();
if (frame) {

Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
if (block)
return block->GetContainingInlinedBlock() != nullptr;
}
if (frame)
return frame->IsInlined();
}
}
return false;
Expand Down Expand Up @@ -1255,29 +1251,8 @@ const char *SBFrame::GetFunctionName() const {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock())) {
frame = exe_ctx.GetFramePtr();
if (frame) {
SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
eSymbolContextBlock |
eSymbolContextSymbol));
if (sc.block) {
Block *inlined_block = sc.block->GetContainingInlinedBlock();
if (inlined_block) {
const InlineFunctionInfo *inlined_info =
inlined_block->GetInlinedFunctionInfo();
name = inlined_info->GetName().AsCString();
}
}

if (name == nullptr) {
if (sc.function)
name = sc.function->GetName().GetCString();
}

if (name == nullptr) {
if (sc.symbol)
name = sc.symbol->GetName().GetCString();
}
}
if (frame)
return frame->GetFunctionName();
}
}
return name;
Expand All @@ -1298,29 +1273,8 @@ const char *SBFrame::GetDisplayFunctionName() {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock())) {
frame = exe_ctx.GetFramePtr();
if (frame) {
SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
eSymbolContextBlock |
eSymbolContextSymbol));
if (sc.block) {
Block *inlined_block = sc.block->GetContainingInlinedBlock();
if (inlined_block) {
const InlineFunctionInfo *inlined_info =
inlined_block->GetInlinedFunctionInfo();
name = inlined_info->GetDisplayName().AsCString();
}
}

if (name == nullptr) {
if (sc.function)
name = sc.function->GetDisplayName().GetCString();
}

if (name == nullptr) {
if (sc.symbol)
name = sc.symbol->GetDisplayName().GetCString();
}
}
if (frame)
return frame->GetDisplayFunctionName();
}
}
return name;
Expand Down
51 changes: 51 additions & 0 deletions lldb/source/Target/StackFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,57 @@ bool StackFrame::IsHidden() {
return false;
}

const char *StackFrame::GetFunctionName() {
const char *name = nullptr;
SymbolContext sc = GetSymbolContext(
eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
if (sc.block) {
Block *inlined_block = sc.block->GetContainingInlinedBlock();
if (inlined_block) {
const InlineFunctionInfo *inlined_info =
inlined_block->GetInlinedFunctionInfo();
name = inlined_info->GetName().AsCString();
}
}

if (name == nullptr) {
if (sc.function)
name = sc.function->GetName().GetCString();
}

if (name == nullptr) {
if (sc.symbol)
name = sc.symbol->GetName().GetCString();
}

return name;
}

const char *StackFrame::GetDisplayFunctionName() {
const char *name = nullptr;
SymbolContext sc = GetSymbolContext(
eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
if (sc.block) {
Block *inlined_block = sc.block->GetContainingInlinedBlock();
if (inlined_block) {
const InlineFunctionInfo *inlined_info =
inlined_block->GetInlinedFunctionInfo();
name = inlined_info->GetDisplayName().AsCString();
}
}

if (name == nullptr) {
if (sc.function)
name = sc.function->GetDisplayName().GetCString();
}

if (name == nullptr) {
if (sc.symbol)
name = sc.symbol->GetDisplayName().GetCString();
}
return name;
}

SourceLanguage StackFrame::GetLanguage() {
CompileUnit *cu = GetSymbolContext(eSymbolContextCompUnit).comp_unit;
if (cu)
Expand Down
Loading