Skip to contentSkip to conversation

scripts/gdb: change kernel config dumping method

PATCH In review Kuan-Ying Lee 2 participants 2 messages Jun 10, 2022 – Jun 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/gdb: change kernel config dumping method

MAGIC_START("IKCFG_ST") and MAGIC_END("IKCFG_ED") are moved out from the kernel_config_data variable [1].

Thus, we parse kernel_config_data directly instead of considering offset of MAGIC_START and MAGIC_END.

[1] https://lore.kernel.org/lkml/[email protected]/

Fixes 13610aa908dc ("kernel/configs: use .incbin directive to embed config_data.gz")
---
 scripts/gdb/linux/config.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/gdb/linux/config.py +3 -3
index 90e1565b1967..8843ab3cbadd 100644
@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
             filename = arg
 
         try:
-            py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
-            py_config_size = gdb.parse_and_eval(
-                    "sizeof(kernel_config_data) - 1 - 8 * 2")
+            py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
+            py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
+            py_config_size = py_config_ptr_end - py_config_ptr
         except gdb.error as e:
             raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
 
Signature · 1 line
2.18.0
#1 lore raw
Quoted 11 lines · Kuan-Ying Lee

MAGIC_START("IKCFG_ST") and MAGIC_END("IKCFG_ED") are moved out from the kernel_config_data variable [1].

Thus, we parse kernel_config_data directly instead of considering offset of MAGIC_START and MAGIC_END.

[1] https://lore.kernel.org/lkml/[email protected]/

Fixes 13610aa908dc ("kernel/configs: use .incbin directive to embed config_data.gz")

Thanks for the fix.

Applied to linux-kbuild/fixes.

Quoted 24 lines
---
 scripts/gdb/linux/config.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/gdb/linux/config.py +3 -4
index 90e1565b1967..8843ab3cbadd 100644
@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
             filename = arg
 
         try:
-            py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
-            py_config_size = gdb.parse_and_eval(
-                    "sizeof(kernel_config_data) - 1 - 8 * 2")
+            py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
+            py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
+            py_config_size = py_config_ptr_end - py_config_ptr
         except gdb.error as e:
             raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
 
--

2.18.0

Signature · 2 lines
Best Regards
Masahiro Yamada