aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-01-09 18:33:45 +0000
committerPedro Alves <palves@redhat.com>2014-01-09 18:33:45 +0000
commit0000e5ccd8615d632ac6ddc831cd5d3af8084737 (patch)
treea6f477aad37e0c71069309ebbc6262018478cc11 /gdb/target.h
parentc66a241cde1b8fe4207d425c9956cb6dac948732 (diff)
downloadgdb-0000e5ccd8615d632ac6ddc831cd5d3af8084737.zip
gdb-0000e5ccd8615d632ac6ddc831cd5d3af8084737.tar.gz
gdb-0000e5ccd8615d632ac6ddc831cd5d3af8084737.tar.bz2
Handle the case of a remote target supporting target side commands, but not on software breakpoints.
Although we can tell upfront whether a remote target supports target side commands, we can only tell whether the target supports that in combination with a given breakpoint kind (software, hardware, watchpoints, etc.) when we go and try to insert such a breakpoint kind the first time. It's not desirable to make remote_insert_breakpoint simply return -1 in this case, because if the breakpoint was set in a shared library, insert_bp_location will assume that the breakpoint insertion failed because the library wasn't mapped in. insert_bp_location already handles errors/exceptions thrown from the target_insert_xxx methods, exactly so the backend can tell the user the detailed reason the insertion of hw breakpoints failed. But, in the case of software breakpoints, it discards the detailed error message. So the patch makes insert_bp_location use the error's message for SW breakpoints too, and, introduces a NOT_SUPPORTED_ERROR error code so that insert_bp_location doesn't confuse the error for failure due to a shared library disappearing. The result is: (gdb) c Warning: Cannot insert breakpoint 2: Target doesn't support breakpoints that have target side commands. 2014-01-09 Pedro Alves <palves@redhat.com> Hui Zhu <hui@codesourcery.com> PR gdb/16101 * breakpoint.c (insert_bp_location): Rename hw_bp_err_string to bp_err_string. Don't mark the location shlib_disabled if the error thrown wasn't a generic or memory error. Catch errors thrown while inserting breakpoints in overlayed code. Output error message of software breakpoints. * remote.c (remote_insert_breakpoint): If this breakpoint has target-side commands but this stub doesn't support Z0 packets, throw NOT_SUPPORTED_ERROR error. * exceptions.h (enum errors) <NOT_SUPPORTED_ERROR>: New error. * target.h (target_insert_breakpoint): Extend comment. (target_insert_hw_breakpoint): Add comment.
Diffstat (limited to 'gdb/target.h')
-rw-r--r--gdb/target.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/target.h b/gdb/target.h
index 4b52fb6..ab985e4 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1127,8 +1127,10 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
#define target_files_info() \
(*current_target.to_files_info) (&current_target)
-/* Insert a breakpoint at address BP_TGT->placed_address in the target
- machine. Result is 0 for success, non-zero for error. */
+/* Insert a hardware breakpoint at address BP_TGT->placed_address in
+ the target machine. Returns 0 for success, and returns non-zero or
+ throws an error (with a detailed failure reason error code and
+ message) otherwise. */
extern int target_insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt);
@@ -1557,6 +1559,11 @@ extern int target_insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
+/* Insert a hardware breakpoint at address BP_TGT->placed_address in
+ the target machine. Returns 0 for success, and returns non-zero or
+ throws an error (with a detailed failure reason error code and
+ message) otherwise. */
+
#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
(*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt)