Skip to content

[lldb/Commands] Alias script command to scripting run #97263

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 1 commit into from
Jul 2, 2024

Conversation

medismailben
Copy link
Member

@medismailben medismailben commented Jul 1, 2024

This patch introduces a new top-level scripting command with an run sub-command, that basically replaces the script raw command.

To avoid breaking the script command usages, this patch also adds an script alias to the scripting run sub-command.

The reason behind this change is to have a top-level command that will cover scripting related subcommands.

@llvmbot
Copy link
Member

llvmbot commented Jul 1, 2024

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

This patch introduces a new top-level scripting command with an execute sub-command, that basically replaces the script raw command.

To avoid breaking the script command usages, this patch also adds an script alias to the scripting execute sub-command.

The reason behind this change is to have a top-level command that will cover scripting related subcommands.


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

5 Files Affected:

  • (modified) lldb/source/Commands/CMakeLists.txt (+1-1)
  • (renamed) lldb/source/Commands/CommandObjectScripting.cpp (+31-13)
  • (renamed) lldb/source/Commands/CommandObjectScripting.h (+12-5)
  • (modified) lldb/source/Commands/Options.td (+1-1)
  • (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+7-2)
diff --git a/lldb/source/Commands/CMakeLists.txt b/lldb/source/Commands/CMakeLists.txt
index 6a36c5376d5c5..76397227d535d 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -26,7 +26,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
   CommandObjectQuit.cpp
   CommandObjectRegexCommand.cpp
   CommandObjectRegister.cpp
-  CommandObjectScript.cpp
+  CommandObjectScripting.cpp
   CommandObjectSession.cpp
   CommandObjectSettings.cpp
   CommandObjectSource.cpp
diff --git a/lldb/source/Commands/CommandObjectScript.cpp b/lldb/source/Commands/CommandObjectScripting.cpp
similarity index 68%
rename from lldb/source/Commands/CommandObjectScript.cpp
rename to lldb/source/Commands/CommandObjectScripting.cpp
index 25f25b8e65947..72f653690e532 100644
--- a/lldb/source/Commands/CommandObjectScript.cpp
+++ b/lldb/source/Commands/CommandObjectScripting.cpp
@@ -1,4 +1,4 @@
-//===-- CommandObjectScript.cpp -------------------------------------------===//
+//===-- CommandObjectScripting.cpp ----------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectScript.h"
+#include "CommandObjectScripting.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/Host/Config.h"
@@ -21,10 +21,10 @@
 using namespace lldb;
 using namespace lldb_private;
 
-#define LLDB_OPTIONS_script
+#define LLDB_OPTIONS_scripting_execute
 #include "CommandOptions.inc"
 
