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
This commit is contained in:
John Baldwin 2008-03-29 17:46:03 +00:00
parent dbdb679c6f
commit 36cc36a0ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177715

View File

@ -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);
}