Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1339652
| From | Kieran Bingham <kieran.bingham@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/8] scripts/gdb: Support !CONFIG_MODULES gracefully |
| Date | 2016-02-22 16:30 +0100 |
| Message-ID | <r50AY-7F1-61@gated-at.bofh.it> (permalink) |
| References | <r50AW-7F1-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
If CONFIG_MODULES is not enabled, lx-lsmod tries to find
a non-existent symbol and generates an unfriendly traceback:
(gdb) lx-lsmod
Address Module Size Used by
Traceback (most recent call last):
File "scripts/gdb/linux/modules.py", line 75, in invoke
for module in module_list():
File "scripts/gdb/linux/modules.py", line 24, in module_list
module_ptr_type = module_type.get_type().pointer()
File "scripts/gdb/linux/utils.py", line 28, in get_type
self._type = gdb.lookup_type(self._name)
gdb.error: No struct type named module.
Error occurred in Python command: No struct type named module.
Catch the error and return an empty module_list() for a clean command
output as follows:
(gdb) lx-lsmod
Address Module Size Used by
(gdb)
Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
---
scripts/gdb/linux/modules.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py
index 571489b3b9c2..60224d8bbfb2 100644
--- a/scripts/gdb/linux/modules.py
+++ b/scripts/gdb/linux/modules.py
@@ -21,8 +21,11 @@ module_type = utils.CachedType("struct module")
def module_list():
global module_type
+ modules = utils.gdb_eval_or_none("modules")
+ if modules is None:
+ return
+
module_ptr_type = module_type.get_type().pointer()
- modules = gdb.parse_and_eval("modules")
for module in lists.list_for_each_entry(modules, module_ptr_type, "list"):
yield module
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv2 0/8] gdb/scripts: Linux awareness debug commands Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
[PATCH 2/8] scripts/gdb: Provide a kernel list item generators Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
[PATCH 7/8] scripts/gdb: Add mount point list command Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
[PATCH 8/8] scripts/gdb: Add meminfo command Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
Re: [PATCH 8/8] scripts/gdb: Add meminfo command Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-24 10:50 +0100
[PATCH 4/8] scripts/gdb: Provide exception catching parser Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
[PATCH 3/8] scripts/gdb: Convert modules usage to lists functions Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
[PATCH 5/8] scripts/gdb: Support !CONFIG_MODULES gracefully Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-22 16:30 +0100
Re: [PATCHv2 0/8] gdb/scripts: Linux awareness debug commands Jan Kiszka <jan.kiszka@siemens.com> - 2016-02-29 17:40 +0100
Re: [PATCHv2 0/8] gdb/scripts: Linux awareness debug commands Kieran Bingham <kieran.bingham@linaro.org> - 2016-02-29 18:10 +0100
csiph-web