summaryrefslogtreecommitdiff
path: root/gdbserver/target.h
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-02-17 16:12:02 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-02-20 17:35:18 +0100
commitd367006fb7cf837210e2aa1944a11169a60039b4 (patch)
tree587bc13bb5fe00df9ea0d1e2eb88a5c594de3fe6 /gdbserver/target.h
parentc9b7b80460e47ea4554960af6814de71b3e427cb (diff)
downloadbinutils-gdb-d367006fb7cf837210e2aa1944a11169a60039b4.tar.gz
gdbserver: turn breakpoint kind-related target ops into methods
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's breakpoint_kind_from_pc, sw_breakpoint_from_kind, and breakpoint_kind_from_current_state ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target op. (class process_target): Add the target op. (target_breakpoint_kind_from_pc): Update the macro. (target_breakpoint_kind_from_current_state): Update the macro. (default_breakpoint_kind_from_pc): Remove declaration. * target.cc (default_breakpoint_kind_from_pc): Turn into ... (process_target::breakpoint_kind_from_pc): ... this. (process_target::breakpoint_kind_from_current_state): Define. Update the derived classes and callers below. * mem-break.cc (bp_size): Update. (bp_opcode): Update. * linux-low.cc (linux_target_ops): Update. (linux_wait_1): Update. (linux_breakpoint_kind_from_pc): Turn into ... (linux_process_target::breakpoint_kind_from_pc): ... this. (linux_sw_breakpoint_from_kind): Turn into ... (linux_process_target::sw_breakpoint_from_kind): ... this. (linux_breakpoint_kind_from_current_state): Turn into ... (linux_process_target::breakpoint_kind_from_current_state): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_process_target::sw_breakpoint_from_kind): Define. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_sw_breakpoint_from_kind): Turn into ... (nto_process_target::sw_breakpoint_from_kind): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_sw_breakpoint_from_kind): Turn into ... (win32_process_target::sw_breakpoint_from_kind): ... this. * win32-low.h (class win32_process_target): Update.
Diffstat (limited to 'gdbserver/target.h')
-rw-r--r--gdbserver/target.h42
1 files changed, 18 insertions, 24 deletions
diff --git a/gdbserver/target.h b/gdbserver/target.h
index bf653a4d08a..4651e449a80 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -70,26 +70,10 @@ class process_target;
shared code. */
struct process_stratum_target
{
- /* Return the breakpoint kind for this target based on PC. The PCPTR is
- adjusted to the real memory location in case a flag (e.g., the Thumb bit on
- ARM) was present in the PC. */
- int (*breakpoint_kind_from_pc) (CORE_ADDR *pcptr);
-
- /* Return the software breakpoint from KIND. KIND can have target
- specific meaning like the Z0 kind parameter.
- SIZE is set to the software breakpoint's length in memory. */
- const gdb_byte *(*sw_breakpoint_from_kind) (int kind, int *size);
-
/* Return the thread's name, or NULL if the target is unable to determine it.
The returned value must not be freed by the caller. */
const char *(*thread_name) (ptid_t thread);
- /* Return the breakpoint kind for this target based on the current
- processor state (e.g. the current instruction mode on ARM) and the
- PC. The PCPTR is adjusted to the real memory location in case a flag
- (e.g., the Thumb bit on ARM) is present in the PC. */
- int (*breakpoint_kind_from_current_state) (CORE_ADDR *pcptr);
-
/* Returns true if the target can software single step. */
int (*supports_software_single_step) (void);
@@ -503,6 +487,22 @@ public:
not override this. The default behavior is to use readlink(2). */
virtual ssize_t multifs_readlink (int pid, const char *filename,
char *buf, size_t bufsiz);
+
+ /* Return the breakpoint kind for this target based on PC. The
+ PCPTR is adjusted to the real memory location in case a flag
+ (e.g., the Thumb bit on ARM) was present in the PC. */
+ virtual int breakpoint_kind_from_pc (CORE_ADDR *pcptr);
+
+ /* Return the software breakpoint from KIND. KIND can have target
+ specific meaning like the Z0 kind parameter.
+ SIZE is set to the software breakpoint's length in memory. */
+ virtual const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) = 0;
+
+ /* Return the breakpoint kind for this target based on the current
+ processor state (e.g. the current instruction mode on ARM) and the
+ PC. The PCPTR is adjusted to the real memory location in case a
+ flag (e.g., the Thumb bit on ARM) is present in the PC. */
+ virtual int breakpoint_kind_from_current_state (CORE_ADDR *pcptr);
};
extern process_stratum_target *the_target;
@@ -661,14 +661,10 @@ target_read_btrace_conf (struct btrace_target_info *tinfo,
the_target->pt->stopped_by_hw_breakpoint ()
#define target_breakpoint_kind_from_pc(pcptr) \
- (the_target->breakpoint_kind_from_pc \
- ? (*the_target->breakpoint_kind_from_pc) (pcptr) \
- : default_breakpoint_kind_from_pc (pcptr))
+ the_target->pt->breakpoint_kind_from_pc (pcptr)
#define target_breakpoint_kind_from_current_state(pcptr) \
- (the_target->breakpoint_kind_from_current_state \
- ? (*the_target->breakpoint_kind_from_current_state) (pcptr) \
- : target_breakpoint_kind_from_pc (pcptr))
+ the_target->pt->breakpoint_kind_from_current_state (pcptr)
#define target_supports_software_single_step() \
(the_target->supports_software_single_step ? \
@@ -701,6 +697,4 @@ int set_desired_thread ();
const char *target_pid_to_str (ptid_t);
-int default_breakpoint_kind_from_pc (CORE_ADDR *pcptr);
-
#endif /* GDBSERVER_TARGET_H */