[Lldb-commits] [lldb] c3b471c - [lldb] Force override when adding crashlog command

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 12 19:21:17 PST 2023


Author: Med Ismail Bennani
Date: 2023-01-12T19:20:51-08:00
New Revision: c3b471c0be4f6b5a22afe10f95ff75bf1744d66e

URL: https://github.com/llvm/llvm-project/commit/c3b471c0be4f6b5a22afe10f95ff75bf1744d66e
DIFF: https://github.com/llvm/llvm-project/commit/c3b471c0be4f6b5a22afe10f95ff75bf1744d66e.diff

LOG: [lldb] Force override when adding crashlog command

When using interactive crashlog from an IDE, it can happen that the user
already have the `command script import lldb.macosx.crashlog` command on
their `lldbinit` file.

That leads to showing some message:

```
error: cannot add command: user command exists and force replace not set
error: cannot add command: user command exists and force replace not set
```

This leads to confusion because the crashlog symbolication continues and
succeeds even after these errors.

To address that, the crashlog commands get overridden everytime the
script get re-imported.

rdar://103403943

Differential Revision: https://reviews.llvm.org/D140113

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index d9e037057e67..6a5c560238ee 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1344,8 +1344,8 @@ def should_run_in_interactive_mode(options, ci):
 
 def __lldb_init_module(debugger, internal_dict):
     debugger.HandleCommand(
-        'command script add -c lldb.macosx.crashlog.Symbolicate crashlog')
+        'command script add -o -c lldb.macosx.crashlog.Symbolicate crashlog')
     debugger.HandleCommand(
-        'command script add -f lldb.macosx.crashlog.save_crashlog save_crashlog')
+        'command script add -o -f lldb.macosx.crashlog.save_crashlog save_crashlog')
     print('"crashlog" and "save_crashlog" commands have been installed, use '
           'the "--help" options on these commands for detailed help.')


        


More information about the lldb-commits mailing list