Skip to content

Commit

Permalink
gdb: lx-symbols: do not error out on monolithic build
Browse files Browse the repository at this point in the history
This avoids spurious message:
(gdb) lx-symbols
loading vmlinux
No source file named kernel/module/main.c.

Link: https://lkml.kernel.org/r/Zy5ALByQtpO-ddh4@Z926fQmE5jqhFMgp6
Signed-off-by: Etienne Buira <etienne.buira@free.fr>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Etienne Buira authored and Andrew Morton committed Nov 15, 2024
1 parent 45dac19 commit 2c259a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/gdb/linux/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
module_type = utils.CachedType("struct module")


def has_modules():
return utils.gdb_eval_or_none("modules") is not None

def module_list():
global module_type
modules = utils.gdb_eval_or_none("modules")
Expand Down
3 changes: 3 additions & 0 deletions scripts/gdb/linux/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def invoke(self, arg, from_tty):

self.load_all_symbols()

if not modules.has_modules():
return

if hasattr(gdb, 'Breakpoint'):
if self.breakpoint is not None:
self.breakpoint.delete()
Expand Down

0 comments on commit 2c259a9

Please sign in to comment.