From 2c259a91d8d23a8266092b0dd51b8092877717a4 Mon Sep 17 00:00:00 2001
From: Etienne Buira <etienne.buira@free.fr>
Date: Fri, 8 Nov 2024 17:45:32 +0100
Subject: gdb: lx-symbols: do not error out on monolithic build

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>
---
 scripts/gdb/linux/modules.py | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'scripts/gdb/linux/modules.py')

diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py
index 298dfcc25eae..fa15f872ddbe 100644
--- a/scripts/gdb/linux/modules.py
+++ b/scripts/gdb/linux/modules.py
@@ -19,6 +19,9 @@ from linux import cpus, utils, lists, constants
 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")
-- 
cgit v1.2.3-70-g09d2