From: Greg Hudson Date: Thu, 10 Feb 2022 20:02:14 +0000 (-0500) Subject: In k5test, look for lldb if gdb is not found X-Git-Tag: krb5-1.20-beta1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06e108a5eeb967361493ef1924ce7334f00cccc0;p=thirdparty%2Fkrb5.git In k5test, look for lldb if gdb is not found XCode for macOS provides lldb but not gdb. For convenience, make k5test default to lldb if gdb is not found in the path. --- diff --git a/src/util/k5test.py b/src/util/k5test.py index bd71a45e77..619f1995f8 100644 --- a/src/util/k5test.py +++ b/src/util/k5test.py @@ -575,8 +575,7 @@ def _parse_args(): parser.add_option('--debug', dest='debug', metavar='NUM', help='Debug numbered command (or "all")') parser.add_option('--debugger', dest='debugger', metavar='COMMAND', - help='Debugger command (default is gdb --args)', - default='gdb --args') + help='Debugger command (default is gdb --args)') parser.add_option('--stop-before', dest='stopb', metavar='NUM', help='Stop before numbered command (or "all")') parser.add_option('--stop-after', dest='stopa', metavar='NUM', @@ -589,12 +588,21 @@ def _parse_args(): verbose = options.verbose testpass = options.testpass _debug = _parse_cmdnum('--debug', options.debug) - _debugger_command = shlex.split(options.debugger) _stop_before = _parse_cmdnum('--stop-before', options.stopb) _stop_after = _parse_cmdnum('--stop-after', options.stopa) _shell_before = _parse_cmdnum('--shell-before', options.shellb) _shell_after = _parse_cmdnum('--shell-after', options.shella) + if options.debugger is not None: + _debugger_command = shlex.split(options.debugger) + elif which('gdb') is not None: + _debugger_command = ['gdb', '--args'] + elif which('lldb') is not None: + _debugger_command = ['lldb', '--'] + elif options.debug is not None: + print('Cannot find a debugger; use --debugger=COMMAND') + sys.exit(1) + # Translate a command number spec. -1 means all, None means none. def _parse_cmdnum(optname, str):