Skip to content

Commit

Permalink
[lldb/crashlog] Fix python version requirement issue
Browse files Browse the repository at this point in the history
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@bennani.ma>
  • Loading branch information
medismailben committed Aug 21, 2023
1 parent a69340d commit 446abb5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lldb/examples/python/crashlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 446abb5

Please sign in to comment.