public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] scripts/gdb: Updates for 4.7
@ 2016-05-10  7:39 Jan Kiszka
  2016-05-10  7:39 ` [PATCH 02/18] scripts/gdb: Provide linux constants Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2016-05-10  7:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Dom Cote, Jeff Mahoney, Jonathan Corbet,
	Kieran Bingham, Kieran Bingham, linux-doc, linux-kbuild, mmarek

Hi Andrew,

please include the following enhancements and fixed for the gdb scripts
in your queue.

This adds a number of new commands and helper functions, contributed by
Kieran, and fixes lx-dmesg for Python 3 as well as corrects the output
of lx-lsmod.

Kieran stepped up to support me significantly with the maintenance of
the script. Andrew, it may very well be that you will receive the next
merge request from him already.

Jan

CC: Dom Cote <buzdelabuz2+git@gmail.com>
CC: Jeff Mahoney <jeffm@suse.com>
Cc: Jonathan Corbet <corbet@lwn.net>
CC: Kieran Bingham <kieran.bingham@linaro.org>
CC: Kieran Bingham <kieran@bingham.xyz>
Cc: linux-doc@vger.kernel.org
CC: linux-kbuild@vger.kernel.org
CC: mmarek@suse.com

Dom Cote (2):
  scripts/gdb: Improve types abstraction for gdb python scripts
  scripts/gdb: Fix issue with dmesg.py and python 3.X

Jan Kiszka (2):
  scripts/gdb: Adjust module reference counter reported by lx-lsmod
  scripts/gdb: Cast CPU numbers to integer

Kieran Bingham (14):
  scripts/gdb: Provide linux constants
  scripts/gdb: Provide kernel list item generators
  scripts/gdb: Convert modules usage to lists functions
  scripts/gdb: Provide exception catching parser
  scripts/gdb: Support !CONFIG_MODULES gracefully
  scripts/gdb: Provide a dentry_name VFS path helper
  scripts/gdb: Add io resource readers
  scripts/gdb: Add mount point list command
  scripts/gdb: Add cpu iterators
  scripts/gdb: Add a Radix Tree Parser
  scripts/gdb: Add documentation example for radix tree
  scripts/gdb: Add lx_thread_info_by_pid helper
  scripts/gdb: decode bytestream on dmesg for Python3
  MAINTAINERS: Add co-maintainer for scripts/gdb

 Documentation/gdb-kernel-debugging.txt |  21 +++++
 Kbuild                                 |  10 +++
 MAINTAINERS                            |   1 +
 scripts/gdb/linux/Makefile             |  12 ++-
 scripts/gdb/linux/constants.py.in      |  59 +++++++++++++
 scripts/gdb/linux/cpus.py              |  38 ++++++++
 scripts/gdb/linux/dmesg.py             |  11 +--
 scripts/gdb/linux/lists.py             |  21 +++++
 scripts/gdb/linux/modules.py           |  24 +++--
 scripts/gdb/linux/proc.py              | 156 +++++++++++++++++++++++++++++++++
 scripts/gdb/linux/radixtree.py         |  97 ++++++++++++++++++++
 scripts/gdb/linux/tasks.py             |  19 ++++
 scripts/gdb/linux/utils.py             |  32 ++++++-
 scripts/gdb/vmlinux-gdb.py             |   2 +
 14 files changed, 482 insertions(+), 21 deletions(-)
 create mode 100644 scripts/gdb/linux/constants.py.in
 create mode 100644 scripts/gdb/linux/radixtree.py

-- 
2.1.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 02/18] scripts/gdb: Provide linux constants
  2016-05-10  7:39 [PATCH 00/18] scripts/gdb: Updates for 4.7 Jan Kiszka
@ 2016-05-10  7:39 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2016-05-10  7:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Kieran Bingham, mmarek, linux-kbuild

From: Kieran Bingham <kieran.bingham@linaro.org>

Some macro's and defines are needed when parsing memory, and without
compiling the kernel as -g3 they are not available in the debug-symbols.

We use the pre-processor here to extract constants to a dedicated module
for the linux debugger extensions

Top level Kbuild is used to call in and generate the constants file,
while maintaining dependencies on autogenerated files in
include/generated

CC: mmarek@suse.com
CC: linux-kbuild@vger.kernel.org

Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 Kbuild                            | 10 ++++++++++
 scripts/gdb/linux/Makefile        | 12 +++++++++++-
 scripts/gdb/linux/constants.py.in | 32 ++++++++++++++++++++++++++++++++
 scripts/gdb/vmlinux-gdb.py        |  1 +
 4 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 scripts/gdb/linux/constants.py.in

diff --git a/Kbuild b/Kbuild
index f55cefd..3d0ae15 100644
--- a/Kbuild
+++ b/Kbuild
@@ -5,6 +5,7 @@
 # 2) Generate timeconst.h
 # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
 # 4) Check for missing system calls
+# 5) Generate constants.py (may need bounds.h)
 
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
@@ -96,5 +97,14 @@ quiet_cmd_syscalls = CALL    $<
 missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
 	$(call cmd,syscalls)
 
+#####
+# 5) Generate constants for Python GDB integration
+#
+
+extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
+
+build_constants_py: $(obj)/$(timeconst-file) $(obj)/$(bounds-file)
+	@$(MAKE) $(build)=scripts/gdb/linux $@
+
 # Keep these three files during make clean
 no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile
index 6cf1ecf..cd129e6 100644
--- a/scripts/gdb/linux/Makefile
+++ b/scripts/gdb/linux/Makefile
@@ -8,4 +8,14 @@ ifneq ($(KBUILD_SRC),)
 endif
 	@:
 
-clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py)
+quiet_cmd_gen_constants_py = GEN     $@
+      cmd_gen_constants_py = \
+	$(CPP) -E -x c -P $(c_flags) $< > $@ ;\
+	sed -i '1,/<!-- end-c-headers -->/d;' $@
+
+$(obj)/constants.py: $(SRCTREE)/$(obj)/constants.py.in
+	$(call if_changed,gen_constants_py)
+
+build_constants_py: $(obj)/constants.py
+
+clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py) $(obj)/constants.py
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
new file mode 100644
index 0000000..79d9d00
--- /dev/null
+++ b/scripts/gdb/linux/constants.py.in
@@ -0,0 +1,32 @@
+/*
+ * gdb helper commands and functions for Linux kernel debugging
+ *
+ *  Kernel constants derived from include files.
+ *
+ * Copyright (c) 2016 Linaro Ltd
+ *
+ * Authors:
+ *  Kieran Bingham <kieran.bingham@linaro.org>
+ *
+ * This work is licensed under the terms of the GNU GPL version 2.
+ *
+ */
+
+/* We need to stringify expanded macros so that they can be parsed */
+#define STRING(x) #x
+#define XSTRING(x) STRING(x)
+
+#define LX_VALUE(x) LX_##x = x
+#define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
+
+/*
+ * IS_ENABLED generates (a || b) which is not compatible with python
+ * We can only switch on configuration items we know are available
+ * Therefore - IS_BUILTIN() is more appropriate
+ */
+#define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
+
+/* The build system will take care of deleting everything above this marker */
+<!-- end-c-headers -->
+
+import gdb
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py
index d5943ec..6e0b0af 100644
--- a/scripts/gdb/vmlinux-gdb.py
+++ b/scripts/gdb/vmlinux-gdb.py
@@ -30,3 +30,4 @@ else:
     import linux.cpus
     import linux.lists
     import linux.proc
+    import linux.constants
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-10  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10  7:39 [PATCH 00/18] scripts/gdb: Updates for 4.7 Jan Kiszka
2016-05-10  7:39 ` [PATCH 02/18] scripts/gdb: Provide linux constants Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox