summaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-02 16:41:07 +0000
committerTom Tromey <tromey@redhat.com>2013-08-02 16:41:07 +0000
commitf481f474696ffbf874d1f9c97371e7bfcb6a47b3 (patch)
tree2b009aefc203d7eaec220481c94f50174eae235b /gdb/eval.c
parentcb81ffd4f1c415b1f7f6ebce3a11d2b6777a02f2 (diff)
downloadgdb-f481f474696ffbf874d1f9c97371e7bfcb6a47b3.tar.gz
fix PR symtab/15719
This patch fixes PR symtab/15719. The bug is that "watch -location" crashes on a certain expression. The problem is that fetch_subexp_value is catching an exception. For ordinary watchpoints this is ok; but for location watchpoints, it is better for the exception to propagate. Built and regtested on x86-64 Fedora 18. New test case included. PR symtab/15719: * breakpoint.c (update_watchpoint, watchpoint_check) (watch_command_1): Update. * eval.c (fetch_subexp_value): Add "preserve_errors" parameter. * ppc-linux-nat.c (check_condition): Update. * value.h (fetch_subexp_value): Update. * gdb.base/watchpoint.c (struct foo5): New. (nullptr): New global. * gdb.base/watchpoint.exp (test_watch_location): Add test.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 539489f95cb..e83bfdf8f17 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -171,10 +171,12 @@ evaluate_subexpression_type (struct expression *exp, int subexp)
in *VAL_CHAIN. RESULTP and VAL_CHAIN may be NULL if the caller does
not need them.
- If a memory error occurs while evaluating the expression, *RESULTP will
- be set to NULL. *RESULTP may be a lazy value, if the result could
- not be read from memory. It is used to determine whether a value
- is user-specified (we should watch the whole value) or intermediate
+ If PRESERVE_ERRORS is true, then exceptions are passed through.
+ Otherwise, if PRESERVE_ERRORS is false, then if a memory error
+ occurs while evaluating the expression, *RESULTP will be set to
+ NULL. *RESULTP may be a lazy value, if the result could not be
+ read from memory. It is used to determine whether a value is
+ user-specified (we should watch the whole value) or intermediate
(we should watch only the bit used to locate the final value).
If the final value, or any intermediate value, could not be read
@@ -189,7 +191,8 @@ evaluate_subexpression_type (struct expression *exp, int subexp)
void
fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
- struct value **resultp, struct value **val_chain)
+ struct value **resultp, struct value **val_chain,
+ int preserve_errors)
{
struct value *mark, *new_mark, *result;
volatile struct gdb_exception ex;
@@ -210,13 +213,14 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
}
if (ex.reason < 0)
{
- /* Ignore memory errors, we want watchpoints pointing at
+ /* Ignore memory errors if we want watchpoints pointing at
inaccessible memory to still be created; otherwise, throw the
error to some higher catcher. */
switch (ex.error)
{
case MEMORY_ERROR:
- break;
+ if (!preserve_errors)
+ break;
default:
throw_exception (ex);
break;