File tree 4 files changed +54
-1
lines changed
4 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 5
5
# 2) Generate timeconst.h
6
6
# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
7
7
# 4) Check for missing system calls
8
+ # 5) Generate constants.py (may need bounds.h)
8
9
9
10
# Default sed regexp - multiline due to syntax constraints
10
11
define sed-y
@@ -96,5 +97,14 @@ quiet_cmd_syscalls = CALL $<
96
97
missing-syscalls : scripts/checksyscalls.sh $(offsets-file ) FORCE
97
98
$(call cmd,syscalls)
98
99
100
+ # ####
101
+ # 5) Generate constants for Python GDB integration
102
+ #
103
+
104
+ extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
105
+
106
+ build_constants_py : $(obj ) /$(timeconst-file ) $(obj ) /$(bounds-file )
107
+ @$(MAKE ) $(build ) =scripts/gdb/linux $@
108
+
99
109
# Keep these three files during make clean
100
110
no-clean-files := $(bounds-file ) $(offsets-file ) $(timeconst-file )
Original file line number Diff line number Diff line change @@ -8,4 +8,14 @@ ifneq ($(KBUILD_SRC),)
8
8
endif
9
9
@:
10
10
11
- clean-files := *.pyc *.pyo $(if $(KBUILD_SRC ) ,* .py)
11
+ quiet_cmd_gen_constants_py = GEN $@
12
+ cmd_gen_constants_py = \
13
+ $(CPP ) -E -x c -P $(c_flags ) $< > $@ ;\
14
+ sed -i '1,/<!-- end-c-headers -->/d;' $@
15
+
16
+ $(obj ) /constants.py : $(SRCTREE ) /$(obj ) /constants.py.in
17
+ $(call if_changed,gen_constants_py)
18
+
19
+ build_constants_py : $(obj ) /constants.py
20
+
21
+ clean-files := *.pyc *.pyo $(if $(KBUILD_SRC ) ,* .py) $(obj ) /constants.py
Original file line number Diff line number Diff line change
1
+ /*
2
+ * gdb helper commands and functions for Linux kernel debugging
3
+ *
4
+ * Kernel constants derived from include files.
5
+ *
6
+ * Copyright (c) 2016 Linaro Ltd
7
+ *
8
+ * Authors:
9
+ * Kieran Bingham <
[email protected] >
10
+ *
11
+ * This work is licensed under the terms of the GNU GPL version 2.
12
+ *
13
+ */
14
+
15
+ /* We need to stringify expanded macros so that they can be parsed */
16
+ #define STRING(x) #x
17
+ #define XSTRING(x) STRING(x)
18
+
19
+ #define LX_VALUE(x) LX_##x = x
20
+ #define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
21
+
22
+ /*
23
+ * IS_ENABLED generates (a || b) which is not compatible with python
24
+ * We can only switch on configuration items we know are available
25
+ * Therefore - IS_BUILTIN() is more appropriate
26
+ */
27
+ #define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
28
+
29
+ /* The build system will take care of deleting everything above this marker */
30
+ <!-- end-c-headers -->
31
+
32
+ import gdb
Original file line number Diff line number Diff line change 30
30
import linux .cpus
31
31
import linux .lists
32
32
import linux .proc
33
+ import linux .constants
You can’t perform that action at this time.
0 commit comments