diff options
author | John Baldwin <jhb@FreeBSD.org> | 2016-01-11 17:36:13 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2016-01-11 17:36:13 +0000 |
commit | 756b49d46f77f7847c8b9d6fdcbf20be7a587250 (patch) | |
tree | 921e7e341eb50b32879990c05cbc69e6697acde5 /devel/gdb | |
parent | 1419e03bb40e97d366884aeafe94ff2fd3ea3e73 (diff) |
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@gmail.com (maintainer)
Approved by: koobs
Notes
Notes:
svn path=/head/; revision=405792
Diffstat (limited to 'devel/gdb')
-rw-r--r-- | devel/gdb/Makefile | 2 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/amd64fbsd-kern.c | 2 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/fbsd-kld.c | 3 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/i386fbsd-kern.c | 4 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/kgdb-main.c | 30 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/ppcfbsd-kern.c | 2 | ||||
-rw-r--r-- | devel/gdb/files/kgdb/sparc64fbsd-kern.c | 2 |
7 files changed, 18 insertions, 27 deletions
diff --git a/devel/gdb/Makefile b/devel/gdb/Makefile index f148d12c0610..fc0cb6fd85b1 100644 --- a/devel/gdb/Makefile +++ b/devel/gdb/Makefile @@ -3,7 +3,7 @@ PORTNAME= gdb PORTVERSION= 7.10 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= devel MASTER_SITES= GNU diff --git a/devel/gdb/files/kgdb/amd64fbsd-kern.c b/devel/gdb/files/kgdb/amd64fbsd-kern.c index 5c9355a555a9..162fdb0e7e7a 100644 --- a/devel/gdb/files/kgdb/amd64fbsd-kern.c +++ b/devel/gdb/files/kgdb/amd64fbsd-kern.c @@ -210,7 +210,7 @@ amd64fbsd_trapframe_sniffer (const struct frame_unwind *self, } 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, diff --git a/devel/gdb/files/kgdb/fbsd-kld.c b/devel/gdb/files/kgdb/fbsd-kld.c index f5c1a3c52f1c..e8a23d5ecd6a 100644 --- a/devel/gdb/files/kgdb/fbsd-kld.c +++ b/devel/gdb/files/kgdb/fbsd-kld.c @@ -386,9 +386,6 @@ kld_solib_create_inferior_hook (int from_tty) { struct kld_info *info; - if (!have_partial_symbols()) - return; - info = get_kld_info(); /* diff --git a/devel/gdb/files/kgdb/i386fbsd-kern.c b/devel/gdb/files/kgdb/i386fbsd-kern.c index a621f54c5004..37e658fcf7f8 100644 --- a/devel/gdb/files/kgdb/i386fbsd-kern.c +++ b/devel/gdb/files/kgdb/i386fbsd-kern.c @@ -277,7 +277,7 @@ i386fbsd_dblfault_sniffer (const struct frame_unwind *self, } 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 frame_unwind *self, } 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, diff --git a/devel/gdb/files/kgdb/kgdb-main.c b/devel/gdb/files/kgdb/kgdb-main.c index a99fc57971d7..ef63f8062482 100644 --- a/devel/gdb/files/kgdb/kgdb-main.c +++ b/devel/gdb/files/kgdb/kgdb-main.c @@ -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) diff --git a/devel/gdb/files/kgdb/ppcfbsd-kern.c b/devel/gdb/files/kgdb/ppcfbsd-kern.c index 30feafeb2bc6..f668c34b41eb 100644 --- a/devel/gdb/files/kgdb/ppcfbsd-kern.c +++ b/devel/gdb/files/kgdb/ppcfbsd-kern.c @@ -189,7 +189,7 @@ ppcfbsd_trapframe_sniffer (const struct frame_unwind *self, 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, diff --git a/devel/gdb/files/kgdb/sparc64fbsd-kern.c b/devel/gdb/files/kgdb/sparc64fbsd-kern.c index 57b0387a240c..bb3eb3515674 100644 --- a/devel/gdb/files/kgdb/sparc64fbsd-kern.c +++ b/devel/gdb/files/kgdb/sparc64fbsd-kern.c @@ -159,7 +159,7 @@ sparc64fbsd_trapframe_sniffer (const struct frame_unwind *self, 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, |