[Lldb-commits] [lldb] 446abb5 - [lldb/crashlog] Fix python version requirement issue

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 21 13:53:43 PDT 2023


Author: Med Ismail Bennani
Date: 2023-08-21T21:52:44+01:00
New Revision: 446abb5125f76423232e5d4d3ed116cccfbd8b99

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

LOG: [lldb/crashlog] Fix python version requirement issue

In 21a597c, we fixed a module loading issue by using the new
`argparse.BooleanOptionalAction`. However, this is only available
starting python 3.9 and causes test failures on bots that don't fulfill
this requirement.

To address that, this patch replaces the use of `BooleanOptionalAction`
by a pair of 2 opposite `store` actions pointing to the same destination
variable.

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

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index efef43045f9c60..cb8008419404c2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@ def CreateSymbolicateCrashLogOptions(
         help="pause for NSEC seconds for debugger",
         default=0,
     )
+    # NOTE: Requires python 3.9
+    # arg_parser.add_argument(
+    #     "--crashed-only",
+    #     "-c",
+    #     action=argparse.BooleanOptionalAction,
+    #     dest="crashed_only",
+    #     help="only symbolicate the crashed thread",
+    #     default=True,
+    # )
     arg_parser.add_argument(
         "--crashed-only",
         "-c",
-        action=argparse.BooleanOptionalAction,
+        action="store_true",
         dest="crashed_only",
         help="only symbolicate the crashed thread",
         default=True,
     )
+    arg_parser.add_argument(
+        "--no-crashed-only",
+        action="store_false",
+        dest="crashed_only",
+        help="do not symbolicate the crashed thread",
+    )
     arg_parser.add_argument(
         "--disasm-depth",
         "-d",


        


More information about the lldb-commits mailing list