76f46f427b96268eb254a937ea8b9650555f3331
[sfrench/cifs-2.6.git] / scripts / gdb / linux / constants.py.in
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 <kieran.bingham@linaro.org>
10  *
11  * This work is licensed under the terms of the GNU GPL version 2.
12  *
13  */
14
15 #include <linux/fs.h>
16 #include <linux/hrtimer.h>
17 #include <linux/mount.h>
18 #include <linux/of_fdt.h>
19 #include <linux/threads.h>
20
21 /* We need to stringify expanded macros so that they can be parsed */
22
23 #define STRING(x) #x
24 #define XSTRING(x) STRING(x)
25
26 #define LX_VALUE(x) LX_##x = x
27 #define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
28
29 /*
30  * IS_ENABLED generates (a || b) which is not compatible with python
31  * We can only switch on configuration items we know are available
32  * Therefore - IS_BUILTIN() is more appropriate
33  */
34 #define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
35
36 /* The build system will take care of deleting everything above this marker */
37 <!-- end-c-headers -->
38
39 import gdb
40
41 /* linux/fs.h */
42 LX_VALUE(SB_RDONLY)
43 LX_VALUE(SB_SYNCHRONOUS)
44 LX_VALUE(SB_MANDLOCK)
45 LX_VALUE(SB_DIRSYNC)
46 LX_VALUE(SB_NOATIME)
47 LX_VALUE(SB_NODIRATIME)
48
49 /* linux/htimer.h */
50 LX_GDBPARSED(hrtimer_resolution)
51
52 /* linux/mount.h */
53 LX_VALUE(MNT_NOSUID)
54 LX_VALUE(MNT_NODEV)
55 LX_VALUE(MNT_NOEXEC)
56 LX_VALUE(MNT_NOATIME)
57 LX_VALUE(MNT_NODIRATIME)
58 LX_VALUE(MNT_RELATIME)
59
60 /* linux/threads.h */
61 LX_VALUE(NR_CPUS)
62
63 /* linux/of_fdt.h> */
64 LX_VALUE(OF_DT_HEADER)
65
66 /* Kernel Configs */
67 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS)
68 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
69 LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
70 LX_CONFIG(CONFIG_NR_CPUS)
71 LX_CONFIG(CONFIG_OF)
72 LX_CONFIG(CONFIG_TICK_ONESHOT)