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/clk-provider.h> 16#include <linux/fs.h> 17#include <linux/hrtimer.h> 18#include <linux/mount.h> 19#include <linux/of_fdt.h> 20#include <linux/threads.h> 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 40import gdb 41 42LX_CONFIG(CONFIG_DEBUG_INFO_REDUCED) 43 44/* linux/clk-provider.h */ 45if IS_BUILTIN(CONFIG_COMMON_CLK): 46 LX_GDBPARSED(CLK_GET_RATE_NOCACHE) 47 48/* linux/fs.h */ 49LX_VALUE(SB_RDONLY) 50LX_VALUE(SB_SYNCHRONOUS) 51LX_VALUE(SB_MANDLOCK) 52LX_VALUE(SB_DIRSYNC) 53LX_VALUE(SB_NOATIME) 54LX_VALUE(SB_NODIRATIME) 55 56/* linux/htimer.h */ 57LX_GDBPARSED(hrtimer_resolution) 58 59/* linux/mount.h */ 60LX_VALUE(MNT_NOSUID) 61LX_VALUE(MNT_NODEV) 62LX_VALUE(MNT_NOEXEC) 63LX_VALUE(MNT_NOATIME) 64LX_VALUE(MNT_NODIRATIME) 65LX_VALUE(MNT_RELATIME) 66 67/* linux/threads.h */ 68LX_VALUE(NR_CPUS) 69 70/* linux/of_fdt.h> */ 71LX_VALUE(OF_DT_HEADER) 72 73/* Kernel Configs */ 74LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS) 75LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) 76LX_CONFIG(CONFIG_HIGH_RES_TIMERS) 77LX_CONFIG(CONFIG_NR_CPUS) 78LX_CONFIG(CONFIG_OF) 79LX_CONFIG(CONFIG_TICK_ONESHOT) 80