[Lldb-commits] [lldb] [lldb][Format] Add [inlined] marker to names of inlined frames (PR #142952)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 5 05:09:19 PDT 2025
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/142952
This was removed in https://github.com/llvm/llvm-project/pull/135343 in favour of making it a format variable, which we do here. This follows the precedent of the `[opt]` and `[artificial]` markers.
rdar://152642178
>From 3de64abff2cc702d43a5436990e804111f513414 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 5 Jun 2025 12:02:17 +0100
Subject: [PATCH] [lldb][Format] Add [inlined] marker to names of inlined
frames
This was removed in https://github.com/llvm/llvm-project/pull/135343 in
favour of making it a format variable, which we do here. This follows
the precedent of the `[opt]` and `[artificial]` markers.
rdar://152642178
---
lldb/docs/use/formatting.rst | 2 ++
lldb/include/lldb/Core/FormatEntity.h | 1 +
lldb/source/Core/CoreProperties.td | 4 ++--
lldb/source/Core/FormatEntity.cpp | 6 ++++++
lldb/unittests/Core/FormatEntityTest.cpp | 1 +
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lldb/docs/use/formatting.rst b/lldb/docs/use/formatting.rst
index e71b08780eb3d..21b3ca1912b02 100644
--- a/lldb/docs/use/formatting.rst
+++ b/lldb/docs/use/formatting.rst
@@ -122,6 +122,8 @@ A complete list of currently supported format string variables is listed below:
+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``function.initial-function`` | Will evaluate to true if this is the start of the first function, as opposed to a change of functions (may be used in ``disassembly-format`` to print the function name for the first function being disassembled) |
+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| ``function.is-inlined`` | Will evaluate to true if this function was inlined |
++---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``line.file.basename`` | The line table entry basename to the file for the current line entry in the current frame. |
+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``line.file.fullpath`` | The line table entry fullpath to the file for the current line entry in the current frame. |
diff --git a/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h
index 18257161eec7b..17fee068230b2 100644
--- a/lldb/include/lldb/Core/FormatEntity.h
+++ b/lldb/include/lldb/Core/FormatEntity.h
@@ -104,6 +104,7 @@ struct Entry {
FunctionInitial,
FunctionChanged,
FunctionIsOptimized,
+ FunctionIsInlined,
LineEntryFile,
LineEntryLineNumber,
LineEntryColumn,
diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td
index 78988ce5b732f..95259abfe8bd4 100644
--- a/lldb/source/Core/CoreProperties.td
+++ b/lldb/source/Core/CoreProperties.td
@@ -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}}}{${function.is-optimized} [opt]}{${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}}}{${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,
@@ -217,7 +217,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}}}{${function.is-optimized} [opt]}{${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}}}{${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,
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 3c591ba15a075..8e3c3c18863fa 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -124,6 +124,7 @@ constexpr Definition g_function_child_entries[] = {
Definition("initial-function", EntryType::FunctionInitial),
Definition("changed", EntryType::FunctionChanged),
Definition("is-optimized", EntryType::FunctionIsOptimized),
+ Definition("is-inlined", EntryType::FunctionIsInlined),
Definition("prefix", EntryType::FunctionPrefix),
Definition("scope", EntryType::FunctionScope),
Definition("basename", EntryType::FunctionBasename),
@@ -402,6 +403,7 @@ const char *FormatEntity::Entry::TypeToCString(Type t) {
ENUM_TO_CSTR(FunctionInitial);
ENUM_TO_CSTR(FunctionChanged);
ENUM_TO_CSTR(FunctionIsOptimized);
+ ENUM_TO_CSTR(FunctionIsInlined);
ENUM_TO_CSTR(LineEntryFile);
ENUM_TO_CSTR(LineEntryLineNumber);
ENUM_TO_CSTR(LineEntryColumn);
@@ -1928,6 +1930,10 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
return is_optimized;
}
+ case Entry::Type::FunctionIsInlined: {
+ return sc && sc->block && sc->block->GetInlinedFunctionInfo();
+ }
+
case Entry::Type::FunctionInitial:
return initial_function;
diff --git a/lldb/unittests/Core/FormatEntityTest.cpp b/lldb/unittests/Core/FormatEntityTest.cpp
index 2cddf8ff4e900..e056b6fe7de52 100644
--- a/lldb/unittests/Core/FormatEntityTest.cpp
+++ b/lldb/unittests/Core/FormatEntityTest.cpp
@@ -129,6 +129,7 @@ constexpr llvm::StringRef lookupStrings[] = {
"${function.initial-function}",
"${function.changed}",
"${function.is-optimized}",
+ "${function.is-inlined}",
"${line.file.basename}",
"${line.file.dirname}",
"${line.file.fullpath}",
More information about the lldb-commits
mailing list