Skip to content

Commit da036ae

Browse files
dianderstorvalds
authored andcommitted
scripts/gdb: handle split debug
Some systems (like Chrome OS) may use "split debug" for kernel modules. That means that the debug symbols are in a different file than the main elf file. Let's handle that by also searching for debug symbols that end in ".ko.debug". This is a packaging topic. You can take a normal elf file and split the debug out of it using objcopy. Try "man objcopy" and then take a look at the "--only-keep-debug" option. It'll give you a whole recipe for doing splitdebug. The suffix used for the debug symbols is arbitrary. If people have other another suffix besides ".ko.debug" then we could presumably support that too... For portage (which is the packaging system used by Chrome OS) split debug is supported by default (and the suffix is .ko.debug). ...and so in Chrome OS we always get the installed elf files stripped and then the symbols stashed away. At the moment we don't actually use the normal portage magic to do this for the kernel though since it affects our ability to get good stack dumps in the kernel. We instead pass a script as "strip" [1]. [1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/master/eclass/cros-kernel/strip_splitdebug Link: http://lkml.kernel.org/r/20190730234052.148744-1-dianders@chromium.org Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: Kieran Bingham <kbingham@kernel.org> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7d92bda commit da036ae

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/gdb/linux/symbols.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def _update_module_files(self):
7777
gdb.write("scanning for modules in {0}\n".format(path))
7878
for root, dirs, files in os.walk(path):
7979
for name in files:
80-
if name.endswith(".ko"):
80+
if name.endswith(".ko") or name.endswith(".ko.debug"):
8181
self.module_files.append(root + "/" + name)
8282
self.module_files_updated = True
8383

8484
def _get_module_file(self, module_name):
85-
module_pattern = ".*/{0}\.ko$".format(
85+
module_pattern = ".*/{0}\.ko(?:.debug)?$".format(
8686
module_name.replace("_", r"[_\-]"))
8787
for name in self.module_files:
8888
if re.match(module_pattern, name) and os.path.exists(name):

0 commit comments

Comments
 (0)