mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
[lldb] Update custom commands to always be overrriden
This is a follow-up patch to 6f7835f309b9. As explained previously, when running from an IDE, it can happen that the IDE imports some lldb scripts by itself. If the user also tries to import these commands, lldb will show the following message: ``` error: cannot add command: user command exists and force replace not set ``` This message is confusing to the user, because it suggests that the command import failed and that the execution should stop. However, in this case, lldb will continue the execution with the command added previously by the user. To prevent that, this patch updates every first-party lldb-packaged custom commands to override commands that were pre-imported in lldb. Differential Revision: https://reviews.llvm.org/D140293 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -558,7 +558,7 @@ def __lldb_init_module(debugger, dict):
|
||||
# interpreter.
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -c %s.VerifyDebugMapCommand %s' % (
|
||||
'command script add -o -c %s.VerifyDebugMapCommand %s' % (
|
||||
__name__, VerifyDebugMapCommand.name))
|
||||
print('The "%s" command has been installed, type "help %s" for detailed '
|
||||
'help.' % (VerifyDebugMapCommand.name, VerifyDebugMapCommand.name))
|
||||
|
||||
@@ -24,7 +24,7 @@ class FrameStatCommand:
|
||||
parser = cls.create_options()
|
||||
cls.__doc__ = parser.format_help()
|
||||
# Add any commands contained in this module to LLDB
|
||||
command = 'command script add -c %s.%s %s' % (module_name,
|
||||
command = 'command script add -o -c %s.%s %s' % (module_name,
|
||||
cls.__name__,
|
||||
cls.program)
|
||||
debugger.HandleCommand(command)
|
||||
|
||||
@@ -128,5 +128,5 @@ def __lldb_init_module(debugger, internal_dict):
|
||||
# This initializer is being run from LLDB in the embedded command interpreter
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -f delta.parse_time_log parse_time_log')
|
||||
'command script add -o -f delta.parse_time_log parse_time_log')
|
||||
print('The "parse_time_log" command is now installed and ready for use, type "parse_time_log --help" for more information')
|
||||
|
||||
@@ -175,7 +175,7 @@ struct $__lldb__CFString {\
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand(
|
||||
"command script add -f %s.diagnose_nsstring_Command_Impl diagnose-nsstring" %
|
||||
"command script add -o -f %s.diagnose_nsstring_Command_Impl diagnose-nsstring" %
|
||||
__name__)
|
||||
print('The "diagnose-nsstring" command has been installed, type "help diagnose-nsstring" for detailed help.')
|
||||
|
||||
|
||||
@@ -309,6 +309,6 @@ def create_diagnose_unwind_options():
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand(
|
||||
'command script add -f %s.diagnose_unwind diagnose-unwind' %
|
||||
'command script add -o -f %s.diagnose_unwind diagnose-unwind' %
|
||||
__name__)
|
||||
print('The "diagnose-unwind" command has been installed, type "help diagnose-unwind" for detailed help.')
|
||||
|
||||
@@ -45,4 +45,4 @@ class DisassemblyMode:
|
||||
return "Toggles between a disassembly only mode and normal source mode\n"
|
||||
|
||||
def __lldb_init_module(debugger, unused):
|
||||
debugger.HandleCommand("command script add -c disassembly_mode.DisassemblyMode toggle-disassembly")
|
||||
debugger.HandleCommand("command script add -o -c disassembly_mode.DisassemblyMode toggle-disassembly")
|
||||
|
||||
@@ -23,5 +23,5 @@ def disassemble(debugger, command, result, dict):
|
||||
# Install the command when the module gets imported
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand(
|
||||
'command script add -f gdb_disassemble.disassemble gdb-disassemble')
|
||||
'command script add -o -f gdb_disassemble.disassemble gdb-disassemble')
|
||||
print('Installed "gdb-disassemble" command for disassembly')
|
||||
|
||||
@@ -1626,7 +1626,7 @@ def __lldb_init_module(debugger, internal_dict):
|
||||
# This initializer is being run from LLDB in the embedded command interpreter
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -f gdbremote.start_gdb_log start_gdb_log')
|
||||
'command script add -o -f gdbremote.start_gdb_log start_gdb_log')
|
||||
debugger.HandleCommand(
|
||||
'command script add -f gdbremote.stop_gdb_log stop_gdb_log')
|
||||
'command script add -o -f gdbremote.stop_gdb_log stop_gdb_log')
|
||||
print('The "start_gdb_log" and "stop_gdb_log" commands are now installed and ready for use, type "start_gdb_log --help" or "stop_gdb_log --help" for more information')
|
||||
|
||||
@@ -192,5 +192,5 @@ def jump(debugger, command, result, internal_dict):
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
# Module is being run inside the LLDB interpreter
|
||||
jump.__doc__ = usage_string()
|
||||
debugger.HandleCommand('command script add -f jump.jump jump')
|
||||
debugger.HandleCommand('command script add -o -f jump.jump jump')
|
||||
print('The "jump" command has been installed, type "help jump" or "jump <ENTER>" for detailed help.')
|
||||
|
||||
@@ -183,9 +183,9 @@ def __lldb_init_module(debugger, dict):
|
||||
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -c %s.DumpLineTables %s' % (__name__,
|
||||
'command script add -o -c %s.DumpLineTables %s' % (__name__,
|
||||
DumpLineTables.command_name))
|
||||
debugger.HandleCommand(
|
||||
'command script add -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name))
|
||||
'command script add -o -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name))
|
||||
print('The "%s" and "%s" commands have been installed.' % (DumpLineTables.command_name,
|
||||
DumpFiles.command_name))
|
||||
|
||||
@@ -272,5 +272,5 @@ if __name__ == '__main__':
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
memfind_command.__doc__ = create_memfind_options().format_help()
|
||||
debugger.HandleCommand(
|
||||
'command script add -f memory.memfind_command memfind')
|
||||
'command script add -o -f memory.memfind_command memfind')
|
||||
print('"memfind" command installed, use the "--help" option for detailed help')
|
||||
|
||||
@@ -27,5 +27,5 @@ def info_sources(debugger, command, result, dict):
|
||||
def __lldb_init_module(debugger, dict):
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -f sources.info_sources info_sources')
|
||||
'command script add -o -f sources.info_sources info_sources')
|
||||
print('The "info_sources" command has been installed, type "help info_sources" or "info_sources --help" for detailed help.')
|
||||
|
||||
@@ -64,5 +64,5 @@ def stack_frames(debugger, command, result, dict):
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand(
|
||||
"command script add -f stacks.stack_frames stack_frames")
|
||||
"command script add -o -f stacks.stack_frames stack_frames")
|
||||
print("A new command called 'stack_frames' was added, type 'stack_frames --help' for more information.")
|
||||
|
||||
@@ -21,4 +21,4 @@ class StepAndPrint:
|
||||
return "Does a step-over then runs frame variable passing the command args to it\n"
|
||||
|
||||
def __lldb_init_module(debugger, unused):
|
||||
debugger.HandleCommand("command script add -c step_and_print.StepAndPrint sap")
|
||||
debugger.HandleCommand("command script add -o -c step_and_print.StepAndPrint sap")
|
||||
|
||||
@@ -351,5 +351,5 @@ if __name__ == '__main__':
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand(
|
||||
'command script add -f types.check_padding_command check_padding')
|
||||
'command script add -o -f types.check_padding_command check_padding')
|
||||
print('"check_padding" command installed, use the "--help" option for detailed help')
|
||||
|
||||
Reference in New Issue
Block a user