svn commit: r405792 - in head/devel/gdb: . files/kgdb
John Baldwin
jhb at FreeBSD.org
Mon Jan 11 17:36:15 UTC 2016
Author: jhb (src,doc committer)
Date: Mon Jan 11 17:36:13 2016
New Revision: 405792
URL: https://svnweb.freebsd.org/changeset/ports/405792
Log:
Various fixes to kgdb. Port revision bumped since kgdb is enabled by
default.
- kgdb -n now permits any valid string to be used instead of only
permitting numbers. In particular, this allows 'kgdb -n last' to be
used to open the most recent vmcore.
- kgdb will now try to determine the list of kernel modules even if the
kernel binary does not include debug symbols. This works fine in kernels
that have the changes in r290728.
- Mark trapframes as "signal trampoline frames". GDB assumes that "normal"
frames will never call into a NULL PC. Instead, it assumes that calling a
NULL PC will result in an exception (and thus a signal being posted
resulting in a signal frame). A trap for a NULL function pointer would
thus stop unwinding once it hit the frame with a NULL PC. Marking the
trapframes as a signal frame tells GDB it is ok to unwind past a NULL PC.
One side effect is that frames in the asm handler now display as "signal
handler called" instead of the raw line in assembly. Perhaps at some
point it would be nice to mark these up the way ddb does with the trap
number, etc. but GDB's stack code doesn't support custom frame printers.
PR: 206044
Reviewed by: luca.pizzamiglio at gmail.com (maintainer)
Approved by: koobs
Modified:
head/devel/gdb/Makefile
head/devel/gdb/files/kgdb/amd64fbsd-kern.c
head/devel/gdb/files/kgdb/fbsd-kld.c
head/devel/gdb/files/kgdb/i386fbsd-kern.c
head/devel/gdb/files/kgdb/kgdb-main.c
head/devel/gdb/files/kgdb/ppcfbsd-kern.c
head/devel/gdb/files/kgdb/sparc64fbsd-kern.c
Modified: head/devel/gdb/Makefile
==============================================================================
--- head/devel/gdb/Makefile Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/Makefile Mon Jan 11 17:36:13 2016 (r405792)
@@ -3,7 +3,7 @@
PORTNAME= gdb
PORTVERSION= 7.10
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= devel
MASTER_SITES= GNU
Modified: head/devel/gdb/files/kgdb/amd64fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/amd64fbsd-kern.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -210,7 +210,7 @@ amd64fbsd_trapframe_sniffer (const struc
}
static const struct frame_unwind amd64fbsd_trapframe_unwind = {
- NORMAL_FRAME,
+ SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
amd64fbsd_trapframe_this_id,
amd64fbsd_trapframe_prev_register,
Modified: head/devel/gdb/files/kgdb/fbsd-kld.c
==============================================================================
--- head/devel/gdb/files/kgdb/fbsd-kld.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/fbsd-kld.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -386,9 +386,6 @@ kld_solib_create_inferior_hook (int from
{
struct kld_info *info;
- if (!have_partial_symbols())
- return;
-
info = get_kld_info();
/*
Modified: head/devel/gdb/files/kgdb/i386fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/i386fbsd-kern.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/i386fbsd-kern.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -277,7 +277,7 @@ i386fbsd_dblfault_sniffer (const struct
}
static const struct frame_unwind i386fbsd_dblfault_unwind = {
- NORMAL_FRAME,
+ SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
i386fbsd_dblfault_this_id,
i386fbsd_dblfault_prev_register,
@@ -436,7 +436,7 @@ i386fbsd_trapframe_sniffer (const struct
}
static const struct frame_unwind i386fbsd_trapframe_unwind = {
- NORMAL_FRAME,
+ SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
i386fbsd_trapframe_this_id,
i386fbsd_trapframe_prev_register,
Modified: head/devel/gdb/files/kgdb/kgdb-main.c
==============================================================================
--- head/devel/gdb/files/kgdb/kgdb-main.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/kgdb-main.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -62,10 +62,10 @@ __FBSDID("$FreeBSD$");
#include "kgdb.h"
-static int dumpnr;
static int verbose;
static char crashdir[PATH_MAX];
+static char *dumpnr;
static char *kernel;
static char *remote;
static char *vmcore;
@@ -96,7 +96,7 @@ usage(void)
}
static void
-kernel_from_dumpnr(int nr)
+kernel_from_dumpnr(const char *nr)
{
char line[PATH_MAX], path[PATH_MAX];
FILE *info;
@@ -110,14 +110,14 @@ kernel_from_dumpnr(int nr)
* subdirectory kernel.<nr> and called kernel. The latter allows us
* to collect the modules in the same place.
*/
- snprintf(path, sizeof(path), "%s/kernel.%d", crashdir, nr);
+ snprintf(path, sizeof(path), "%s/kernel.%s", crashdir, nr);
if (stat(path, &st) == 0) {
if (S_ISREG(st.st_mode)) {
kernel = strdup(path);
return;
}
if (S_ISDIR(st.st_mode)) {
- snprintf(path, sizeof(path), "%s/kernel.%d/kernel",
+ snprintf(path, sizeof(path), "%s/kernel.%s/kernel",
crashdir, nr);
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
kernel = strdup(path);
@@ -133,7 +133,7 @@ kernel_from_dumpnr(int nr)
* with debugging info (called either kernel.full or kernel.debug).
* If we have a debug kernel, use it.
*/
- snprintf(path, sizeof(path), "%s/info.%d", crashdir, nr);
+ snprintf(path, sizeof(path), "%s/info.%s", crashdir, nr);
info = fopen(path, "r");
if (info == NULL) {
warn("%s", path);
@@ -223,7 +223,7 @@ main(int argc, char *argv[])
char *s;
int a, ch;
- dumpnr = -1;
+ dumpnr = NULL;
strlcpy(crashdir, "/var/crash", sizeof(crashdir));
s = getenv("KGDB_CRASH_DIR");
@@ -284,13 +284,7 @@ main(int argc, char *argv[])
annotation_level = 1;
break;
case 'n': /* use dump with given number. */
- dumpnr = strtol(optarg, &s, 0);
- if (dumpnr < 0 || *s != '\0') {
- warnx("option %c: invalid kernel dump number",
- optopt);
- usage();
- /* NOTREACHED */
- }
+ dumpnr = optarg;
break;
case 'q':
kgdb_quiet = 1;
@@ -317,7 +311,7 @@ main(int argc, char *argv[])
}
}
- if (((vmcore != NULL) ? 1 : 0) + ((dumpnr >= 0) ? 1 : 0) +
+ if (((vmcore != NULL) ? 1 : 0) + ((dumpnr != NULL) ? 1 : 0) +
((remote != NULL) ? 1 : 0) > 1) {
warnx("options -c, -n and -r are mutually exclusive");
usage();
@@ -330,13 +324,13 @@ main(int argc, char *argv[])
if (argc > optind)
kernel = strdup(argv[optind++]);
- if (argc > optind && (dumpnr >= 0 || remote != NULL)) {
+ if (argc > optind && (dumpnr != NULL || remote != NULL)) {
warnx("options -n and -r do not take a core file. Ignored");
optind = argc;
}
- if (dumpnr >= 0) {
- snprintf(path, sizeof(path), "%s/vmcore.%d", crashdir, dumpnr);
+ if (dumpnr != NULL) {
+ snprintf(path, sizeof(path), "%s/vmcore.%s", crashdir, dumpnr);
if (stat(path, &st) == -1)
err(1, "%s", path);
if (!S_ISREG(st.st_mode))
@@ -372,7 +366,7 @@ main(int argc, char *argv[])
/* If we don't have a kernel image yet, try to find one. */
if (kernel == NULL) {
- if (dumpnr >= 0)
+ if (dumpnr != NULL)
kernel_from_dumpnr(dumpnr);
if (kernel == NULL)
Modified: head/devel/gdb/files/kgdb/ppcfbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/ppcfbsd-kern.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/ppcfbsd-kern.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -189,7 +189,7 @@ ppcfbsd_trapframe_sniffer (const struct
static const struct frame_unwind ppcfbsd_trapframe_unwind =
{
- NORMAL_FRAME,
+ SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
ppcfbsd_trapframe_this_id,
ppcfbsd_trapframe_prev_register,
Modified: head/devel/gdb/files/kgdb/sparc64fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Mon Jan 11 17:18:26 2016 (r405791)
+++ head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Mon Jan 11 17:36:13 2016 (r405792)
@@ -159,7 +159,7 @@ sparc64fbsd_trapframe_sniffer (const str
static const struct frame_unwind sparc64fbsd_trapframe_unwind =
{
- NORMAL_FRAME,
+ SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
sparc64fbsd_trapframe_this_id,
sparc64fbsd_trapframe_prev_register,
More information about the svn-ports-head
mailing list