2 * gdb helper commands and functions for Linux kernel debugging
4 * Kernel constants derived from include files.
6 * Copyright (c) 2016 Linaro Ltd
9 * Kieran Bingham <kieran.bingham@linaro.org>
11 * This work is licensed under the terms of the GNU GPL version 2.
15 #include <linux/clk-provider.h>
17 #include <linux/hrtimer.h>
18 #include <linux/irq.h>
19 #include <linux/mount.h>
20 #include <linux/of_fdt.h>
21 #include <linux/page_ext.h>
22 #include <linux/radix-tree.h>
23 #include <linux/slab.h>
24 #include <linux/threads.h>
25 #include <linux/vmalloc.h>
27 /* We need to stringify expanded macros so that they can be parsed */
30 #define XSTRING(x) STRING(x)
32 #define LX_VALUE(x) LX_##x = x
33 #define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
36 * IS_ENABLED generates (a || b) which is not compatible with python
37 * We can only switch on configuration items we know are available
38 * Therefore - IS_BUILTIN() is more appropriate
40 #define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
42 /* The build system will take care of deleting everything above this marker */
43 <!-- end-c-headers -->
47 LX_CONFIG(CONFIG_DEBUG_INFO_REDUCED)
49 /* linux/clk-provider.h */
50 if IS_BUILTIN(CONFIG_COMMON_CLK):
51 LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
54 LX_GDBPARSED(SB_RDONLY)
55 LX_GDBPARSED(SB_SYNCHRONOUS)
56 LX_GDBPARSED(SB_MANDLOCK)
57 LX_GDBPARSED(SB_DIRSYNC)
58 LX_GDBPARSED(SB_NOATIME)
59 LX_GDBPARSED(SB_NODIRATIME)
62 LX_GDBPARSED(hrtimer_resolution)
65 LX_GDBPARSED(IRQD_LEVEL)
66 LX_GDBPARSED(IRQ_HIDDEN)
69 LX_GDBPARSED(MOD_TEXT)
70 LX_GDBPARSED(MOD_DATA)
71 LX_GDBPARSED(MOD_RODATA)
72 LX_GDBPARSED(MOD_RO_AFTER_INIT)
79 LX_VALUE(MNT_NODIRATIME)
80 LX_VALUE(MNT_RELATIME)
86 LX_VALUE(OF_DT_HEADER)
88 /* linux/radix-tree.h */
89 LX_GDBPARSED(RADIX_TREE_ENTRY_MASK)
90 LX_GDBPARSED(RADIX_TREE_INTERNAL_NODE)
91 LX_GDBPARSED(RADIX_TREE_MAP_SIZE)
92 LX_GDBPARSED(RADIX_TREE_MAP_SHIFT)
93 LX_GDBPARSED(RADIX_TREE_MAP_MASK)
100 LX_VALUE(VM_DMA_COHERENT)
102 /* linux/page_ext.h */
103 if IS_BUILTIN(CONFIG_PAGE_OWNER):
104 LX_GDBPARSED(PAGE_EXT_OWNER)
105 LX_GDBPARSED(PAGE_EXT_OWNER_ALLOCATED)
108 LX_GDBPARSED(SLAB_RED_ZONE)
109 LX_GDBPARSED(SLAB_POISON)
110 LX_GDBPARSED(SLAB_KMALLOC)
111 LX_GDBPARSED(SLAB_HWCACHE_ALIGN)
112 LX_GDBPARSED(SLAB_CACHE_DMA)
113 LX_GDBPARSED(SLAB_CACHE_DMA32)
114 LX_GDBPARSED(SLAB_STORE_USER)
115 LX_GDBPARSED(SLAB_PANIC)
118 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS)
119 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
120 LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
121 LX_CONFIG(CONFIG_NR_CPUS)
123 LX_CONFIG(CONFIG_TICK_ONESHOT)
124 LX_CONFIG(CONFIG_GENERIC_IRQ_SHOW_LEVEL)
125 LX_CONFIG(CONFIG_X86_LOCAL_APIC)
126 LX_CONFIG(CONFIG_SMP)
127 LX_CONFIG(CONFIG_X86_THERMAL_VECTOR)
128 LX_CONFIG(CONFIG_X86_MCE_THRESHOLD)
129 LX_CONFIG(CONFIG_X86_MCE_AMD)
130 LX_CONFIG(CONFIG_X86_MCE)
131 LX_CONFIG(CONFIG_X86_IO_APIC)
132 LX_CONFIG(CONFIG_HAVE_KVM)
133 LX_CONFIG(CONFIG_NUMA)
134 LX_CONFIG(CONFIG_ARM64)
135 LX_CONFIG(CONFIG_ARM64_4K_PAGES)
136 LX_CONFIG(CONFIG_ARM64_16K_PAGES)
137 LX_CONFIG(CONFIG_ARM64_64K_PAGES)
138 if IS_BUILTIN(CONFIG_ARM64):
139 LX_VALUE(CONFIG_ARM64_PA_BITS)
140 LX_VALUE(CONFIG_ARM64_VA_BITS)
141 LX_VALUE(CONFIG_ARM64_PAGE_SHIFT)
142 LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER)
143 LX_CONFIG(CONFIG_SPARSEMEM)
144 LX_CONFIG(CONFIG_SPARSEMEM_EXTREME)
145 LX_CONFIG(CONFIG_SPARSEMEM_VMEMMAP)
146 LX_CONFIG(CONFIG_KASAN)
147 LX_CONFIG(CONFIG_KASAN_GENERIC)
148 LX_CONFIG(CONFIG_KASAN_SW_TAGS)
149 LX_CONFIG(CONFIG_KASAN_HW_TAGS)
150 if IS_BUILTIN(CONFIG_KASAN_GENERIC) or IS_BUILTIN(CONFIG_KASAN_SW_TAGS):
151 LX_VALUE(CONFIG_KASAN_SHADOW_OFFSET)
152 LX_CONFIG(CONFIG_VMAP_STACK)
153 if IS_BUILTIN(CONFIG_NUMA):
154 LX_VALUE(CONFIG_NODES_SHIFT)
155 LX_CONFIG(CONFIG_DEBUG_VIRTUAL)
156 LX_CONFIG(CONFIG_STACKDEPOT)
157 LX_CONFIG(CONFIG_PAGE_OWNER)
158 LX_CONFIG(CONFIG_SLUB_DEBUG)
159 LX_CONFIG(CONFIG_SLAB_FREELIST_HARDENED)