Skip to content

[lldb] [cosmetic] Update help message of (lldb) b #149114

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 2 commits into from
Jul 16, 2025

Conversation

royitaqi
Copy link
Contributor

@royitaqi royitaqi commented Jul 16, 2025

(lldb) b can be used in two different ways:

  1. Running b without arguments, it lists all existing breakpoints.
  2. Running b with arguments, it adds breakpoints.

However, the help message doesn't mention the first use case. This patch adds help message to mention it.

Without patch:

(lldb) help b
Set a breakpoint using one of several shorthand formats.  Expects 'raw' input (see 'help raw-input'.)

Syntax:
_regexp-break <filename>:<linenum>:<colnum>
              main.c:12:21          // Break at line 12 and column 21 of main.c
...

With patch:

(lldb) help b
Set a breakpoint using one of several shorthand formats, or list the
existing breakpoints if no arguments are provided.  Expects 'raw' input
(see 'help raw-input'.)

Syntax:
_regexp-break <filename>:<linenum>:<colnum>
              main.c:12:21          // Break at line 12 and column 21 of main.c
...
_regexp-break
                                    // List the existing breakpoints

@royitaqi royitaqi requested a review from JDevlieghere as a code owner July 16, 2025 15:15
@llvmbot llvmbot added the lldb label Jul 16, 2025
@royitaqi royitaqi requested review from dmpots, aperez and clayborg July 16, 2025 15:15
@llvmbot
Copy link
Member

llvmbot commented Jul 16, 2025

@llvm/pr-subscribers-lldb

Author: None (royitaqi)

Changes

(lldb) b can be used in two different ways:

  1. Running b without arguments, it lists all existing breakpoints.
  2. Running b with additional arguments, it adds breakpoints.

However, the help message doesn't mention the first use case. This patch adds help message to mention it by adding "List all breakpoints, or ...".

Without patch:

(lldb) help b
Set a breakpoint using one of several shorthand formats.  Expects 'raw' input (see 'help raw-input'.)

Syntax:
_regexp-break &lt;filename&gt;:&lt;linenum&gt;:&lt;colnum&gt;
              main.c:12:21          // Break at line 12 and column 21 of main.c
...


(lldb) apropos breakpoint
  b                         -- Set a breakpoint using one of several shorthand formats.

With patch:

(lldb) help b
List all breakpoints, or set a breakpoint using one of several shorthand formats.  Expects 'raw' input (see 'help raw-input'.)

Syntax:
_regexp-break &lt;filename&gt;:&lt;linenum&gt;:&lt;colnum&gt;
              main.c:12:21          // Break at line 12 and column 21 of main.c
...


(lldb) apropos breakpoint
  b                         -- List all breakpoints, or set a breakpoint using one of several shorthand formats.

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

1 Files Affected:

  • (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+2-1)
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 00c3472444d2e..2d8ab7bf3bbf4 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -616,7 +616,8 @@ void CommandInterpreter::LoadCommandDictionary() {
   std::unique_ptr<CommandObjectRegexCommand> break_regex_cmd_up(
       new CommandObjectRegexCommand(
           *this, "_regexp-break",
-          "Set a breakpoint using one of several shorthand formats.",
+          "List all breakpoints, or set a breakpoint using one of several "
+          "shorthand formats.",
           "\n"
           "_regexp-break <filename>:<linenum>:<colnum>\n"
           "              main.c:12:21          // Break at line 12 and column "

@royitaqi royitaqi changed the title [lldb] Update help message of (lldb) b [lldb] [cosmetic] Update help message of (lldb) b Jul 16, 2025
Copy link
Contributor

@dmpots dmpots left a comment

Choose a reason for hiding this comment

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

LGTM with one suggestion.

@JDevlieghere JDevlieghere requested a review from jimingham July 16, 2025 16:24
@JDevlieghere
Copy link
Member

[begin bikeshedding]
How about something like this:

Set a breakpoint using one of several shorthand formats, or list the existing breakpoints if no arguments are provided. Expects 'raw' input (see 'help raw-input'.)

My reasoning is that it describes the more common use case first while also telling you how to get the behavior for listing breakpoints.

[end bikeshedding]

@royitaqi
Copy link
Contributor Author

Folks, how about now? (see PR description for latest visualization)
cc @JDevlieghere, @dmpots, @clayborg.

--

FWIW, @JDevlieghere: That wasn't bikeshedding at all. The order is important because it decides what gets delivered to the user/reader. Thanks for the great suggestion.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

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

LGTM!

@royitaqi royitaqi merged commit 86c63e6 into llvm:main Jul 16, 2025
9 checks passed
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.

4 participants