0001 /*
0002 * gdb helper commands and functions for Linux kernel debugging
0003 *
0004 * Kernel constants derived from include files.
0005 *
0006 * Copyright (c) 2016 Linaro Ltd
0007 *
0008 * Authors:
0009 * Kieran Bingham <kieran.bingham@linaro.org>
0010 *
0011 * This work is licensed under the terms of the GNU GPL version 2.
0012 *
0013 */
0014
0015 #include <linux/clk-provider.h>
0016 #include <linux/fs.h>
0017 #include <linux/hrtimer.h>
0018 #include <linux/mount.h>
0019 #include <linux/of_fdt.h>
0020 #include <linux/threads.h>
0021
0022 /* We need to stringify expanded macros so that they can be parsed */
0023
0024 #define STRING(x) #x
0025 #define XSTRING(x) STRING(x)
0026
0027 #define LX_VALUE(x) LX_##x = x
0028 #define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
0029
0030 /*
0031 * IS_ENABLED generates (a || b) which is not compatible with python
0032 * We can only switch on configuration items we know are available
0033 * Therefore - IS_BUILTIN() is more appropriate
0034 */
0035 #define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
0036
0037 /* The build system will take care of deleting everything above this marker */
0038 <!-- end-c-headers -->
0039
0040 import gdb
0041
0042 /* linux/clk-provider.h */
0043 if IS_BUILTIN(CONFIG_COMMON_CLK):
0044 LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
0045
0046 /* linux/fs.h */
0047 LX_VALUE(SB_RDONLY)
0048 LX_VALUE(SB_SYNCHRONOUS)
0049 LX_VALUE(SB_MANDLOCK)
0050 LX_VALUE(SB_DIRSYNC)
0051 LX_VALUE(SB_NOATIME)
0052 LX_VALUE(SB_NODIRATIME)
0053
0054 /* linux/htimer.h */
0055 LX_GDBPARSED(hrtimer_resolution)
0056
0057 /* linux/mount.h */
0058 LX_VALUE(MNT_NOSUID)
0059 LX_VALUE(MNT_NODEV)
0060 LX_VALUE(MNT_NOEXEC)
0061 LX_VALUE(MNT_NOATIME)
0062 LX_VALUE(MNT_NODIRATIME)
0063 LX_VALUE(MNT_RELATIME)
0064
0065 /* linux/threads.h */
0066 LX_VALUE(NR_CPUS)
0067
0068 /* linux/of_fdt.h> */
0069 LX_VALUE(OF_DT_HEADER)
0070
0071 /* Kernel Configs */
0072 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS)
0073 LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
0074 LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
0075 LX_CONFIG(CONFIG_NR_CPUS)
0076 LX_CONFIG(CONFIG_OF)
0077 LX_CONFIG(CONFIG_TICK_ONESHOT)