diff options
author | Tom Tromey <tromey@redhat.com> | 2013-08-02 16:41:08 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-08-02 16:41:08 +0000 |
commit | 3a1115a0cc0a0a98555ba99df76ad9bcfee08759 (patch) | |
tree | 7bd5d53c3fa5d8723edfa7193d43c3ec43f9d932 /gdb/eval.c | |
parent | 58b19776a6713e101fb71fab79ea70fa9af19e3a (diff) | |
download | gdb-3a1115a0cc0a0a98555ba99df76ad9bcfee08759.zip gdb-3a1115a0cc0a0a98555ba99df76ad9bcfee08759.tar.gz gdb-3a1115a0cc0a0a98555ba99df76ad9bcfee08759.tar.bz2 |
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.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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; |