[v2,2/3] gdb, breakpoint: add a breakpoint type converter
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
Commit Message
Add a new function 'bptype_to_target_hw_bp_type' to perform
the translation from 'bptype' to 'target_hw_bp_type'.
Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
---
gdb/breakpoint.c | 20 ++++++++++++++++++++
gdb/breakpoint.h | 3 +++
2 files changed, 23 insertions(+)
@@ -9827,6 +9827,26 @@ watchpoint::~watchpoint ()
bpt->related_breakpoint = this->related_breakpoint;
}
+/* See breakpoint.h. */
+
+target_hw_bp_type
+bptype_to_target_hw_bp_type (bptype type)
+{
+ switch (type)
+ {
+ case bp_hardware_watchpoint:
+ return hw_write;
+ case bp_read_watchpoint:
+ return hw_read;
+ case bp_access_watchpoint:
+ return hw_access;
+ case bp_hardware_breakpoint:
+ return hw_execute;
+ default:
+ error (_ ("Bad breakpoint type: bptype %d."), type);
+ }
+}
+
/* Return non-zero if EXP is verified as constant. Returned zero
means EXP is variable. Also the constant detection may fail for
some constant expressions and in such case still falsely return
@@ -2029,4 +2029,7 @@ extern void enable_disable_bp_location (bp_location *loc, bool enable);
extern void notify_breakpoint_modified (breakpoint *b);
+/* Translate BPTYPE to TARGET_HW_BP_TYPE. */
+
+extern target_hw_bp_type bptype_to_target_hw_bp_type (bptype type);
#endif /* !defined (BREAKPOINT_H) */