Skip to content

[lldb] Add the word "backtrace" to bt help string #92618

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

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented May 17, 2024

We noticed that apropos backtrace did not return the bt alias. This change adds the word "backtrace" to the help for bt. It also updates thread backtrace to keep the language used roughly in sync.

@kastiglione kastiglione requested a review from JDevlieghere as a code owner May 17, 2024 23:28
@llvmbot llvmbot added the lldb label May 17, 2024
@llvmbot
Copy link
Member

llvmbot commented May 17, 2024

@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)

Changes

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

2 Files Affected:

  • (modified) lldb/source/Commands/CommandObjectThread.cpp (+2-2)
  • (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+5-5)
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 4397ee14ea074..db96ee2cec383 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -114,8 +114,8 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
   CommandObjectThreadBacktrace(CommandInterpreter &interpreter)
       : CommandObjectIterateOverThreads(
             interpreter, "thread backtrace",
-            "Show thread call stacks.  Defaults to the current thread, thread "
-            "indexes can be specified as arguments.\n"
+            "Show backtraces of thread call stacks.  Defaults to the current "
+            "thread, thread indexes can be specified as arguments.\n"
             "Use the thread-index \"all\" to see all threads.\n"
             "Use the thread-index \"unique\" to see threads grouped by unique "
             "call stacks.\n"
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 4c58ecc3c1848..3e470a6989bbf 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -816,11 +816,11 @@ void CommandInterpreter::LoadCommandDictionary() {
   std::unique_ptr<CommandObjectRegexCommand> bt_regex_cmd_up(
       new CommandObjectRegexCommand(
           *this, "_regexp-bt",
-          "Show the current thread's call stack.  Any numeric argument "
-          "displays at most that many "
-          "frames.  The argument 'all' displays all threads.  Use 'settings"
-          " set frame-format' to customize the printing of individual frames "
-          "and 'settings set thread-format' to customize the thread header.",
+          "Show backtrace of the current thread's call stack.  Any numeric "
+          "argument displays at most that many frames.  The argument 'all' "
+          "displays all threads.  Use 'settings set frame-format' to customize "
+          "the printing of individual frames and 'settings set thread-format' "
+          "to customize the thread header.",
           "bt [<digit> | all]", 0, false));
   if (bt_regex_cmd_up) {
     // accept but don't document "bt -c <number>" -- before bt was a regex

@kastiglione
Copy link
Contributor Author

Open to alternative rewordings that include "backtrace".

@jimingham
Copy link
Collaborator

In simple aliases, apropos could get this right itself by resolving the command the alias points to and if THAT help string had the searched term, list the alias. But bt is an alias to a regex command. Again, you could look through all the branches of the regex command finding their commands and do the same. But you'd really want to report bt not _regexp-bt. That's getting a bit involved.

@jimingham
Copy link
Collaborator

I'm fine with adding the to be searched for term to the alias help.

Copy link
Contributor

@felipepiovezan felipepiovezan left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@jasonmolenda jasonmolenda left a comment

Choose a reason for hiding this comment

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

looks good, thanks.

@kastiglione kastiglione merged commit 98f105a into llvm:main May 21, 2024
6 checks passed
@kastiglione kastiglione deleted the lldb-Add-the-word-backtrace-to-bt-help-string branch May 21, 2024 17:17
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.

7 participants