[RFA] Consolidate API of target_supports_multi_process
Commit Message
This simple commit consolidates the API of
target_supports_multi_process. Since both GDB and gdbserver use the
same function prototype, all that was needed was to move create this
prototype on gdb/target/target.h and turn the macros declared on
gdb/{,gdbserver/}target.h into actual functions.
Regtested (clean pass) on the BuildBot.
gdb/ChangeLog:
2016-09-27 Sergio Durigan Junior <sergiodj@redhat.com>
* target.c (target_supports_multi_process): New function, moved
from...
* target.h (target_supports_multi_process): ... here. Remove
macro.
* target/target.h (target_supports_multi_process): New prototype.
gdb/gdbserver/ChangeLog:
2016-09-27 Sergio Durigan Junior <sergiodj@redhat.com>
* target.c (target_supports_multi_process): New function, moved
from...
* target.h (target_supports_multi_process): ... here. Remove
macro.
---
gdb/gdbserver/target.c | 9 +++++++++
gdb/gdbserver/target.h | 4 ----
gdb/target.c | 8 ++++++++
gdb/target.h | 6 ------
gdb/target/target.h | 5 +++++
5 files changed, 22 insertions(+), 10 deletions(-)
@@ -298,6 +298,15 @@ target_continue (ptid_t ptid, enum gdb_signal signal)
(*the_target->resume) (&resume_info, 1);
}
+/* See target/target.h. */
+
+int
+target_supports_multi_process (void)
+{
+ return (the_target->supports_multi_process != NULL ?
+ (*the_target->supports_multi_process) () : 0);
+}
+
int
start_non_stop (int nonstop)
{
@@ -535,10 +535,6 @@ int kill_inferior (int);
#define target_async(enable) \
(the_target->async ? (*the_target->async) (enable) : 0)
-#define target_supports_multi_process() \
- (the_target->supports_multi_process ? \
- (*the_target->supports_multi_process) () : 0)
-
#define target_process_qsupported(features, count) \
do \
{ \
@@ -2727,6 +2727,14 @@ target_supports_disable_randomization (void)
return 0;
}
+/* See target/target.h. */
+
+int
+target_supports_multi_process (void)
+{
+ return (*current_target.to_supports_multi_process) (¤t_target);
+}
+
char *
target_get_osdata (const char *type)
{
@@ -1380,12 +1380,6 @@ struct address_space *target_thread_address_space (ptid_t);
int target_info_proc (const char *, enum info_proc_what);
-/* Returns true if this target can debug multiple processes
- simultaneously. */
-
-#define target_supports_multi_process() \
- (*current_target.to_supports_multi_process) (¤t_target)
-
/* Returns true if this target can disable address space randomization. */
int target_supports_disable_randomization (void);
@@ -90,4 +90,9 @@ extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
extern void target_mourn_inferior (ptid_t ptid);
+/* Return 1 if this target can debug multiple processes
+ simultaneously, zero otherwise. */
+
+extern int target_supports_multi_process (void);
+
#endif /* TARGET_COMMON_H */