[Devel] [PATCH RHEL8 COMMIT] scripts/gdb: Fixed python gdb lib errors
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Apr 14 19:59:16 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.13
------>
commit a5da5cd3fbab4e2caca7db9beacdeb323692f58b
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date: Wed Apr 14 19:59:16 2021 +0300
scripts/gdb: Fixed python gdb lib errors
A bunch of minor fixes that enable successfull linux kernel debug
with gdb.
- Fixed COMPLETE_EXPRESSION not found in module 'gdb' error
- Fixed module linux.utils not found by fixing the system path
- Fixed module constants not found by adding CONFIG_GDB_SCRIPTS
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
configs/kernel-4.18.0-x86_64-KVM-minimal.config | 2 +-
configs/kernel-4.18.0-x86_64-debug.config | 2 +-
configs/kernel-4.18.0-x86_64.config | 2 +-
scripts/gdb/linux/lists.py | 8 ++++++++
scripts/gdb/vmlinux-gdb.py | 2 +-
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/configs/kernel-4.18.0-x86_64-KVM-minimal.config b/configs/kernel-4.18.0-x86_64-KVM-minimal.config
index 81f8480425ca..44bcca2ec934 100644
--- a/configs/kernel-4.18.0-x86_64-KVM-minimal.config
+++ b/configs/kernel-4.18.0-x86_64-KVM-minimal.config
@@ -4332,7 +4332,7 @@ CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_DWARF4=y
# CONFIG_DEBUG_INFO_BTF is not set
-# CONFIG_GDB_SCRIPTS is not set
+CONFIG_GDB_SCRIPTS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
diff --git a/configs/kernel-4.18.0-x86_64-debug.config b/configs/kernel-4.18.0-x86_64-debug.config
index 9f326c78980f..65aa4f6f303f 100644
--- a/configs/kernel-4.18.0-x86_64-debug.config
+++ b/configs/kernel-4.18.0-x86_64-debug.config
@@ -7065,7 +7065,7 @@ CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_DEBUG_INFO_BTF=y
-# CONFIG_GDB_SCRIPTS is not set
+CONFIG_GDB_SCRIPTS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
diff --git a/configs/kernel-4.18.0-x86_64.config b/configs/kernel-4.18.0-x86_64.config
index 0b16635922a0..554403b9aa35 100644
--- a/configs/kernel-4.18.0-x86_64.config
+++ b/configs/kernel-4.18.0-x86_64.config
@@ -7056,7 +7056,7 @@ CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_DEBUG_INFO_BTF=y
-# CONFIG_GDB_SCRIPTS is not set
+CONFIG_GDB_SCRIPTS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
index 2f335fbd86fd..67e3172aceb1 100644
--- a/scripts/gdb/linux/lists.py
+++ b/scripts/gdb/linux/lists.py
@@ -15,6 +15,14 @@ import gdb
from linux import utils
+# In later versions of gdb COMPLETE_SYMBOL has been renamed to
+# COMPLETE_EXPRESSION. That's the only difference that will lead to
+# inability to debug via python gdb lib. We can safely use this substitution
+# without forcing the developer to go through inconveniences of gdb package
+# versioning.
+if 'COMPLETE_EXPRESSION' not in dir(gdb) and 'COMPLETE_SYMBOL' in dir(gdb):
+ gdb.COMPLETE_EXPRESSION = gdb.COMPLETE_SYMBOL
+
list_head = utils.CachedType("struct list_head")
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py
index 6e0b0afd888a..4fa8a866b181 100644
--- a/scripts/gdb/vmlinux-gdb.py
+++ b/scripts/gdb/vmlinux-gdb.py
@@ -13,7 +13,7 @@
import os
-sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
+sys.path.insert(0, os.path.dirname(__file__))
try:
gdb.parse_and_eval("0")
More information about the Devel
mailing list