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 Console I/O handler
|
|
|
|
*
|
|
|
|
* 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-2006 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
* Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kdev_t.h>
|
|
|
|
#include <linux/console.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/nmi.h>
|
|
|
|
#include <linux/delay.h>
|
2010-05-21 06:04:24 +04:00
|
|
|
#include <linux/kgdb.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/kallsyms.h>
|
|
|
|
#include "kdb_private.h"
|
|
|
|
|
|
|
|
#define CMD_BUFLEN 256
|
|
|
|
char kdb_prompt_str[CMD_BUFLEN];
|
|
|
|
|
2010-05-21 06:04:27 +04:00
|
|
|
int kdb_trap_printk;
|
kdb: call vkdb_printf() from vprintk_default() only when wanted
kdb_trap_printk allows to pass normal printk() messages to kdb via
vkdb_printk(). For example, it is used to get backtrace using the
classic show_stack(), see kdb_show_stack().
vkdb_printf() tries to avoid a potential infinite loop by disabling the
trap. But this approach is racy, for example:
CPU1 CPU2
vkdb_printf()
// assume that kdb_trap_printk == 0
saved_trap_printk = kdb_trap_printk;
kdb_trap_printk = 0;
kdb_show_stack()
kdb_trap_printk++;
Problem1: Now, a nested printk() on CPU0 calls vkdb_printf()
even when it should have been disabled. It will not
cause a deadlock but...
// using the outdated saved value: 0
kdb_trap_printk = saved_trap_printk;
kdb_trap_printk--;
Problem2: Now, kdb_trap_printk == -1 and will stay like this.
It means that all messages will get passed to kdb from
now on.
This patch removes the racy saved_trap_printk handling. Instead, the
recursion is prevented by a check for the locked CPU.
The solution is still kind of racy. A non-related printk(), from
another process, might get trapped by vkdb_printf(). And the wanted
printk() might not get trapped because kdb_printf_cpu is assigned. But
this problem existed even with the original code.
A proper solution would be to get_cpu() before setting kdb_trap_printk
and trap messages only from this CPU. I am not sure if it is worth the
effort, though.
In fact, the race is very theoretical. When kdb is running any of the
commands that use kdb_trap_printk there is a single active CPU and the
other CPUs should be in a holding pen inside kgdb_cpu_enter().
The only time this is violated is when there is a timeout waiting for
the other CPUs to report to the holding pen.
Finally, note that the situation is a bit schizophrenic. vkdb_printf()
explicitly allows recursion but only from KDB code that calls
kdb_printf() directly. On the other hand, the generic printk()
recursion is not allowed because it might cause an infinite loop. This
is why we could not hide the decision inside vkdb_printf() easily.
Link: http://lkml.kernel.org/r/1480412276-16690-4-git-send-email-pmladek@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-15 02:05:58 +03:00
|
|
|
int kdb_printf_cpu = -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
|
|
|
|
2011-05-24 19:43:06 +04:00
|
|
|
static int kgdb_transition_check(char *buffer)
|
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
|
|
|
{
|
2011-05-24 19:43:06 +04:00
|
|
|
if (buffer[0] != '+' && buffer[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
|
|
|
KDB_STATE_SET(KGDB_TRANS);
|
|
|
|
kdb_printf("%s", buffer);
|
2011-05-24 19:43:06 +04:00
|
|
|
} else {
|
|
|
|
int slen = strlen(buffer);
|
|
|
|
if (slen > 3 && buffer[slen - 3] == '#') {
|
|
|
|
kdb_gdb_state_pass(buffer);
|
|
|
|
strcpy(buffer, "kgdb");
|
|
|
|
KDB_STATE_SET(DOING_KGDB);
|
|
|
|
return 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
|
|
|
}
|
2011-05-24 19:43:06 +04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-10-25 10:33:24 +03:00
|
|
|
/**
|
|
|
|
* kdb_handle_escape() - validity check on an accumulated escape sequence.
|
|
|
|
* @buf: Accumulated escape characters to be examined. Note that buf
|
|
|
|
* is not a string, it is an array of characters and need not be
|
|
|
|
* nil terminated.
|
|
|
|
* @sz: Number of accumulated escape characters.
|
|
|
|
*
|
|
|
|
* Return: -1 if the escape sequence is unwanted, 0 if it is incomplete,
|
|
|
|
* otherwise it returns a mapped key value to pass to the upper layers.
|
|
|
|
*/
|
|
|
|
static int kdb_handle_escape(char *buf, size_t sz)
|
|
|
|
{
|
|
|
|
char *lastkey = buf + sz - 1;
|
|
|
|
|
|
|
|
switch (sz) {
|
|
|
|
case 1:
|
|
|
|
if (*lastkey == '\e')
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* \e<something> */
|
|
|
|
if (*lastkey == '[')
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
switch (*lastkey) {
|
|
|
|
case 'A': /* \e[A, up arrow */
|
|
|
|
return 16;
|
|
|
|
case 'B': /* \e[B, down arrow */
|
|
|
|
return 14;
|
|
|
|
case 'C': /* \e[C, right arrow */
|
|
|
|
return 6;
|
|
|
|
case 'D': /* \e[D, left arrow */
|
|
|
|
return 2;
|
|
|
|
case '1': /* \e[<1,3,4>], may be home, del, end */
|
|
|
|
case '3':
|
|
|
|
case '4':
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
if (*lastkey == '~') {
|
|
|
|
switch (buf[2]) {
|
|
|
|
case '1': /* \e[1~, home */
|
|
|
|
return 1;
|
|
|
|
case '3': /* \e[3~, del */
|
|
|
|
return 4;
|
|
|
|
case '4': /* \e[4~, end */
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:33:26 +03:00
|
|
|
/**
|
|
|
|
* kdb_getchar() - Read a single character from a kdb console (or consoles).
|
|
|
|
*
|
|
|
|
* Other than polling the various consoles that are currently enabled,
|
|
|
|
* most of the work done in this function is dealing with escape sequences.
|
|
|
|
*
|
|
|
|
* An escape key could be the start of a vt100 control sequence such as \e[D
|
|
|
|
* (left arrow) or it could be a character in its own right. The standard
|
|
|
|
* method for detecting the difference is to wait for 2 seconds to see if there
|
|
|
|
* are any other characters. kdb is complicated by the lack of a timer service
|
|
|
|
* (interrupts are off), by multiple input sources. Escape sequence processing
|
|
|
|
* has to be done as states in the polling loop.
|
|
|
|
*
|
|
|
|
* Return: The key pressed or a control code derived from an escape sequence.
|
|
|
|
*/
|
|
|
|
char kdb_getchar(void)
|
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
|
|
|
{
|
|
|
|
#define ESCAPE_UDELAY 1000
|
|
|
|
#define ESCAPE_DELAY (2*1000000/ESCAPE_UDELAY) /* 2 seconds worth of udelays */
|
2019-10-25 10:33:27 +03:00
|
|
|
char buf[4]; /* longest vt100 escape sequence is 4 bytes */
|
|
|
|
char *pbuf = buf;
|
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 escape_delay = 0;
|
2019-10-25 10:33:27 +03:00
|
|
|
get_char_func *f, *f_prev = NULL;
|
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 key;
|
|
|
|
|
|
|
|
for (f = &kdb_poll_funcs[0]; ; ++f) {
|
|
|
|
if (*f == NULL) {
|
|
|
|
/* Reset NMI watchdog once per poll loop */
|
|
|
|
touch_nmi_watchdog();
|
|
|
|
f = &kdb_poll_funcs[0];
|
|
|
|
}
|
2019-10-25 10:33:25 +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
|
|
|
key = (*f)();
|
|
|
|
if (key == -1) {
|
|
|
|
if (escape_delay) {
|
|
|
|
udelay(ESCAPE_UDELAY);
|
2019-10-25 10:33:25 +03:00
|
|
|
if (--escape_delay == 0)
|
|
|
|
return '\e';
|
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
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2019-10-25 10:33:25 +03:00
|
|
|
|
2019-10-25 10:33:27 +03:00
|
|
|
/*
|
|
|
|
* When the first character is received (or we get a change
|
|
|
|
* input source) we set ourselves up to handle an escape
|
|
|
|
* sequences (just in case).
|
|
|
|
*/
|
|
|
|
if (f_prev != f) {
|
|
|
|
f_prev = f;
|
|
|
|
pbuf = buf;
|
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
|
|
|
escape_delay = ESCAPE_DELAY;
|
|
|
|
}
|
2019-10-25 10:33:25 +03:00
|
|
|
|
2019-10-25 10:33:27 +03:00
|
|
|
*pbuf++ = key;
|
|
|
|
key = kdb_handle_escape(buf, pbuf - buf);
|
2019-10-25 10:33:28 +03:00
|
|
|
if (key < 0) /* no escape sequence; return best character */
|
|
|
|
return buf[pbuf - buf == 2 ? 1 : 0];
|
2019-10-25 10:33:27 +03:00
|
|
|
if (key > 0)
|
|
|
|
return key;
|
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:27 +03:00
|
|
|
|
|
|
|
unreachable();
|
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_read
|
|
|
|
*
|
|
|
|
* This function reads a string of characters, terminated by
|
|
|
|
* a newline, or by reaching the end of the supplied buffer,
|
|
|
|
* from the current kernel debugger console device.
|
|
|
|
* Parameters:
|
|
|
|
* buffer - Address of character buffer to receive input characters.
|
|
|
|
* bufsize - size, in bytes, of the character buffer
|
|
|
|
* Returns:
|
|
|
|
* Returns a pointer to the buffer containing the received
|
|
|
|
* character string. This string will be terminated by a
|
|
|
|
* newline character.
|
|
|
|
* Locking:
|
|
|
|
* No locks are required to be held upon entry to this
|
|
|
|
* function. It is not reentrant - it relies on the fact
|
|
|
|
* that while kdb is running on only one "master debug" cpu.
|
|
|
|
* Remarks:
|
2019-10-25 10:33:26 +03:00
|
|
|
* The buffer size must be >= 2.
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
static char *kdb_read(char *buffer, size_t bufsize)
|
|
|
|
{
|
|
|
|
char *cp = buffer;
|
|
|
|
char *bufend = buffer+bufsize-2; /* Reserve space for newline
|
|
|
|
* and null byte */
|
|
|
|
char *lastchar;
|
|
|
|
char *p_tmp;
|
|
|
|
char tmp;
|
|
|
|
static char tmpbuffer[CMD_BUFLEN];
|
|
|
|
int len = strlen(buffer);
|
|
|
|
int len_tmp;
|
|
|
|
int tab = 0;
|
|
|
|
int count;
|
|
|
|
int i;
|
|
|
|
int diag, dtab_count;
|
2018-09-20 15:59:14 +03:00
|
|
|
int key, buf_size, ret;
|
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
|
|
|
|
|
|
|
|
|
|
|
diag = kdbgetintenv("DTABCOUNT", &dtab_count);
|
|
|
|
if (diag)
|
|
|
|
dtab_count = 30;
|
|
|
|
|
|
|
|
if (len > 0) {
|
|
|
|
cp += len;
|
|
|
|
if (*(buffer+len-1) == '\n')
|
|
|
|
cp--;
|
|
|
|
}
|
|
|
|
|
|
|
|
lastchar = cp;
|
|
|
|
*cp = '\0';
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
poll_again:
|
2019-10-25 10:33:26 +03:00
|
|
|
key = kdb_getchar();
|
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 (key != 9)
|
|
|
|
tab = 0;
|
|
|
|
switch (key) {
|
|
|
|
case 8: /* backspace */
|
|
|
|
if (cp > buffer) {
|
|
|
|
if (cp < lastchar) {
|
|
|
|
memcpy(tmpbuffer, cp, lastchar - cp);
|
|
|
|
memcpy(cp-1, tmpbuffer, lastchar - cp);
|
|
|
|
}
|
|
|
|
*(--lastchar) = '\0';
|
|
|
|
--cp;
|
|
|
|
kdb_printf("\b%s \r", cp);
|
|
|
|
tmp = *cp;
|
|
|
|
*cp = '\0';
|
|
|
|
kdb_printf(kdb_prompt_str);
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
*cp = tmp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 13: /* enter */
|
|
|
|
*lastchar++ = '\n';
|
|
|
|
*lastchar++ = '\0';
|
2011-05-24 19:43:06 +04:00
|
|
|
if (!KDB_STATE(KGDB_TRANS)) {
|
|
|
|
KDB_STATE_SET(KGDB_TRANS);
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
}
|
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("\n");
|
|
|
|
return buffer;
|
|
|
|
case 4: /* Del */
|
|
|
|
if (cp < lastchar) {
|
|
|
|
memcpy(tmpbuffer, cp+1, lastchar - cp - 1);
|
|
|
|
memcpy(cp, tmpbuffer, lastchar - cp - 1);
|
|
|
|
*(--lastchar) = '\0';
|
|
|
|
kdb_printf("%s \r", cp);
|
|
|
|
tmp = *cp;
|
|
|
|
*cp = '\0';
|
|
|
|
kdb_printf(kdb_prompt_str);
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
*cp = tmp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1: /* Home */
|
|
|
|
if (cp > buffer) {
|
|
|
|
kdb_printf("\r");
|
|
|
|
kdb_printf(kdb_prompt_str);
|
|
|
|
cp = buffer;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5: /* End */
|
|
|
|
if (cp < lastchar) {
|
|
|
|
kdb_printf("%s", cp);
|
|
|
|
cp = lastchar;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2: /* Left */
|
|
|
|
if (cp > buffer) {
|
|
|
|
kdb_printf("\b");
|
|
|
|
--cp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 14: /* Down */
|
|
|
|
memset(tmpbuffer, ' ',
|
|
|
|
strlen(kdb_prompt_str) + (lastchar-buffer));
|
|
|
|
*(tmpbuffer+strlen(kdb_prompt_str) +
|
|
|
|
(lastchar-buffer)) = '\0';
|
|
|
|
kdb_printf("\r%s\r", tmpbuffer);
|
|
|
|
*lastchar = (char)key;
|
|
|
|
*(lastchar+1) = '\0';
|
|
|
|
return lastchar;
|
|
|
|
case 6: /* Right */
|
|
|
|
if (cp < lastchar) {
|
|
|
|
kdb_printf("%c", *cp);
|
|
|
|
++cp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 16: /* Up */
|
|
|
|
memset(tmpbuffer, ' ',
|
|
|
|
strlen(kdb_prompt_str) + (lastchar-buffer));
|
|
|
|
*(tmpbuffer+strlen(kdb_prompt_str) +
|
|
|
|
(lastchar-buffer)) = '\0';
|
|
|
|
kdb_printf("\r%s\r", tmpbuffer);
|
|
|
|
*lastchar = (char)key;
|
|
|
|
*(lastchar+1) = '\0';
|
|
|
|
return lastchar;
|
|
|
|
case 9: /* Tab */
|
|
|
|
if (tab < 2)
|
|
|
|
++tab;
|
|
|
|
p_tmp = buffer;
|
|
|
|
while (*p_tmp == ' ')
|
|
|
|
p_tmp++;
|
|
|
|
if (p_tmp > cp)
|
|
|
|
break;
|
|
|
|
memcpy(tmpbuffer, p_tmp, cp-p_tmp);
|
|
|
|
*(tmpbuffer + (cp-p_tmp)) = '\0';
|
|
|
|
p_tmp = strrchr(tmpbuffer, ' ');
|
|
|
|
if (p_tmp)
|
|
|
|
++p_tmp;
|
|
|
|
else
|
|
|
|
p_tmp = tmpbuffer;
|
|
|
|
len = strlen(p_tmp);
|
2018-09-20 15:59:14 +03:00
|
|
|
buf_size = sizeof(tmpbuffer) - (p_tmp - tmpbuffer);
|
|
|
|
count = kallsyms_symbol_complete(p_tmp, buf_size);
|
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 (tab == 2 && count > 0) {
|
|
|
|
kdb_printf("\n%d symbols are found.", count);
|
|
|
|
if (count > dtab_count) {
|
|
|
|
count = dtab_count;
|
|
|
|
kdb_printf(" But only first %d symbols will"
|
|
|
|
" be printed.\nYou can change the"
|
|
|
|
" environment variable DTABCOUNT.",
|
|
|
|
count);
|
|
|
|
}
|
|
|
|
kdb_printf("\n");
|
|
|
|
for (i = 0; i < count; i++) {
|
2018-09-20 15:59:14 +03:00
|
|
|
ret = kallsyms_symbol_next(p_tmp, i, buf_size);
|
|
|
|
if (WARN_ON(!ret))
|
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
|
|
|
break;
|
2018-09-20 15:59:14 +03:00
|
|
|
if (ret != -E2BIG)
|
|
|
|
kdb_printf("%s ", p_tmp);
|
|
|
|
else
|
|
|
|
kdb_printf("%s... ", p_tmp);
|
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
|
|
|
*(p_tmp + len) = '\0';
|
|
|
|
}
|
|
|
|
if (i >= dtab_count)
|
|
|
|
kdb_printf("...");
|
|
|
|
kdb_printf("\n");
|
|
|
|
kdb_printf(kdb_prompt_str);
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
} else if (tab != 2 && count > 0) {
|
|
|
|
len_tmp = strlen(p_tmp);
|
|
|
|
strncpy(p_tmp+len_tmp, cp, lastchar-cp+1);
|
|
|
|
len_tmp = strlen(p_tmp);
|
|
|
|
strncpy(cp, p_tmp+len, len_tmp-len + 1);
|
|
|
|
len = len_tmp - len;
|
|
|
|
kdb_printf("%s", cp);
|
|
|
|
cp += len;
|
|
|
|
lastchar += len;
|
|
|
|
}
|
|
|
|
kdb_nextline = 1; /* reset output line number */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (key >= 32 && lastchar < bufend) {
|
|
|
|
if (cp < lastchar) {
|
|
|
|
memcpy(tmpbuffer, cp, lastchar - cp);
|
|
|
|
memcpy(cp+1, tmpbuffer, lastchar - cp);
|
|
|
|
*++lastchar = '\0';
|
|
|
|
*cp = key;
|
|
|
|
kdb_printf("%s\r", cp);
|
|
|
|
++cp;
|
|
|
|
tmp = *cp;
|
|
|
|
*cp = '\0';
|
|
|
|
kdb_printf(kdb_prompt_str);
|
|
|
|
kdb_printf("%s", buffer);
|
|
|
|
*cp = tmp;
|
|
|
|
} else {
|
|
|
|
*++lastchar = '\0';
|
|
|
|
*cp++ = key;
|
|
|
|
/* The kgdb transition check will hide
|
|
|
|
* printed characters if we think that
|
|
|
|
* kgdb is connecting, until the check
|
|
|
|
* fails */
|
2011-05-24 19:43:06 +04:00
|
|
|
if (!KDB_STATE(KGDB_TRANS)) {
|
|
|
|
if (kgdb_transition_check(buffer))
|
|
|
|
return buffer;
|
|
|
|
} else {
|
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("%c", key);
|
2011-05-24 19:43:06 +04: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
|
|
|
}
|
|
|
|
/* Special escape to kgdb */
|
|
|
|
if (lastchar - buffer >= 5 &&
|
|
|
|
strcmp(lastchar - 5, "$?#3f") == 0) {
|
2011-05-23 22:17:41 +04:00
|
|
|
kdb_gdb_state_pass(lastchar - 5);
|
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
|
|
|
strcpy(buffer, "kgdb");
|
|
|
|
KDB_STATE_SET(DOING_KGDB);
|
|
|
|
return buffer;
|
|
|
|
}
|
2011-05-23 22:17:41 +04:00
|
|
|
if (lastchar - buffer >= 11 &&
|
|
|
|
strcmp(lastchar - 11, "$qSupported") == 0) {
|
|
|
|
kdb_gdb_state_pass(lastchar - 11);
|
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
|
|
|
strcpy(buffer, "kgdb");
|
2011-05-23 22:22:54 +04:00
|
|
|
KDB_STATE_SET(DOING_KGDB);
|
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 buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
goto poll_again;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kdb_getstr
|
|
|
|
*
|
|
|
|
* Print the prompt string and read a command from the
|
|
|
|
* input device.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* buffer Address of buffer to receive command
|
|
|
|
* bufsize Size of buffer in bytes
|
|
|
|
* prompt Pointer to string to use as prompt string
|
|
|
|
* Returns:
|
|
|
|
* Pointer to command buffer.
|
|
|
|
* Locking:
|
|
|
|
* None.
|
|
|
|
* Remarks:
|
|
|
|
* For SMP kernels, the processor number will be
|
|
|
|
* substituted for %d, %x or %o in the prompt.
|
|
|
|
*/
|
|
|
|
|
2014-09-11 13:41:12 +04:00
|
|
|
char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt)
|
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 (prompt && kdb_prompt_str != prompt)
|
2019-05-13 11:57:20 +03:00
|
|
|
strscpy(kdb_prompt_str, prompt, CMD_BUFLEN);
|
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(kdb_prompt_str);
|
|
|
|
kdb_nextline = 1; /* Prompt and input resets line number */
|
|
|
|
return kdb_read(buffer, bufsize);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kdb_input_flush
|
|
|
|
*
|
|
|
|
* Get rid of any buffered console input.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* none
|
|
|
|
* Returns:
|
|
|
|
* nothing
|
|
|
|
* Locking:
|
|
|
|
* none
|
|
|
|
* Remarks:
|
|
|
|
* Call this function whenever you want to flush input. If there is any
|
|
|
|
* outstanding input, it ignores all characters until there has been no
|
|
|
|
* data for approximately 1ms.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void kdb_input_flush(void)
|
|
|
|
{
|
|
|
|
get_char_func *f;
|
|
|
|
int res;
|
|
|
|
int flush_delay = 1;
|
|
|
|
while (flush_delay) {
|
|
|
|
flush_delay--;
|
|
|
|
empty:
|
|
|
|
touch_nmi_watchdog();
|
|
|
|
for (f = &kdb_poll_funcs[0]; *f; ++f) {
|
|
|
|
res = (*f)();
|
|
|
|
if (res != -1) {
|
|
|
|
flush_delay = 1;
|
|
|
|
goto empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flush_delay)
|
|
|
|
mdelay(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kdb_printf
|
|
|
|
*
|
|
|
|
* Print a string to the output device(s).
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* printf-like format and optional args.
|
|
|
|
* Returns:
|
|
|
|
* 0
|
|
|
|
* Locking:
|
|
|
|
* None.
|
|
|
|
* Remarks:
|
|
|
|
* use 'kdbcons->write()' to avoid polluting 'log_buf' with
|
|
|
|
* kdb output.
|
|
|
|
*
|
|
|
|
* If the user is doing a cmd args | grep srch
|
|
|
|
* then kdb_grepping_flag is set.
|
|
|
|
* In that case we need to accumulate full lines (ending in \n) before
|
|
|
|
* searching for the pattern.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static char kdb_buffer[256]; /* A bit too big to go on stack */
|
|
|
|
static char *next_avail = kdb_buffer;
|
|
|
|
static int size_avail;
|
|
|
|
static int suspend_grep;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* search arg1 to see if it contains arg2
|
|
|
|
* (kdmain.c provides flags for ^pat and pat$)
|
|
|
|
*
|
|
|
|
* return 1 for found, 0 for not found
|
|
|
|
*/
|
|
|
|
static int kdb_search_string(char *searched, char *searchfor)
|
|
|
|
{
|
|
|
|
char firstchar, *cp;
|
|
|
|
int len1, len2;
|
|
|
|
|
|
|
|
/* not counting the newline at the end of "searched" */
|
|
|
|
len1 = strlen(searched)-1;
|
|
|
|
len2 = strlen(searchfor);
|
|
|
|
if (len1 < len2)
|
|
|
|
return 0;
|
|
|
|
if (kdb_grep_leading && kdb_grep_trailing && len1 != len2)
|
|
|
|
return 0;
|
|
|
|
if (kdb_grep_leading) {
|
|
|
|
if (!strncmp(searched, searchfor, len2))
|
|
|
|
return 1;
|
|
|
|
} else if (kdb_grep_trailing) {
|
|
|
|
if (!strncmp(searched+len1-len2, searchfor, len2))
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
firstchar = *searchfor;
|
|
|
|
cp = searched;
|
|
|
|
while ((cp = strchr(cp, firstchar))) {
|
|
|
|
if (!strncmp(cp, searchfor, len2))
|
|
|
|
return 1;
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-06-04 13:01:16 +03:00
|
|
|
static void kdb_msg_write(const char *msg, int msg_len)
|
|
|
|
{
|
|
|
|
struct console *c;
|
2020-06-30 11:29:23 +03:00
|
|
|
const char *cp;
|
|
|
|
int len;
|
2020-06-04 13:01:16 +03:00
|
|
|
|
|
|
|
if (msg_len == 0)
|
|
|
|
return;
|
|
|
|
|
2020-06-30 11:29:23 +03:00
|
|
|
cp = msg;
|
|
|
|
len = msg_len;
|
2020-06-04 13:01:16 +03:00
|
|
|
|
2020-06-30 11:29:23 +03:00
|
|
|
while (len--) {
|
|
|
|
dbg_io_ops->write_char(*cp);
|
|
|
|
cp++;
|
2020-06-04 13:01:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for_each_console(c) {
|
2020-06-04 13:01:17 +03:00
|
|
|
if (!(c->flags & CON_ENABLED))
|
|
|
|
continue;
|
2020-06-04 13:01:19 +03:00
|
|
|
if (c == dbg_io_ops->cons)
|
|
|
|
continue;
|
2020-06-04 13:01:18 +03:00
|
|
|
/*
|
|
|
|
* Set oops_in_progress to encourage the console drivers to
|
|
|
|
* disregard their internal spin locks: in the current calling
|
|
|
|
* context the risk of deadlock is a bigger problem than risks
|
|
|
|
* due to re-entering the console driver. We operate directly on
|
|
|
|
* oops_in_progress rather than using bust_spinlocks() because
|
|
|
|
* the calls bust_spinlocks() makes on exit are not appropriate
|
|
|
|
* for this calling context.
|
|
|
|
*/
|
|
|
|
++oops_in_progress;
|
2020-06-04 13:01:16 +03:00
|
|
|
c->write(c, msg, msg_len);
|
2020-06-04 13:01:18 +03:00
|
|
|
--oops_in_progress;
|
2020-06-04 13:01:16 +03:00
|
|
|
touch_nmi_watchdog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-07 21:37:57 +03:00
|
|
|
int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)
|
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 diag;
|
|
|
|
int linecount;
|
2012-08-27 07:37:03 +04:00
|
|
|
int colcount;
|
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 logging, saved_loglevel = 0;
|
|
|
|
int retlen = 0;
|
|
|
|
int fnd, len;
|
2016-12-15 02:05:55 +03:00
|
|
|
int this_cpu, old_cpu;
|
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
|
|
|
char *cp, *cp2, *cphold = NULL, replaced_byte = ' ';
|
|
|
|
char *moreprompt = "more> ";
|
treewide: Remove uninitialized_var() usage
Using uninitialized_var() is dangerous as it papers over real bugs[1]
(or can in the future), and suppresses unrelated compiler warnings
(e.g. "unused variable"). If the compiler thinks it is uninitialized,
either simply initialize the variable or make compiler changes.
In preparation for removing[2] the[3] macro[4], remove all remaining
needless uses with the following script:
git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
xargs perl -pi -e \
's/\buninitialized_var\(([^\)]+)\)/\1/g;
s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'
drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
pathological white-space.
No outstanding warnings were found building allmodconfig with GCC 9.3.0
for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
alpha, and m68k.
[1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
[2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
[3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
[4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/
Reviewed-by: Leon Romanovsky <leonro@mellanox.com> # drivers/infiniband and mlx4/mlx5
Acked-by: Jason Gunthorpe <jgg@mellanox.com> # IB
Acked-by: Kalle Valo <kvalo@codeaurora.org> # wireless drivers
Reviewed-by: Chao Yu <yuchao0@huawei.com> # erofs
Signed-off-by: Kees Cook <keescook@chromium.org>
2020-06-03 23:09:38 +03:00
|
|
|
unsigned long flags;
|
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
|
|
|
|
|
|
|
/* Serialize kdb_printf if multiple cpus try to write at once.
|
|
|
|
* But if any cpu goes recursive in kdb, just print the output,
|
|
|
|
* even if it is interleaved with any other text.
|
|
|
|
*/
|
kdb: call vkdb_printf() from vprintk_default() only when wanted
kdb_trap_printk allows to pass normal printk() messages to kdb via
vkdb_printk(). For example, it is used to get backtrace using the
classic show_stack(), see kdb_show_stack().
vkdb_printf() tries to avoid a potential infinite loop by disabling the
trap. But this approach is racy, for example:
CPU1 CPU2
vkdb_printf()
// assume that kdb_trap_printk == 0
saved_trap_printk = kdb_trap_printk;
kdb_trap_printk = 0;
kdb_show_stack()
kdb_trap_printk++;
Problem1: Now, a nested printk() on CPU0 calls vkdb_printf()
even when it should have been disabled. It will not
cause a deadlock but...
// using the outdated saved value: 0
kdb_trap_printk = saved_trap_printk;
kdb_trap_printk--;
Problem2: Now, kdb_trap_printk == -1 and will stay like this.
It means that all messages will get passed to kdb from
now on.
This patch removes the racy saved_trap_printk handling. Instead, the
recursion is prevented by a check for the locked CPU.
The solution is still kind of racy. A non-related printk(), from
another process, might get trapped by vkdb_printf(). And the wanted
printk() might not get trapped because kdb_printf_cpu is assigned. But
this problem existed even with the original code.
A proper solution would be to get_cpu() before setting kdb_trap_printk
and trap messages only from this CPU. I am not sure if it is worth the
effort, though.
In fact, the race is very theoretical. When kdb is running any of the
commands that use kdb_trap_printk there is a single active CPU and the
other CPUs should be in a holding pen inside kgdb_cpu_enter().
The only time this is violated is when there is a timeout waiting for
the other CPUs to report to the holding pen.
Finally, note that the situation is a bit schizophrenic. vkdb_printf()
explicitly allows recursion but only from KDB code that calls
kdb_printf() directly. On the other hand, the generic printk()
recursion is not allowed because it might cause an infinite loop. This
is why we could not hide the decision inside vkdb_printf() easily.
Link: http://lkml.kernel.org/r/1480412276-16690-4-git-send-email-pmladek@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-15 02:05:58 +03:00
|
|
|
local_irq_save(flags);
|
2016-12-15 02:05:55 +03:00
|
|
|
this_cpu = smp_processor_id();
|
|
|
|
for (;;) {
|
|
|
|
old_cpu = cmpxchg(&kdb_printf_cpu, -1, this_cpu);
|
|
|
|
if (old_cpu == -1 || old_cpu == this_cpu)
|
|
|
|
break;
|
|
|
|
|
|
|
|
cpu_relax();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
diag = kdbgetintenv("LINES", &linecount);
|
|
|
|
if (diag || linecount <= 1)
|
|
|
|
linecount = 24;
|
|
|
|
|
2012-08-27 07:37:03 +04:00
|
|
|
diag = kdbgetintenv("COLUMNS", &colcount);
|
|
|
|
if (diag || colcount <= 1)
|
|
|
|
colcount = 80;
|
|
|
|
|
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
|
|
|
diag = kdbgetintenv("LOGGING", &logging);
|
|
|
|
if (diag)
|
|
|
|
logging = 0;
|
|
|
|
|
|
|
|
if (!kdb_grepping_flag || suspend_grep) {
|
|
|
|
/* normally, every vsnprintf starts a new buffer */
|
|
|
|
next_avail = kdb_buffer;
|
|
|
|
size_avail = sizeof(kdb_buffer);
|
|
|
|
}
|
|
|
|
vsnprintf(next_avail, size_avail, fmt, ap);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If kdb_parse() found that the command was cmd xxx | grep yyy
|
|
|
|
* then kdb_grepping_flag is set, and kdb_grep_string contains yyy
|
|
|
|
*
|
|
|
|
* Accumulate the print data up to a newline before searching it.
|
|
|
|
* (vsnprintf does null-terminate the string that it generates)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* skip the search if prints are temporarily unconditional */
|
|
|
|
if (!suspend_grep && kdb_grepping_flag) {
|
|
|
|
cp = strchr(kdb_buffer, '\n');
|
|
|
|
if (!cp) {
|
|
|
|
/*
|
|
|
|
* Special cases that don't end with newlines
|
|
|
|
* but should be written without one:
|
|
|
|
* The "[nn]kdb> " prompt should
|
|
|
|
* appear at the front of the buffer.
|
|
|
|
*
|
|
|
|
* The "[nn]more " prompt should also be
|
|
|
|
* (MOREPROMPT -> moreprompt)
|
|
|
|
* written * but we print that ourselves,
|
|
|
|
* we set the suspend_grep flag to make
|
|
|
|
* it unconditional.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (next_avail == kdb_buffer) {
|
|
|
|
/*
|
|
|
|
* these should occur after a newline,
|
|
|
|
* so they will be at the front of the
|
|
|
|
* buffer
|
|
|
|
*/
|
|
|
|
cp2 = kdb_buffer;
|
|
|
|
len = strlen(kdb_prompt_str);
|
|
|
|
if (!strncmp(cp2, kdb_prompt_str, len)) {
|
|
|
|
/*
|
|
|
|
* We're about to start a new
|
|
|
|
* command, so we can go back
|
|
|
|
* to normal mode.
|
|
|
|
*/
|
|
|
|
kdb_grepping_flag = 0;
|
|
|
|
goto kdb_printit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* no newline; don't search/write the buffer
|
|
|
|
until one is there */
|
|
|
|
len = strlen(kdb_buffer);
|
|
|
|
next_avail = kdb_buffer + len;
|
|
|
|
size_avail = sizeof(kdb_buffer) - len;
|
|
|
|
goto kdb_print_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The newline is present; print through it or discard
|
|
|
|
* it, depending on the results of the search.
|
|
|
|
*/
|
|
|
|
cp++; /* to byte after the newline */
|
|
|
|
replaced_byte = *cp; /* remember what/where it was */
|
|
|
|
cphold = cp;
|
|
|
|
*cp = '\0'; /* end the string for our search */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We now have a newline at the end of the string
|
|
|
|
* Only continue with this output if it contains the
|
|
|
|
* search string.
|
|
|
|
*/
|
|
|
|
fnd = kdb_search_string(kdb_buffer, kdb_grep_string);
|
|
|
|
if (!fnd) {
|
|
|
|
/*
|
|
|
|
* At this point the complete line at the start
|
|
|
|
* of kdb_buffer can be discarded, as it does
|
|
|
|
* not contain what the user is looking for.
|
|
|
|
* Shift the buffer left.
|
|
|
|
*/
|
|
|
|
*cphold = replaced_byte;
|
|
|
|
strcpy(kdb_buffer, cphold);
|
|
|
|
len = strlen(kdb_buffer);
|
|
|
|
next_avail = kdb_buffer + len;
|
|
|
|
size_avail = sizeof(kdb_buffer) - len;
|
|
|
|
goto kdb_print_out;
|
|
|
|
}
|
2020-09-09 17:17:08 +03:00
|
|
|
if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) {
|
2014-09-11 13:37:10 +04:00
|
|
|
/*
|
|
|
|
* This was a interactive search (using '/' at more
|
2020-09-09 17:17:08 +03:00
|
|
|
* prompt) and it has completed. Replace the \0 with
|
|
|
|
* its original value to ensure multi-line strings
|
|
|
|
* are handled properly, and return to normal mode.
|
2014-09-11 13:37:10 +04:00
|
|
|
*/
|
2020-09-09 17:17:08 +03:00
|
|
|
*cphold = replaced_byte;
|
2014-09-11 13:37:10 +04:00
|
|
|
kdb_grepping_flag = 0;
|
2020-09-09 17:17:08 +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
|
|
|
/*
|
|
|
|
* at this point the string is a full line and
|
|
|
|
* should be printed, up to the null.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
kdb_printit:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write to all consoles.
|
|
|
|
*/
|
|
|
|
retlen = strlen(kdb_buffer);
|
2016-12-13 03:45:47 +03:00
|
|
|
cp = (char *) printk_skip_headers(kdb_buffer);
|
2020-06-04 13:01:16 +03:00
|
|
|
if (!dbg_kdb_mode && kgdb_connected)
|
2014-11-07 21:37:57 +03:00
|
|
|
gdbstub_msg_write(cp, retlen - (cp - kdb_buffer));
|
2020-06-04 13:01:16 +03:00
|
|
|
else
|
|
|
|
kdb_msg_write(cp, retlen - (cp - kdb_buffer));
|
|
|
|
|
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 (logging) {
|
|
|
|
saved_loglevel = console_loglevel;
|
2014-06-05 03:11:46 +04:00
|
|
|
console_loglevel = CONSOLE_LOGLEVEL_SILENT;
|
2014-11-07 21:37:57 +03:00
|
|
|
if (printk_get_level(kdb_buffer) || src == KDB_MSGSRC_PRINTK)
|
|
|
|
printk("%s", kdb_buffer);
|
|
|
|
else
|
|
|
|
pr_info("%s", kdb_buffer);
|
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
|
|
|
}
|
|
|
|
|
2012-08-27 07:37:03 +04:00
|
|
|
if (KDB_STATE(PAGER)) {
|
|
|
|
/*
|
|
|
|
* Check printed string to decide how to bump the
|
|
|
|
* kdb_nextline to control when the more prompt should
|
|
|
|
* show up.
|
|
|
|
*/
|
|
|
|
int got = 0;
|
|
|
|
len = retlen;
|
|
|
|
while (len--) {
|
|
|
|
if (kdb_buffer[len] == '\n') {
|
|
|
|
kdb_nextline++;
|
|
|
|
got = 0;
|
|
|
|
} else if (kdb_buffer[len] == '\r') {
|
|
|
|
got = 0;
|
|
|
|
} else {
|
|
|
|
got++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kdb_nextline += got / (colcount + 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
|
|
|
|
|
|
|
/* check for having reached the LINES number of printed lines */
|
2012-08-27 07:37:03 +04:00
|
|
|
if (kdb_nextline >= linecount) {
|
2019-10-25 10:33:26 +03:00
|
|
|
char ch;
|
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
|
|
|
|
|
|
|
/* Watch out for recursion here. Any routine that calls
|
|
|
|
* kdb_printf will come back through here. And kdb_read
|
|
|
|
* uses kdb_printf to echo on serial consoles ...
|
|
|
|
*/
|
|
|
|
kdb_nextline = 1; /* In case of recursion */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pause until cr.
|
|
|
|
*/
|
|
|
|
moreprompt = kdbgetenv("MOREPROMPT");
|
|
|
|
if (moreprompt == NULL)
|
|
|
|
moreprompt = "more> ";
|
|
|
|
|
|
|
|
kdb_input_flush();
|
2020-06-04 13:01:16 +03:00
|
|
|
kdb_msg_write(moreprompt, strlen(moreprompt));
|
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 (logging)
|
|
|
|
printk("%s", moreprompt);
|
|
|
|
|
2019-10-25 10:33:26 +03:00
|
|
|
ch = kdb_getchar();
|
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_nextline = 1; /* Really set output line 1 */
|
|
|
|
|
|
|
|
/* empty and reset the buffer: */
|
|
|
|
kdb_buffer[0] = '\0';
|
|
|
|
next_avail = kdb_buffer;
|
|
|
|
size_avail = sizeof(kdb_buffer);
|
2019-10-25 10:33:26 +03:00
|
|
|
if ((ch == 'q') || (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
|
|
|
/* user hit q or Q */
|
|
|
|
KDB_FLAG_SET(CMD_INTERRUPT); /* command interrupted */
|
|
|
|
KDB_STATE_CLEAR(PAGER);
|
|
|
|
/* end of command output; back to normal mode */
|
|
|
|
kdb_grepping_flag = 0;
|
|
|
|
kdb_printf("\n");
|
2019-10-25 10:33:26 +03:00
|
|
|
} else if (ch == ' ') {
|
2012-08-27 07:37:03 +04:00
|
|
|
kdb_printf("\r");
|
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
|
|
|
suspend_grep = 1; /* for this recursion */
|
2019-10-25 10:33:26 +03:00
|
|
|
} else if (ch == '\n' || ch == '\r') {
|
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_nextline = linecount - 1;
|
|
|
|
kdb_printf("\r");
|
|
|
|
suspend_grep = 1; /* for this recursion */
|
2019-10-25 10:33:26 +03:00
|
|
|
} else if (ch == '/' && !kdb_grepping_flag) {
|
2014-09-11 13:37:10 +04:00
|
|
|
kdb_printf("\r");
|
|
|
|
kdb_getstr(kdb_grep_string, KDB_GREP_STRLEN,
|
|
|
|
kdbgetenv("SEARCHPROMPT") ?: "search> ");
|
|
|
|
*strchrnul(kdb_grep_string, '\n') = '\0';
|
|
|
|
kdb_grepping_flag += KDB_GREPPING_FLAG_SEARCH;
|
|
|
|
suspend_grep = 1; /* for this recursion */
|
2019-10-25 10:33:26 +03:00
|
|
|
} else if (ch) {
|
|
|
|
/* user hit something unexpected */
|
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
|
|
|
suspend_grep = 1; /* for this recursion */
|
2019-10-25 10:33:26 +03:00
|
|
|
if (ch != '/')
|
2014-09-11 13:37:10 +04:00
|
|
|
kdb_printf(
|
|
|
|
"\nOnly 'q', 'Q' or '/' are processed at "
|
|
|
|
"more prompt, input ignored\n");
|
|
|
|
else
|
|
|
|
kdb_printf("\n'/' cannot be used during | "
|
|
|
|
"grep filtering, input ignored\n");
|
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 (kdb_grepping_flag) {
|
|
|
|
/* user hit enter */
|
|
|
|
suspend_grep = 1; /* for this recursion */
|
|
|
|
kdb_printf("\n");
|
|
|
|
}
|
|
|
|
kdb_input_flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For grep searches, shift the printed string left.
|
|
|
|
* replaced_byte contains the character that was overwritten with
|
|
|
|
* the terminating null, and cphold points to the null.
|
|
|
|
* Then adjust the notion of available space in the buffer.
|
|
|
|
*/
|
|
|
|
if (kdb_grepping_flag && !suspend_grep) {
|
|
|
|
*cphold = replaced_byte;
|
|
|
|
strcpy(kdb_buffer, cphold);
|
|
|
|
len = strlen(kdb_buffer);
|
|
|
|
next_avail = kdb_buffer + len;
|
|
|
|
size_avail = sizeof(kdb_buffer) - len;
|
|
|
|
}
|
|
|
|
|
|
|
|
kdb_print_out:
|
|
|
|
suspend_grep = 0; /* end of what may have been a recursive call */
|
|
|
|
if (logging)
|
|
|
|
console_loglevel = saved_loglevel;
|
2016-12-15 02:05:55 +03:00
|
|
|
/* kdb_printf_cpu locked the code above. */
|
|
|
|
smp_store_release(&kdb_printf_cpu, old_cpu);
|
|
|
|
local_irq_restore(flags);
|
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 retlen;
|
|
|
|
}
|
2010-05-21 06:04:27 +04:00
|
|
|
|
|
|
|
int kdb_printf(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
2014-11-07 21:37:57 +03:00
|
|
|
r = vkdb_printf(KDB_MSGSRC_INTERNAL, fmt, ap);
|
2010-05-21 06:04:27 +04:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
2010-10-11 19:20:14 +04:00
|
|
|
EXPORT_SYMBOL_GPL(kdb_printf);
|