Refactor default_breakpoint_kind_from_pc to be used by all targets in GDBServer.

This patch moves default_breakpoint_kind_from_pc to target.c and creates a macro
so that all targets can easily use it.

This allows the breakpoint_kind_from_pc operation to be left unimplemented in
targets that do not need it.

This is preparation to fix the win32/nto/spu build that was broken by this
patch: https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}

gdb/gdbserver/ChangeLog:

	* linux-low.c (default_breakpoint_kind_from_pc): Move to target.c.
	* mem-break.c (set_breakpoint_at): Use target_breakpoint_kind_from_pc.
	* target.c (default_breakpoint_kind_from_pc): Moved from linux-low.c
	* target.h (target_breakpoint_kind_from_pc): New macro.
This commit is contained in:
Antoine Tremblay
2015-10-23 13:20:39 -04:00
parent 1cce69b9dc
commit 2e6ee069ae
5 changed files with 31 additions and 14 deletions

View File

@@ -633,6 +633,11 @@ int kill_inferior (int);
(the_target->stopped_by_hw_breakpoint ? \
(*the_target->stopped_by_hw_breakpoint) () : 0)
#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))
/* Start non-stop mode, returns 0 on success, -1 on failure. */
int start_non_stop (int nonstop);
@@ -667,4 +672,6 @@ const char *target_pid_to_str (ptid_t);
int target_can_do_hardware_single_step (void);
int default_breakpoint_kind_from_pc (CORE_ADDR *pcptr);
#endif /* TARGET_H */