kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
/*
|
|
|
|
* Kernel Debugger Architecture Independent Stack Traceback
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1999-2004 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
* Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/kernel.h>
|
2017-02-08 20:51:30 +03:00
|
|
|
#include <linux/sched/signal.h>
|
2017-02-08 20:51:35 +03:00
|
|
|
#include <linux/sched/debug.h>
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
#include <linux/kdb.h>
|
|
|
|
#include <linux/nmi.h>
|
|
|
|
#include "kdb_private.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void kdb_show_stack(struct task_struct *p, void *addr)
|
|
|
|
{
|
2010-05-21 06:04:27 +04:00
|
|
|
kdb_trap_printk++;
|
2019-09-25 23:02:20 +03:00
|
|
|
|
2020-06-09 07:32:19 +03:00
|
|
|
if (!addr && kdb_task_has_cpu(p)) {
|
|
|
|
int old_lvl = console_loglevel;
|
|
|
|
|
|
|
|
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
|
2019-09-25 23:02:20 +03:00
|
|
|
kdb_dump_stack_on_cpu(kdb_process_cpu(p));
|
2020-06-09 07:32:19 +03:00
|
|
|
console_loglevel = old_lvl;
|
|
|
|
} else {
|
2020-06-09 07:32:29 +03:00
|
|
|
show_stack(p, addr, KERN_EMERG);
|
2020-06-09 07:32:19 +03:00
|
|
|
}
|
2019-09-25 23:02:20 +03:00
|
|
|
|
2010-05-21 06:04:27 +04:00
|
|
|
kdb_trap_printk--;
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kdb_bt
|
|
|
|
*
|
|
|
|
* This function implements the 'bt' command. Print a stack
|
|
|
|
* traceback.
|
|
|
|
*
|
|
|
|
* bt [<address-expression>] (addr-exp is for alternate stacks)
|
|
|
|
* btp <pid> Kernel stack for <pid>
|
|
|
|
* btt <address-expression> Kernel stack for task structure at
|
|
|
|
* <address-expression>
|
2021-11-02 20:31:58 +03:00
|
|
|
* bta [state_chars>|A] All useful processes, optionally
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
* filtered by state
|
|
|
|
* btc [<cpu>] The current process on one cpu,
|
|
|
|
* default is all cpus
|
|
|
|
*
|
|
|
|
* bt <address-expression> refers to a address on the stack, that location
|
|
|
|
* is assumed to contain a return address.
|
|
|
|
*
|
|
|
|
* btt <address-expression> refers to the address of a struct task.
|
|
|
|
*
|
|
|
|
* Inputs:
|
|
|
|
* argc argument count
|
|
|
|
* argv argument vector
|
|
|
|
* Outputs:
|
|
|
|
* None.
|
|
|
|
* Returns:
|
|
|
|
* zero for success, a kdb diagnostic if error
|
|
|
|
* Locking:
|
|
|
|
* none.
|
|
|
|
* Remarks:
|
|
|
|
* Backtrack works best when the code uses frame pointers. But even
|
|
|
|
* without frame pointers we should get a reasonable trace.
|
|
|
|
*
|
|
|
|
* mds comes in handy when examining the stack to do a manual traceback or
|
|
|
|
* to get a starting point for bt <address-expression>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
2021-11-02 20:31:58 +03:00
|
|
|
kdb_bt1(struct task_struct *p, const char *mask, bool btaprompt)
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
{
|
2019-10-25 10:33:26 +03:00
|
|
|
char ch;
|
|
|
|
|
|
|
|
if (kdb_getarea(ch, (unsigned long)p) ||
|
|
|
|
kdb_getarea(ch, (unsigned long)(p+1)-1))
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
return KDB_BADADDR;
|
|
|
|
if (!kdb_task_state(p, mask))
|
|
|
|
return 0;
|
|
|
|
kdb_printf("Stack traceback for pid %d\n", p->pid);
|
|
|
|
kdb_ps1(p);
|
|
|
|
kdb_show_stack(p, NULL);
|
|
|
|
if (btaprompt) {
|
2019-10-25 10:33:26 +03:00
|
|
|
kdb_printf("Enter <q> to end, <cr> or <space> to continue:");
|
|
|
|
do {
|
|
|
|
ch = kdb_getchar();
|
|
|
|
} while (!strchr("\r\n q", ch));
|
|
|
|
kdb_printf("\n");
|
|
|
|
|
|
|
|
/* reset the pager */
|
|
|
|
kdb_nextline = 1;
|
|
|
|
|
|
|
|
if (ch == 'q')
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
touch_nmi_watchdog();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-09-25 23:02:19 +03:00
|
|
|
static void
|
|
|
|
kdb_bt_cpu(unsigned long cpu)
|
|
|
|
{
|
|
|
|
struct task_struct *kdb_tsk;
|
|
|
|
|
|
|
|
if (cpu >= num_possible_cpus() || !cpu_online(cpu)) {
|
|
|
|
kdb_printf("WARNING: no process for cpu %ld\n", cpu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a CPU failed to round up we could be here */
|
|
|
|
kdb_tsk = KDB_TSK(cpu);
|
|
|
|
if (!kdb_tsk) {
|
|
|
|
kdb_printf("WARNING: no task for cpu %ld\n", cpu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-02 20:31:58 +03:00
|
|
|
kdb_bt1(kdb_tsk, "A", false);
|
2019-09-25 23:02:19 +03:00
|
|
|
}
|
|
|
|
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
int
|
|
|
|
kdb_bt(int argc, const char **argv)
|
|
|
|
{
|
|
|
|
int diag;
|
|
|
|
int btaprompt = 1;
|
|
|
|
int nextarg;
|
|
|
|
unsigned long addr;
|
|
|
|
long offset;
|
|
|
|
|
2011-06-30 23:12:00 +04:00
|
|
|
/* Prompt after each proc in bta */
|
|
|
|
kdbgetintenv("BTAPROMPT", &btaprompt);
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
|
|
|
|
if (strcmp(argv[0], "bta") == 0) {
|
|
|
|
struct task_struct *g, *p;
|
|
|
|
unsigned long cpu;
|
2021-11-02 20:31:58 +03:00
|
|
|
const char *mask = argc ? argv[1] : kdbgetenv("PS");
|
|
|
|
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
if (argc == 0)
|
|
|
|
kdb_ps_suppressed();
|
|
|
|
/* Run the active tasks first */
|
|
|
|
for_each_online_cpu(cpu) {
|
|
|
|
p = kdb_curr_task(cpu);
|
2019-09-25 23:02:18 +03:00
|
|
|
if (kdb_bt1(p, mask, btaprompt))
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Now the inactive tasks */
|
2020-09-07 23:32:06 +03:00
|
|
|
for_each_process_thread(g, p) {
|
2012-08-27 06:43:12 +04:00
|
|
|
if (KDB_FLAG(CMD_INTERRUPT))
|
|
|
|
return 0;
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
if (task_curr(p))
|
|
|
|
continue;
|
2019-09-25 23:02:18 +03:00
|
|
|
if (kdb_bt1(p, mask, btaprompt))
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
return 0;
|
2020-09-07 23:32:06 +03:00
|
|
|
}
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
} else if (strcmp(argv[0], "btp") == 0) {
|
|
|
|
struct task_struct *p;
|
|
|
|
unsigned long pid;
|
|
|
|
if (argc != 1)
|
|
|
|
return KDB_ARGCOUNT;
|
|
|
|
diag = kdbgetularg((char *)argv[1], &pid);
|
|
|
|
if (diag)
|
|
|
|
return diag;
|
|
|
|
p = find_task_by_pid_ns(pid, &init_pid_ns);
|
2019-11-09 22:16:43 +03:00
|
|
|
if (p)
|
2021-11-02 20:31:58 +03:00
|
|
|
return kdb_bt1(p, "A", false);
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
kdb_printf("No process with pid == %ld found\n", pid);
|
|
|
|
return 0;
|
|
|
|
} else if (strcmp(argv[0], "btt") == 0) {
|
|
|
|
if (argc != 1)
|
|
|
|
return KDB_ARGCOUNT;
|
|
|
|
diag = kdbgetularg((char *)argv[1], &addr);
|
|
|
|
if (diag)
|
|
|
|
return diag;
|
2021-11-02 20:31:58 +03:00
|
|
|
return kdb_bt1((struct task_struct *)addr, "A", false);
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
} else if (strcmp(argv[0], "btc") == 0) {
|
|
|
|
unsigned long cpu = ~0;
|
|
|
|
if (argc > 1)
|
|
|
|
return KDB_ARGCOUNT;
|
|
|
|
if (argc == 1) {
|
|
|
|
diag = kdbgetularg((char *)argv[1], &cpu);
|
|
|
|
if (diag)
|
|
|
|
return diag;
|
|
|
|
}
|
|
|
|
if (cpu != ~0) {
|
2019-09-25 23:02:19 +03:00
|
|
|
kdb_bt_cpu(cpu);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Recursive use of kdb_parse, do not use argv after
|
|
|
|
* this point.
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
kdb_printf("btc: cpu status: ");
|
|
|
|
kdb_parse("cpu\n");
|
|
|
|
for_each_online_cpu(cpu) {
|
|
|
|
kdb_bt_cpu(cpu);
|
|
|
|
touch_nmi_watchdog();
|
2018-12-05 06:38:28 +03:00
|
|
|
}
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
if (argc) {
|
|
|
|
nextarg = 1;
|
|
|
|
diag = kdbgetaddrarg(argc, argv, &nextarg, &addr,
|
|
|
|
&offset, NULL);
|
|
|
|
if (diag)
|
|
|
|
return diag;
|
|
|
|
kdb_show_stack(kdb_current_task, (void *)addr);
|
|
|
|
return 0;
|
|
|
|
} else {
|
2021-11-02 20:31:58 +03:00
|
|
|
return kdb_bt1(kdb_current_task, "A", false);
|
kdb: core for kgdb back end (1 of 2)
This patch contains only the kdb core. Because the change set was
large, it was split. The next patch in the series includes the
instrumentation into the core kernel which are mainly helper functions
for kdb.
This work is directly derived from kdb v4.4 found at:
ftp://oss.sgi.com/projects/kdb/download/v4.4/
The kdb internals have been re-organized to make them mostly platform
independent and to connect everything to the debug core which is used by
gdbstub (which has long been known as kgdb).
The original version of kdb was 58,000 lines worth of changes to
support x86. From that implementation only the kdb shell, and basic
commands for memory access, runcontrol, lsmod, and dmesg where carried
forward.
This is a generic implementation which aims to cover all the current
architectures using the kgdb core: ppc, arm, x86, mips, sparc, sh and
blackfin. More archictectures can be added by implementing the
architecture specific kgdb functions.
[mort@sgi.com: Compile fix with hugepages enabled]
[mort@sgi.com: Clean breakpoint code renaming kdba_ -> kdb_]
[mort@sgi.com: fix new line after printing registers]
[mort@sgi.com: Remove the concept of global vs. local breakpoints]
[mort@sgi.com: Rework kdb_si_swapinfo to use more generic name]
[mort@sgi.com: fix the information dump macros, remove 'arch' from the names]
[sfr@canb.auug.org.au: include fixup to include linux/slab.h]
CC: linux-arch@vger.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Martin Hicks <mort@sgi.com>
2010-05-21 06:04:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
return 0;
|
|
|
|
}
|