|
|
@@ -1138,14 +1138,20 @@ def run(runner, test_ids=[], **args):
|
|
|
|
|
|
# drop into gdb?
|
|
|
if failures and (args.get('gdb')
|
|
|
+ or args.get('gdb_powerloss_before')
|
|
|
+ or args.get('gdb_powerloss_after')
|
|
|
or args.get('gdb_case')
|
|
|
or args.get('gdb_main')):
|
|
|
failure = failures[0]
|
|
|
cmd = runner_ + [failure.id]
|
|
|
|
|
|
if args.get('gdb_main'):
|
|
|
+ # we don't really need the case breakpoint here, but it
|
|
|
+ # can be helpful
|
|
|
+ path, lineno = find_path(runner_, failure.id, **args)
|
|
|
cmd[:0] = args['gdb_path'] + [
|
|
|
'-ex', 'break main',
|
|
|
+ '-ex', 'break %s:%d' % (path, lineno),
|
|
|
'-ex', 'run',
|
|
|
'--args']
|
|
|
elif args.get('gdb_case'):
|
|
|
@@ -1154,6 +1160,30 @@ def run(runner, test_ids=[], **args):
|
|
|
'-ex', 'break %s:%d' % (path, lineno),
|
|
|
'-ex', 'run',
|
|
|
'--args']
|
|
|
+ elif args.get('gdb_powerloss_before'):
|
|
|
+ # figure out how many powerlosses there were
|
|
|
+ powerlosses = (
|
|
|
+ sum(1 for _ in re.finditer('[0-9a-f]',
|
|
|
+ failure.id.split(':', 2)[-1]))
|
|
|
+ if failure.id.count(':') >= 2 else 0)
|
|
|
+ path, lineno = find_path(runner_, failure.id, **args)
|
|
|
+ cmd[:0] = args['gdb_path'] + [
|
|
|
+ '-ex', 'break %s:%d' % (path, lineno),
|
|
|
+ '-ex', 'ignore 1 %d' % max(powerlosses-1, 0),
|
|
|
+ '-ex', 'run',
|
|
|
+ '--args']
|
|
|
+ elif args.get('gdb_powerloss_after'):
|
|
|
+ # figure out how many powerlosses there were
|
|
|
+ powerlosses = (
|
|
|
+ sum(1 for _ in re.finditer('[0-9a-f]',
|
|
|
+ failure.id.split(':', 2)[-1]))
|
|
|
+ if failure.id.count(':') >= 2 else 0)
|
|
|
+ path, lineno = find_path(runner_, failure.id, **args)
|
|
|
+ cmd[:0] = args['gdb_path'] + [
|
|
|
+ '-ex', 'break %s:%d' % (path, lineno),
|
|
|
+ '-ex', 'ignore 1 %d' % powerlosses,
|
|
|
+ '-ex', 'run',
|
|
|
+ '--args']
|
|
|
elif failure.assert_ is not None:
|
|
|
cmd[:0] = args['gdb_path'] + [
|
|
|
'-ex', 'run',
|
|
|
@@ -1342,6 +1372,14 @@ if __name__ == "__main__":
|
|
|
'--gdb',
|
|
|
action='store_true',
|
|
|
help="Drop into gdb on test failure.")
|
|
|
+ test_parser.add_argument(
|
|
|
+ '--gdb-powerloss-before',
|
|
|
+ action='store_true',
|
|
|
+ help="Drop into gdb before the powerloss that caused the failure.")
|
|
|
+ test_parser.add_argument(
|
|
|
+ '--gdb-powerloss-after',
|
|
|
+ action='store_true',
|
|
|
+ help="Drop into gdb after the powerloss that caused the failure.")
|
|
|
test_parser.add_argument(
|
|
|
'--gdb-case',
|
|
|
action='store_true',
|