Better error handling in bugreport command when no command history (#1464)

pull/1467/head
Gulshan Singh 3 years ago committed by GitHub
parent 513dcdf870
commit 768cb04257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -158,9 +158,16 @@ If it is somehow unavailable, use:
except FileNotFoundError:
pass
max_command_no = (
int(gdb.execute("show commands", to_string=True).split("\n")[-2].split()[0]) - 1
)
max_command_no = 0
history_commands = gdb.execute("show commands", to_string=True)
if history_commands:
history_commands = history_commands.split("\n")
if len(history_commands > 1):
# The last element of the list is the `show commands` command we
# just ran, so we need to get the second to last one
last_command = history_commands[-2]
max_command_no = int(last_command.split()[0]) - 1
show_command_size = 10 # 'show command' returns 10 commands
gdb_current_session_history = {}
current_command_no = gdb_history_len + 1

@ -24,9 +24,7 @@ return_code = pytest.main(args)
if return_code != 0:
print("-" * 80)
print(
"If you want to debug tests locally, modify {} and add --pdb to its args".format(__file__)
)
print("If you want to debug tests locally, run ./tests.sh with the --pdb flag")
print("-" * 80)
sys.exit(return_code)

Loading…
Cancel
Save