Skip to content

Commit

Permalink
scripts: coredump: Fix loading coredumps when thread info is enabled.
Browse files Browse the repository at this point in the history
When loading a coredump with an an elf built using
'CONFIG_DEBUG_THREAD_INFO=y', gdbstubs assumes that the thread info
memoryblock populated by 'CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_THREADS=y'
will be present in the coredump. This is not always true and causes an
error, and a failure to load the coredump. Add a default value for the
threads_metadata variable in CoredumpLogFile which can be used to detect
when the memory block is not present. This allows the coredump to load
successfully.

Signed-off-by: Félix Turgeon <[email protected]>
  • Loading branch information
felixturgeonmeta authored and fabiobaltieri committed Dec 9, 2024
1 parent 29436c2 commit 9cdb07c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/coredump/coredump_parser/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __init__(self, logfile):
self.log_hdr = None
self.arch_data = list()
self.memory_regions = list()
self.threads_metadata = {"hdr_ver" : None, "data" : None}

def open(self):
self.fd = open(self.logfile, "rb")
Expand Down
5 changes: 5 additions & 0 deletions scripts/coredump/gdbstubs/gdbstub.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def handle_general_query_packet(self, pkt):
# For packets qfThreadInfo/qsThreadInfo, obtain a list of all active thread IDs
if pkt[0:12] == b"qfThreadInfo":
threads_metadata_data = self.logfile.get_threads_metadata()["data"]

if threads_metadata_data is None:
self.put_gdb_packet(b"l")
return

size_t_size = self.elffile.get_kernel_thread_info_size_t_size()

# First, find and store the thread that _kernel considers current
Expand Down

0 comments on commit 9cdb07c

Please sign in to comment.