aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2008-03-29 17:46:03 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2008-03-29 17:46:03 +0000
commit36cc36a0ec0c1918dad9e6f15be4de1e565889be (patch)
treecba3f3775b4b8ee0c5fde8c8061fa19804fc4919 /gnu
parentdbdb679c6ffb9b289cb4489246d0a30635657e00 (diff)
downloadsrc-36cc36a0ec0c1918dad9e6f15be4de1e565889be.tar.gz
src-36cc36a0ec0c1918dad9e6f15be4de1e565889be.zip
Change kgdb_parse() to use wrapped versions of parse_expression() and
evaluate_expression() so that any errors are caught and cause the function to return to 0. Otherwise the errors posted an exception (via longjmp()) that aborted the current operation. This fixes the kld handling for older kernels (6.x and 7.x) that don't have the full pathname stored in the kernel linker. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=177715
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/kgdb/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/main.c b/gnu/usr.bin/gdb/kgdb/main.c
index 5e1c9c6b2687..77627630af0f 100644
--- a/gnu/usr.bin/gdb/kgdb/main.c
+++ b/gnu/usr.bin/gdb/kgdb/main.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <top.h>
#include <bfd.h>
#include <gdbcore.h>
+#include <wrapper.h>
extern void (*init_ui_hook)(char *);
@@ -188,13 +189,15 @@ kgdb_parse(const char *exp)
char *s;
CORE_ADDR n;
- s = strdup(exp);
- old_chain = make_cleanup(free_current_contents, &expr);
- expr = parse_expression(s);
- val = (expr != NULL) ? evaluate_expression(expr) : NULL;
- n = (val != NULL) ? value_as_address(val) : 0;
+ n = 0;
+ s = xstrdup(exp);
+ old_chain = make_cleanup(xfree, s);
+ if (gdb_parse_exp_1(&s, NULL, 0, &expr) && *s == '\0') {
+ make_cleanup(free_current_contents, &expr);
+ if (gdb_evaluate_expression(expr, &val))
+ n = value_as_address(val);
+ }
do_cleanups(old_chain);
- free(s);
return (n);
}