diff options
author | Pedro Alves <palves@redhat.com> | 2009-01-01 22:02:03 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-01-01 22:02:03 +0000 |
commit | ccc57cf9e6782a19d8bccb1fdd0d02dd6ab98702 (patch) | |
tree | 8f5a92c1161105aae211fbdd06369748a2eee8e3 /gdb/breakpoint.c | |
parent | 023b0f5cefb067d6338e9bfd2987e4ed54b8b379 (diff) | |
download | gdb-ccc57cf9e6782a19d8bccb1fdd0d02dd6ab98702.zip gdb-ccc57cf9e6782a19d8bccb1fdd0d02dd6ab98702.tar.gz gdb-ccc57cf9e6782a19d8bccb1fdd0d02dd6ab98702.tar.bz2 |
2009-01-01 Pedro Alves <pedro@codesourcery.com>
PR breakpoints/9681:
* exceptions.h (enum errors): New error type, MEMORY_ERROR.
* corefile.c (memory_error): Rewrite to throw a MEMORY_ERROR.
* breakpoint.c (fetch_watchpoint_value): Ignore MEMORY_ERRORs, but
retrow all other exceptions.
2009-01-01 Pedro Alves <pedro@codesourcery.com>
PR breakpoints/9681:
* gdb.base/watchpoint.exp: Add regression test.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 30c89bd..83118bc 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -755,7 +755,7 @@ is_hardware_watchpoint (struct breakpoint *bpt) in *VAL_CHAIN. RESULTP and VAL_CHAIN may be NULL if the caller does not need them. - If an error occurs while evaluating the expression, *RESULTP will + 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 @@ -776,6 +776,7 @@ fetch_watchpoint_value (struct expression *exp, struct value **valp, struct value **resultp, struct value **val_chain) { struct value *mark, *new_mark, *result; + volatile struct gdb_exception ex; *valp = NULL; if (resultp) @@ -786,7 +787,26 @@ fetch_watchpoint_value (struct expression *exp, struct value **valp, /* Evaluate the expression. */ mark = value_mark (); result = NULL; - gdb_evaluate_expression (exp, &result); + + TRY_CATCH (ex, RETURN_MASK_ALL) + { + result = evaluate_expression (exp); + } + if (ex.reason < 0) + { + /* Ignore memory errors, 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; + default: + throw_exception (ex); + break; + } + } + new_mark = value_mark (); if (mark == new_mark) return; |