Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 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 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 15 | #include <linux/clk-provider.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 16 | #include <linux/fs.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 17 | #include <linux/hrtimer.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 18 | #include <linux/mount.h> |
| 19 | #include <linux/of_fdt.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 20 | #include <linux/threads.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 21 | |
| 22 | /* We need to stringify expanded macros so that they can be parsed */ |
| 23 | |
| 24 | #define STRING(x) #x |
| 25 | #define XSTRING(x) STRING(x) |
| 26 | |
| 27 | #define LX_VALUE(x) LX_##x = x |
| 28 | #define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x)) |
| 29 | |
| 30 | /* |
| 31 | * IS_ENABLED generates (a || b) which is not compatible with python |
| 32 | * We can only switch on configuration items we know are available |
| 33 | * Therefore - IS_BUILTIN() is more appropriate |
| 34 | */ |
| 35 | #define LX_CONFIG(x) LX_##x = IS_BUILTIN(x) |
| 36 | |
| 37 | /* The build system will take care of deleting everything above this marker */ |
| 38 | <!-- end-c-headers --> |
| 39 | |
| 40 | import gdb |
| 41 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 42 | /* linux/clk-provider.h */ |
| 43 | if IS_BUILTIN(CONFIG_COMMON_CLK): |
| 44 | LX_GDBPARSED(CLK_GET_RATE_NOCACHE) |
| 45 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 46 | /* linux/fs.h */ |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 47 | LX_VALUE(SB_RDONLY) |
| 48 | LX_VALUE(SB_SYNCHRONOUS) |
| 49 | LX_VALUE(SB_MANDLOCK) |
| 50 | LX_VALUE(SB_DIRSYNC) |
| 51 | LX_VALUE(SB_NOATIME) |
| 52 | LX_VALUE(SB_NODIRATIME) |
| 53 | |
| 54 | /* linux/htimer.h */ |
| 55 | LX_GDBPARSED(hrtimer_resolution) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 56 | |
| 57 | /* linux/mount.h */ |
| 58 | LX_VALUE(MNT_NOSUID) |
| 59 | LX_VALUE(MNT_NODEV) |
| 60 | LX_VALUE(MNT_NOEXEC) |
| 61 | LX_VALUE(MNT_NOATIME) |
| 62 | LX_VALUE(MNT_NODIRATIME) |
| 63 | LX_VALUE(MNT_RELATIME) |
| 64 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 65 | /* linux/threads.h */ |
| 66 | LX_VALUE(NR_CPUS) |
| 67 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 68 | /* linux/of_fdt.h> */ |
| 69 | LX_VALUE(OF_DT_HEADER) |
| 70 | |
| 71 | /* Kernel Configs */ |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 72 | LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS) |
| 73 | LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) |
| 74 | LX_CONFIG(CONFIG_HIGH_RES_TIMERS) |
| 75 | LX_CONFIG(CONFIG_NR_CPUS) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 76 | LX_CONFIG(CONFIG_OF) |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 77 | LX_CONFIG(CONFIG_TICK_ONESHOT) |