Skip to content

[lldb] Fix frame-format string missing space when module is invalid#172767

Merged
medismailben merged 1 commit intollvm:mainfrom
medismailben:missing-space-frame-pc-entity
Dec 18, 2025
Merged

[lldb] Fix frame-format string missing space when module is invalid#172767
medismailben merged 1 commit intollvm:mainfrom
medismailben:missing-space-frame-pc-entity

Conversation

@medismailben
Copy link
Member

@medismailben medismailben commented Dec 18, 2025

This patch is a follow-up to 96c733e to fix a missing space in the frame.pc format entity. This space was intended to be prepended to the module format entity scope but if the module is not valid, which is often the case for python pc-less scripted frames, the space between the pc and the function name is missing.

@llvmbot
Copy link
Member

llvmbot commented Dec 18, 2025

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

This patch is a follow-up to 96c733e to fix a missing space in the frame.pc format entity. This space was intended to be prepended to the module format entity scope but in case the module is not valid, which is often the case for python pc-less scripted frames, the space between the pc and the function name is missing.


Full diff: https://github.com/llvm/llvm-project/pull/172767.diff

1 Files Affected:

  • (modified) lldb/source/Core/CoreProperties.td (+2-2)
diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td
index a54d5538f4c0c..99bb5a3fc6f73 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}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${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}}}${frame.kind}{${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,
@@ -235,7 +235,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}}}${frame.kind}{${function.is-optimized} [opt]}{${function.is-inlined} [inlined]}{${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}}}${frame.kind}{${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,

@medismailben medismailben force-pushed the missing-space-frame-pc-entity branch from 6dad74d to fedb0e6 Compare December 18, 2025 00:49
@github-actions
Copy link

github-actions bot commented Dec 18, 2025

✅ With the latest revision this PR passed the Python code formatter.

This patch is a follow-up to 96c733e to fix a missing space in the
frame.pc format entity. This space was intended to be prepended to the
module format entity scope but in case the module is not valid, which is
often the case for python pc-less scripted frames, the space between the
pc and the function name is missing.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
@medismailben medismailben force-pushed the missing-space-frame-pc-entity branch from fedb0e6 to bad0eb0 Compare December 18, 2025 00:54
Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

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

LGTM assuming returning a frame index is intentional.

return ValidPCNoModuleFrame(self.thread, 1, 0x5678000, "unknown_function_2")
elif index - 2 < len(self.input_frames):
# Pass through original frames
return index - 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not familiar with the details, but I'd expect to return some frame object here to follow the pattern of the rest.

If it returns a number does something else look that up in the real frames?

Copy link
Member Author

Choose a reason for hiding this comment

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

@DavidSpickett Exactly, if we return an integer (which is a valid frame index), it will create a BorrowStackFrame out of it and include it in the new backtrace: https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SyntheticFrameProvider/ScriptedFrameProvider/ScriptedFrameProvider.cpp#L168-L177

@medismailben medismailben merged commit 6767b86 into llvm:main Dec 18, 2025
10 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Dec 19, 2025
…lvm#172767)

This patch is a follow-up to 96c733e to fix a missing space in the
frame.pc format entity. This space was intended to be prepended to the
module format entity scope but if the module is not valid, which is
often the case for python pc-less scripted frames, the space between the
pc and the function name is missing.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
valadaptive pushed a commit to valadaptive/llvm-project that referenced this pull request Dec 24, 2025
…lvm#172767)

This patch is a follow-up to 96c733e to fix a missing space in the
frame.pc format entity. This space was intended to be prepended to the
module format entity scope but if the module is not valid, which is
often the case for python pc-less scripted frames, the space between the
pc and the function name is missing.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
medismailben added a commit to medismailben/llvm-project that referenced this pull request Jan 30, 2026
…lvm#172767)

This patch is a follow-up to 96c733e to fix a missing space in the
frame.pc format entity. This space was intended to be prepended to the
module format entity scope but if the module is not valid, which is
often the case for python pc-less scripted frames, the space between the
pc and the function name is missing.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 6767b86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants