Skip to contentSkip to conversation

scripts/gdb: scripts/gdb: Updates for 4.10

PATCH Applied Kieran Bingham 1 participant 2 messages Dec 9, 2016 GDB kernel debugging helper scripts

lore
Share & tools
lore

Kieran Bingham

author maintainer
#0 lore raw

cover scripts/gdb: scripts/gdb: Updates for 4.10

Hi Andrew,

Please include the following enhancement for gdb scripts in your queue.

A particularly short series, as I have only the one patch from Peter Griffin for integration. His addition provides the ability to extract the current device tree from memory, and save it to a file.

I've tested it locally, and it is functional and useful. Could you queue it up for integration please?

Regards

Kieran

CC Jan Kiszka <[email protected]>
CC Peter Griffin <[email protected]>

Peter Griffin (1):
scripts/gdb: add lx-fdtdump command

 scripts/gdb/linux/constants.py.in |  7 ++++
 scripts/gdb/linux/proc.py         | 73 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/1 scripts/gdb: add lx-fdtdump command

From: Peter Griffin <[email protected]>

lx-fdtdump dumps the flattened device tree passed to the kernel from the bootloader to the filename specified as the command argument. If no argument is provided it defaults to fdtdump.dtb. This then allows further post processing on the machine running GDB. The fdt header is also also printed in the GDB console. For example:

(gdb) lx-fdtdump

fdt_magic:         0xD00DFEED
fdt_totalsize:     0xC108
off_dt_struct:     0x38
off_dt_strings:    0x3804
off_mem_rsvmap:    0x28
version:           17
last_comp_version: 16

Dumped fdt to fdtdump.dtb

Quoted 1 line

fdtdump fdtdump.dtb | less

This command is useful as the bootloader can often re-write parts of the device tree, and this can sometimes cause the kernel to not boot.

---
 scripts/gdb/linux/constants.py.in |  7 ++++
 scripts/gdb/linux/proc.py         | 73 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
scripts/gdb/linux/constants.py.in +7 -0
index 7986f4e0da12..7aad82406422 100644
@@ -14,6 +14,7 @@
 
 #include <linux/fs.h>
 #include <linux/mount.h>
+#include <linux/of_fdt.h>
 
 /* We need to stringify expanded macros so that they can be parsed */
 
@@ -50,3 +51,9 @@ LX_VALUE(MNT_NOEXEC)
 LX_VALUE(MNT_NOATIME)
 LX_VALUE(MNT_NODIRATIME)
 LX_VALUE(MNT_RELATIME)
+
+/* linux/of_fdt.h> */
+LX_VALUE(OF_DT_HEADER)
+
+/* Kernel Configs */
+LX_CONFIG(CONFIG_OF)
scripts/gdb/linux/proc.py +73 -0

82 lines not on this page · raw message

Signature · 1 line
2.7.4