Fix parsing gaps in command line history (#2916)

pull/2920/head
William Tan 8 months ago committed by GitHub
parent 8ec3de322f
commit 75bf1502db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1430,20 +1430,18 @@ class GDB(pwndbg.dbg_mod.Debugger):
parsed_lines = []
for line in lines:
try:
number_str, command = line.split(maxsplit=1)
except ValueError:
# In rare cases GDB stores a number with no command, and the split()
# then only returns one element. We can safely ignore these.
continue
num_cmd = line.split(maxsplit=1)
try:
number = int(number_str)
number = int(num_cmd[0])
except ValueError:
# In rare cases GDB will output a warning after executing `show commands`
# (i.e. "warning: (Internal error: pc 0x0 in read in CU, but not in
# symtab.)").
return []
# In rare cases GDB stores a number with no command, and the split()
# then only returns one element. We can safely ignore these.
command = num_cmd[1] if len(num_cmd) > 1 else ""
parsed_lines.append((number, command))

Loading…
Cancel
Save