-Status CommandObjectScript::CommandOptions::SetOptionValue(
+Status CommandObjectScriptingExecute::CommandOptions::SetOptionValue(
     uint32_t option_idx, llvm::StringRef option_arg,
     ExecutionContext *execution_context) {
   Status error;
@@ -46,27 +46,29 @@ Status CommandObjectScript::CommandOptions::SetOptionValue(
   return error;
 }
 
-void CommandObjectScript::CommandOptions::OptionParsingStarting(
+void CommandObjectScriptingExecute::CommandOptions::OptionParsingStarting(
     ExecutionContext *execution_context) {
   language = lldb::eScriptLanguageNone;
 }
 
 llvm::ArrayRef<OptionDefinition>
-CommandObjectScript::CommandOptions::GetDefinitions() {
-  return llvm::ArrayRef(g_script_options);
+CommandObjectScriptingExecute::CommandOptions::GetDefinitions() {
+  return llvm::ArrayRef(g_scripting_execute_options);
 }
 
-CommandObjectScript::CommandObjectScript(CommandInterpreter &interpreter)
+CommandObjectScriptingExecute::CommandObjectScriptingExecute(
+    CommandInterpreter &interpreter)
     : CommandObjectRaw(
-          interpreter, "script",
+          interpreter, "scripting execute",
           "Invoke the script interpreter with provided code and display any "
           "results.  Start the interactive interpreter if no code is supplied.",
-          "script [--language <scripting-language> --] [<script-code>]") {}
+          "scripting execute [--language <scripting-language> --] "
+          "[<script-code>]") {}
 
-CommandObjectScript::~CommandObjectScript() = default;
+CommandObjectScriptingExecute::~CommandObjectScriptingExecute() = default;
 
-void CommandObjectScript::DoExecute(llvm::StringRef command,
-                                    CommandReturnObject &result) {
+void CommandObjectScriptingExecute::DoExecute(llvm::StringRef command,
+                                              CommandReturnObject &result) {
   // Try parsing the language option but when the command contains a raw part
   // separated by the -- delimiter.
   OptionsWithRaw raw_args(command);
@@ -111,3 +113,19 @@ void CommandObjectScript::DoExecute(llvm::StringRef command,
   else
     result.SetStatus(eReturnStatusFailed);
 }
+
+#pragma mark CommandObjectMultiwordScripting
+
+// CommandObjectMultiwordScripting
+
+CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(
+          interpreter, "scripting",
+          "Commands for operating on the scripting functionnalities.",
+          "scripting <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("execute", CommandObjectSP(new CommandObjectScriptingExecute(
+                                interpreter)));
+}
+
+CommandObjectMultiwordScripting::~CommandObjectMultiwordScripting() = default;
diff --git a/lldb/source/Commands/CommandObjectScript.h b/lldb/source/Commands/CommandObjectScripting.h
similarity index 71%
rename from lldb/source/Commands/CommandObjectScript.h
rename to lldb/source/Commands/CommandObjectScripting.h
index 3a8c4a890404a..b4a8a32cb644a 100644
--- a/lldb/source/Commands/CommandObjectScript.h
+++ b/lldb/source/Commands/CommandObjectScripting.h
@@ -1,4 +1,4 @@
-//===-- CommandObjectScript.h -----------------------------------*- C++ -*-===//
+//===-- CommandObjectScripting.h --------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,14 +9,21 @@
 #ifndef LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPT_H
 #define LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPT_H
 
-#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
 
 namespace lldb_private {
 
-class CommandObjectScript : public CommandObjectRaw {
+class CommandObjectMultiwordScripting : public CommandObjectMultiword {
 public:
-  CommandObjectScript(CommandInterpreter &interpreter);
-  ~CommandObjectScript() override;
+  CommandObjectMultiwordScripting(CommandInterpreter &interpreter);
+
+  ~CommandObjectMultiwordScripting() override;
+};
+
+class CommandObjectScriptingExecute : public CommandObjectRaw {
+public:
+  CommandObjectScriptingExecute(CommandInterpreter &interpreter);
+  ~CommandObjectScriptingExecute() override;
   Options *GetOptions() override { return &m_options; }
 
   class CommandOptions : public Options {
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index fa8af7cb3d762..752121ee6edb2 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -835,7 +835,7 @@ let Command = "container add" in {
   Desc<"Overwrite an existing command at this node.">;
 }
 
-let Command = "script" in {
+let Command = "scripting execute" in {
   def script_language : Option<"language", "l">,
     EnumArg<"ScriptLang">, Desc<"Specify the scripting "
     " language. If none is specific the default scripting language is used.">;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 40c915b2c94fc..fe3e68ec4e2a0 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -33,7 +33,7 @@
 #include "Commands/CommandObjectQuit.h"
 #include "Commands/CommandObjectRegexCommand.h"
 #include "Commands/CommandObjectRegister.h"
-#include "Commands/CommandObjectScript.h"
+#include "Commands/CommandObjectScripting.h"
 #include "Commands/CommandObjectSession.h"
 #include "Commands/CommandObjectSettings.h"
 #include "Commands/CommandObjectSource.h"
@@ -518,6 +518,11 @@ void CommandInterpreter::Initialize() {
     AddAlias("re", cmd_obj_sp);
   }
 
+  cmd_obj_sp = GetCommandSPExact("scripting execute");
+  if (cmd_obj_sp) {
+    AddAlias("script", cmd_obj_sp);
+  }
+
   cmd_obj_sp = GetCommandSPExact("session history");
   if (cmd_obj_sp) {
     AddAlias("history", cmd_obj_sp);
@@ -569,7 +574,7 @@ void CommandInterpreter::LoadCommandDictionary() {
   REGISTER_COMMAND_OBJECT("process", CommandObjectMultiwordProcess);
   REGISTER_COMMAND_OBJECT("quit", CommandObjectQuit);
   REGISTER_COMMAND_OBJECT("register", CommandObjectRegister);
-  REGISTER_COMMAND_OBJECT("script", CommandObjectScript);
+  REGISTER_COMMAND_OBJECT("scripting", CommandObjectMultiwordScripting);
   REGISTER_COMMAND_OBJECT("settings", CommandObjectMultiwordSettings);
   REGISTER_COMMAND_OBJECT("session", CommandObjectSession);
   REGISTER_COMMAND_OBJECT("source", CommandObjectMultiwordSource);

Copy link

github-actions bot commented Jul 1, 2024

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

@medismailben medismailben force-pushed the scripting-top-level-command branch from 1f3d049 to 8e016c7 Compare July 1, 2024 19:02
Copy link
Collaborator

@jimingham jimingham 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 a couple little nits.

Comment on lines +523 to +527
AddAlias("sc", cmd_obj_sp);
AddAlias("scr", cmd_obj_sp);
AddAlias("scri", cmd_obj_sp);
AddAlias("scrip", cmd_obj_sp);
AddAlias("script", cmd_obj_sp);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unfortunate, do these pollute help output? if so, can we hide them?

is there no way to make a prefix match an alias, when it's shorter?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The problem is that if we have the command scripting and the alias script and we see sc we need to resolve that command ambiguity. The only tool we have for ambiguous command resolution at present is "exact matches always win".

If we wanted to solve this w/o making all the exact matches we intend to win, we could add a ranking system to the commands and aliases, which bias ambiguous matches in favor of one or the other of the commands, or some similar system. I worry that would get messy pretty quickly, but anyway, you'd need something like that.

Copy link
Member Author

@medismailben medismailben Jul 2, 2024

Choose a reason for hiding this comment

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

I agree it's not the most elegant solution but I'd prefer solving the partial matching issue in a follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

Might be a good idea to write a comment explaining the constraint here? If I came across this code snippet I'd definitely want to know why we do this.

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@kastiglione kastiglione left a comment

Choose a reason for hiding this comment

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

In addition to the comment about unique prefixes, my only other comment is, have you considered scripting run?

@jimingham
Copy link
Collaborator

In addition to the comment about unique prefixes, my only other comment is, have you considered scripting run?

The problem with this command is that it either executes a script given to it on the command line, or it runs the embedded script interpreter...

@medismailben medismailben force-pushed the scripting-top-level-command branch from 8e016c7 to b9eba8c Compare July 2, 2024 03:49
This patch introduces a new top-level `scripting` command with an
`run` sub-command, that basically replaces the `script` raw command.

To avoid breaking the `script` command usages, this patch also adds an
`script` alias to the `scripting run` sub-command.

The reason behind this change is to have a top-level command that will
cover scripting related subcommands.

Signed-off-by: Med Ismail Bennani <[email protected]>
@medismailben medismailben force-pushed the scripting-top-level-command branch from b9eba8c to 47344cb Compare July 2, 2024 03:51
@medismailben medismailben changed the title [lldb/Commands] Alias script command to scripting execute [lldb/Commands] Alias script command to scripting run Jul 2, 2024
@medismailben medismailben merged commit 410de0c into llvm:main Jul 2, 2024
4 of 5 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 2, 2024

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/425

Here is the relevant piece of the build log for the reference:

Step 6 (test) failure: build (failure)
...
31.128 [1/2/288] Linking CXX executable tools\lldb\unittests\Thread\ThreadTests.exe
31.168 [1/1/289] Linking CXX executable tools\lldb\unittests\ValueObject\LLDBValueObjectTests.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Users\tcwg\scoop\apps\git\2.39.0.windows.2\usr\bin
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using clang: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using ld.lld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using lld-link: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lld-link.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using ld64.lld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld64.lld.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using wasm-ld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\wasm-ld.exe
31.169 [0/1/289] Runnin-- Testing: 1983 tests, 2 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 
FAIL: lldb-shell :: SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp (1616 of 1983)
******************** TEST 'lldb-shell :: SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 19
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf    -fdebug-types-section -gpubnames -c C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -fdebug-types-section -gpubnames -c 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o'
# note: command had no output on stdout or stderr
# RUN: at line 21
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT    -fdebug-types-section -gpubnames -c C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT -fdebug-types-section -gpubnames -c 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o'
# note: command had no output on stdout or stderr
# RUN: at line 23
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp'
# .---command stderr------------
# | ld.lld: warning: cannot find entry symbol _start; not setting start address
# `-----------------------------
# RUN: at line 26
rm -f C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.dwp
# executed command: rm -f 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.dwp'
# note: command had no output on stdout or stderr
# RUN: at line 27
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe --no-lldbinit -S C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet    -o "type lookup IntegerType"    -o "type lookup FloatType"    -o "type lookup CustomType"    -b C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp | c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp --check-prefix=NODWP
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe' --no-lldbinit -S 'C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet' -o 'type lookup IntegerType' -o 'type lookup FloatType' -o 'type lookup CustomType' -b 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp'
# note: command had no output on stdout or stderr
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' --check-prefix=NODWP
# .---command stderr------------
# | C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp:35:11: error: NODWP: expected string not found in input
# | // NODWP: (lldb) type lookup FloatType
# |           ^
# | <stdin>:20:22: note: scanning from here
# |  typedef unsigned int IntegerType;
# |                      ^
# | <stdin>:21:3: note: possible intended match here
# |  typedef float FloatType;
# |   ^

@medismailben
Copy link
Member Author

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/425

Here is the relevant piece of the build log for the reference:

Step 6 (test) failure: build (failure)
...
31.128 [1/2/288] Linking CXX executable tools\lldb\unittests\Thread\ThreadTests.exe
31.168 [1/1/289] Linking CXX executable tools\lldb\unittests\ValueObject\LLDBValueObjectTests.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Users\tcwg\scoop\apps\git\2.39.0.windows.2\usr\bin
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using clang: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using ld.lld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using lld-link: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lld-link.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using ld64.lld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld64.lld.exe
llvm-lit.py: C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508: note: using wasm-ld: c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\wasm-ld.exe
31.169 [0/1/289] Runnin-- Testing: 1983 tests, 2 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 
FAIL: lldb-shell :: SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp (1616 of 1983)
******************** TEST 'lldb-shell :: SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 19
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf    -fdebug-types-section -gpubnames -c C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -fdebug-types-section -gpubnames -c 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o'
# note: command had no output on stdout or stderr
# RUN: at line 21
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT    -fdebug-types-section -gpubnames -c C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT -fdebug-types-section -gpubnames -c 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o'
# note: command had no output on stdout or stderr
# RUN: at line 23
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o -o C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.main.o' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.foo.o' -o 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp'
# .---command stderr------------
# | ld.lld: warning: cannot find entry symbol _start; not setting start address
# `-----------------------------
# RUN: at line 26
rm -f C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.dwp
# executed command: rm -f 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp.dwp'
# note: command had no output on stdout or stderr
# RUN: at line 27
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe --no-lldbinit -S C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet    -o "type lookup IntegerType"    -o "type lookup FloatType"    -o "type lookup CustomType"    -b C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp | c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp --check-prefix=NODWP
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe' --no-lldbinit -S 'C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet' -o 'type lookup IntegerType' -o 'type lookup FloatType' -o 'type lookup CustomType' -b 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\SymbolFile\DWARF\x86\Output\dwp-foreign-type-units.cpp.tmp'
# note: command had no output on stdout or stderr
# executed command: 'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe' 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp' --check-prefix=NODWP
# .---command stderr------------
# | C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\SymbolFile\DWARF\x86\dwp-foreign-type-units.cpp:35:11: error: NODWP: expected string not found in input
# | // NODWP: (lldb) type lookup FloatType
# |           ^
# | <stdin>:20:22: note: scanning from here
# |  typedef unsigned int IntegerType;
# |                      ^
# | <stdin>:21:3: note: possible intended match here
# |  typedef float FloatType;
# |   ^

This is a flakey test that was already failing in previous builds: https://lab.llvm.org/buildbot/#/builders/141/builds/423

@DavidSpickett
Copy link
Collaborator

I've disabled the test on Windows and Linaro will look into it.

@kastiglione
Copy link
Contributor

kastiglione commented Jul 2, 2024

The problem with this command is that it either executes a script given to it on the command line, or it runs the embedded script interpreter...

I don't see the problem. The original script does both of those things, and run fits those two use case as well or better than execute, in my opinion.

@medismailben
Copy link
Member Author

The problem with this command is that it either executes a script given to it on the command line, or it runs the embedded script interpreter...

I don't see the problem. The original script does both of those things, and run fits those two use case as well or better than execute, in my opinion.

I don't know if you saw but I actually changed the command to be scripting run before landing this 😅

@kastiglione
Copy link
Contributor

@medismailben 👍 I saw, and also wanted to reply to Jim.

lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
This patch introduces a new top-level `scripting` command with an `run`
sub-command, that basically replaces the `script` raw command.

To avoid breaking the `script` command usages, this patch also adds an
`script` alias to the `scripting run` sub-command.

The reason behind this change is to have a top-level command that will
cover scripting related subcommands.

Signed-off-by: Med Ismail Bennani <[email protected]>
Comment on lines 81 to 82
command_interpreter.ResolveCommand(r"""sc print("\n\n\tHello!\n")""", result)
self.assertTrue(result.Succeeded())
Copy link
Member

Choose a reason for hiding this comment

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

You could test all the prefixes with something like this:

str = 'script'
for i in range(2, len(str)):
    command = str[0:i]
    self.assertEqual(command ...)

@JDevlieghere
Copy link
Member

JDevlieghere commented Jul 3, 2024

The reason behind this change is to have a top-level command that will cover scripting related subcommands.

Which other scripting subcommands do you envision, besides the template subcommand?

@medismailben
Copy link
Member Author

medismailben commented Jul 3, 2024

Which other scripting subcommands do you envision, besides the template subcommand?

From @jimingham reply:

One that I want, powered by facilities we can add to the template, is that a class that implements a breakpoint callback should have a registry method (that's the part we can probably generate with the template instantiation) that adds callback class and help info to lldb. Then you would do:

(lldb) scripting instances list
Breakpoint Callbacks:
  my_module.MyBreakpointCallback: 
      This does something really cool, if you pass the right value for the key "even_cooler", it does something even cooler.


And similar for all the other affordances. We could do this by having breakpoint callback implementation list but I think having them listed here would make all the different affordances we have more discoverable.

BTW, I'm not proposing instances as the name, but I couldn't think of a better one off the top of my head.

Maybe scripting callback list?

It might also be handy to have:

(lldb) scripting modules list -l Python
MyFirstModule : /Users/Me/MyPythonModules/my_first_script.py

etc...

Which would list all the Python modules that we've loaded with "command script import" and where they came from.

kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
This patch introduces a new top-level `scripting` command with an `run`
sub-command, that basically replaces the `script` raw command.

To avoid breaking the `script` command usages, this patch also adds an
`script` alias to the `scripting run` sub-command.

The reason behind this change is to have a top-level command that will
cover scripting related subcommands.

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit to medismailben/llvm-project that referenced this pull request Aug 5, 2024
This patch is a follow-up to llvm#97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a
command to run, this patch changes to resolution logic to check if there
is either a single user command match or a single alias match and if so,
it will run that command instead of the others.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit to medismailben/llvm-project that referenced this pull request Aug 7, 2024
This patch is a follow-up to llvm#97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a command to
run, this patch changes to resolution logic to check if there is a single
alias match and if so, it will run the alias instead of the other matches.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit to medismailben/llvm-project that referenced this pull request Aug 7, 2024
This patch is a follow-up to llvm#97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a command to
run, this patch changes to resolution logic to check if there is a single
alias match and if so, it will run the alias instead of the other matches.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit to medismailben/llvm-project that referenced this pull request Aug 8, 2024
This patch is a follow-up to llvm#97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a command to
run, this patch changes to resolution logic to check if there is a single
alias match and if so, it will run the alias instead of the other matches.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit that referenced this pull request Aug 8, 2024
This patch is a follow-up to #97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a
command to
run, this patch changes to resolution logic to check if there is a
single
alias match and if so, it will run the alias instead of the other
matches.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
adrian-prantl pushed a commit to swiftlang/llvm-project that referenced this pull request Oct 11, 2024
)

This patch is a follow-up to llvm#97263 that fix ambigous abbreviated
command resolution.

When multiple commands are resolved, instead of failing to pick a
command to
run, this patch changes to resolution logic to check if there is a
single
alias match and if so, it will run the alias instead of the other
matches.

This has as a side-effect that we don't need to make aliases for every
substring of aliases to support abbrivated alias resolution.

Signed-off-by: Med Ismail Bennani <[email protected]>
(cherry picked from commit 8334d2b)
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.

8 participants