2016-05-23 23:24:40 +00:00
|
|
|
/*
|
|
|
|
* gdb helper commands and functions for Linux kernel debugging
|
|
|
|
*
|
|
|
|
* Kernel constants derived from include files.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016 Linaro Ltd
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Kieran Bingham <kieran.bingham@linaro.org>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL version 2.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-05-14 22:46:17 +00:00
|
|
|
#include <linux/clk-provider.h>
|
2016-05-23 23:24:59 +00:00
|
|
|
#include <linux/fs.h>
|
2019-05-14 22:45:59 +00:00
|
|
|
#include <linux/hrtimer.h>
|
2016-05-23 23:24:59 +00:00
|
|
|
#include <linux/mount.h>
|
2017-07-12 21:34:13 +00:00
|
|
|
#include <linux/of_fdt.h>
|
2019-05-14 22:45:59 +00:00
|
|
|
#include <linux/threads.h>
|
2016-05-23 23:24:59 +00:00
|
|
|
|
2016-05-23 23:24:40 +00:00
|
|
|
/* We need to stringify expanded macros so that they can be parsed */
|
2016-05-23 23:24:59 +00:00
|
|
|
|
2016-05-23 23:24:40 +00:00
|
|
|
#define STRING(x) #x
|
|
|
|
#define XSTRING(x) STRING(x)
|
|
|
|
|
|
|
|
#define LX_VALUE(x) LX_##x = x
|
|
|
|
#define LX_GDBPARSED(x) LX_##x = gdb.parse_and_eval(XSTRING(x))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IS_ENABLED generates (a || b) which is not compatible with python
|
|
|
|
* We can only switch on configuration items we know are available
|
|
|
|
* Therefore - IS_BUILTIN() is more appropriate
|
|
|
|
*/
|
|
|
|
#define LX_CONFIG(x) LX_##x = IS_BUILTIN(x)
|
|
|
|
|
|
|
|
/* The build system will take care of deleting everything above this marker */
|
|
|
|
<!-- end-c-headers -->
|
|
|
|
|
|
|
|
import gdb
|
2016-05-23 23:24:59 +00:00
|
|
|
|
2019-05-14 22:46:17 +00:00
|
|
|
/* linux/clk-provider.h */
|
2019-06-01 05:30:36 +00:00
|
|
|
if IS_BUILTIN(CONFIG_COMMON_CLK):
|
|
|
|
LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
|
2019-05-14 22:46:17 +00:00
|
|
|
|
2016-05-23 23:24:59 +00:00
|
|
|
/* linux/fs.h */
|
2023-06-07 22:13:35 +00:00
|
|
|
LX_GDBPARSED(SB_RDONLY)
|
|
|
|
LX_GDBPARSED(SB_SYNCHRONOUS)
|
|
|
|
LX_GDBPARSED(SB_MANDLOCK)
|
|
|
|
LX_GDBPARSED(SB_DIRSYNC)
|
|
|
|
LX_GDBPARSED(SB_NOATIME)
|
|
|
|
LX_GDBPARSED(SB_NODIRATIME)
|
2016-05-23 23:24:59 +00:00
|
|
|
|
2019-05-14 22:45:59 +00:00
|
|
|
/* linux/htimer.h */
|
|
|
|
LX_GDBPARSED(hrtimer_resolution)
|
|
|
|
|
2024-05-09 05:53:58 +00:00
|
|
|
/* linux/module.h */
|
2024-05-09 05:53:58 +00:00
|
|
|
if IS_BUILTIN(CONFIG_MODULES):
|
|
|
|
LX_GDBPARSED(MOD_TEXT)
|
|
|
|
LX_GDBPARSED(MOD_DATA)
|
|
|
|
LX_GDBPARSED(MOD_RODATA)
|
|
|
|
LX_GDBPARSED(MOD_RO_AFTER_INIT)
|
2024-05-09 05:53:58 +00:00
|
|
|
|
2016-05-23 23:24:59 +00:00
|
|
|
/* linux/mount.h */
|
|
|
|
LX_VALUE(MNT_NOSUID)
|
|
|
|
LX_VALUE(MNT_NODEV)
|
|
|
|
LX_VALUE(MNT_NOEXEC)
|
|
|
|
LX_VALUE(MNT_NOATIME)
|
|
|
|
LX_VALUE(MNT_NODIRATIME)
|
|
|
|
LX_VALUE(MNT_RELATIME)
|
2017-07-12 21:34:13 +00:00
|
|
|
|
2019-05-14 22:45:59 +00:00
|
|
|
/* linux/threads.h */
|
|
|
|
LX_VALUE(NR_CPUS)
|
|
|
|
|
2017-07-12 21:34:13 +00:00
|
|
|
/* linux/of_fdt.h> */
|
|
|
|
LX_VALUE(OF_DT_HEADER)
|
|
|
|
|
|
|
|
/* Kernel Configs */
|
2019-05-14 22:45:59 +00:00
|
|
|
LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS)
|
|
|
|
LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
|
|
|
|
LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
|
|
|
|
LX_CONFIG(CONFIG_NR_CPUS)
|
2017-07-12 21:34:13 +00:00
|
|
|
LX_CONFIG(CONFIG_OF)
|
2019-05-14 22:45:59 +00:00
|
|
|
LX_CONFIG(CONFIG_TICK_ONESHOT)
|
2024-04-22 18:11:14 +00:00
|
|
|
/*
|
|
|
|
* CONFIG_KVM can be "m" but it affects common code too. Use CONFIG_KVM_COMMON
|
|
|
|
* as a proxy for IS_ENABLED(CONFIG_KVM).
|
|
|
|
*/
|
|
|
|
LX_CONFIG_KVM = IS_BUILTIN(CONFIG_KVM_COMMON)
|
|
|
|
|
scripts/gdb/aarch64: add aarch64 page operation helper commands and configs
JIRA: https://issues.redhat.com/browse/RHEL-40604
Conflicts:
scripts/gdb/linux/constants.py.in
Out of order backport of commit 8ac647d96aac "x86: replace
CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM)"
scripts/gdb/vmlinux-gdb.py
No backports for vfs, radixtree, and interrupts helpers
commit eb985b5dbf9791136700c555fbf964b6c07481ce
Author: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Date: Tue, 8 Aug 2023 16:30:14 +0800
1. Move page table debugging from mm.py to pgtable.py.
2. Add aarch64 kernel config and memory constants value.
3. Add below aarch64 page operation helper commands.
page_to_pfn, page_to_phys, pfn_to_page, page_address,
virt_to_phys, sym_to_pfn, pfn_to_kaddr, virt_to_page.
4. Only support CONFIG_SPARSEMEM_VMEMMAP=y now.
Link: https://lkml.kernel.org/r/20230808083020.22254-5-Kuan-Ying.Lee@mediatek.com
Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Qun-Wei Lin <qun-wei.lin@mediatek.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
2024-10-03 17:23:43 +00:00
|
|
|
LX_CONFIG(CONFIG_GENERIC_IRQ_SHOW_LEVEL)
|
|
|
|
LX_CONFIG(CONFIG_X86_LOCAL_APIC)
|
|
|
|
LX_CONFIG(CONFIG_SMP)
|
|
|
|
LX_CONFIG(CONFIG_X86_THERMAL_VECTOR)
|
|
|
|
LX_CONFIG(CONFIG_X86_MCE_THRESHOLD)
|
|
|
|
LX_CONFIG(CONFIG_X86_MCE_AMD)
|
|
|
|
LX_CONFIG(CONFIG_X86_MCE)
|
|
|
|
LX_CONFIG(CONFIG_X86_IO_APIC)
|
|
|
|
LX_CONFIG(CONFIG_HAVE_KVM)
|
|
|
|
LX_CONFIG(CONFIG_NUMA)
|
|
|
|
LX_CONFIG(CONFIG_ARM64)
|
|
|
|
LX_CONFIG(CONFIG_ARM64_4K_PAGES)
|
|
|
|
LX_CONFIG(CONFIG_ARM64_16K_PAGES)
|
|
|
|
LX_CONFIG(CONFIG_ARM64_64K_PAGES)
|
|
|
|
if IS_BUILTIN(CONFIG_ARM64):
|
|
|
|
LX_VALUE(CONFIG_ARM64_PA_BITS)
|
|
|
|
LX_VALUE(CONFIG_ARM64_VA_BITS)
|
|
|
|
LX_VALUE(CONFIG_ARM64_PAGE_SHIFT)
|
|
|
|
LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER)
|
|
|
|
LX_CONFIG(CONFIG_SPARSEMEM)
|
|
|
|
LX_CONFIG(CONFIG_SPARSEMEM_EXTREME)
|
|
|
|
LX_CONFIG(CONFIG_SPARSEMEM_VMEMMAP)
|
|
|
|
LX_CONFIG(CONFIG_KASAN)
|
|
|
|
LX_CONFIG(CONFIG_KASAN_GENERIC)
|
|
|
|
LX_CONFIG(CONFIG_KASAN_SW_TAGS)
|
|
|
|
LX_CONFIG(CONFIG_KASAN_HW_TAGS)
|
|
|
|
if IS_BUILTIN(CONFIG_KASAN_GENERIC) or IS_BUILTIN(CONFIG_KASAN_SW_TAGS):
|
|
|
|
LX_VALUE(CONFIG_KASAN_SHADOW_OFFSET)
|
|
|
|
LX_CONFIG(CONFIG_VMAP_STACK)
|
|
|
|
if IS_BUILTIN(CONFIG_NUMA):
|
|
|
|
LX_VALUE(CONFIG_NODES_SHIFT)
|
|
|
|
LX_CONFIG(CONFIG_DEBUG_VIRTUAL)
|