From 3e10640f3c843093ec9a8e95a9cd5c1b81dc156f Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 19 Apr 2012 05:05:11 +0000 Subject: [PATCH] gdb/gdbserver/ * remote-utils.c (prepare_resume_reply): Replace with macro target_core_of_thread. * server.c (handle_qxfer_threads_proper): Likewise. * target.h (traget_core_of_thread): New macro. --- gdb/gdbserver/ChangeLog | 7 +++++++ gdb/gdbserver/remote-utils.c | 4 ++-- gdb/gdbserver/server.c | 5 +---- gdb/gdbserver/target.h | 4 ++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 1c9b9d8c5c5..d238062beef 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2012-04-19 Yao Qi + + * remote-utils.c (prepare_resume_reply): Replace with macro + target_core_of_thread. + * server.c (handle_qxfer_threads_proper): Likewise. + * target.h (traget_core_of_thread): New macro. + 2012-04-16 Yao Qi * tracepoint.c (cmd_qtstart): Download tracepoints even when they are diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 4e35bb7c64b..995e3b1074e 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -1390,8 +1390,8 @@ prepare_resume_reply (char *buf, ptid_t ptid, strcat (buf, ";"); buf += strlen (buf); - if (the_target->core_of_thread) - core = (*the_target->core_of_thread) (ptid); + core = target_core_of_thread (ptid); + if (core != -1) { sprintf (buf, "core:"); diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 9c7159f3d52..23c9d47c3b5 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1161,14 +1161,11 @@ handle_qxfer_threads_proper (struct buffer *buffer) { ptid_t ptid = thread_to_gdb_id ((struct thread_info *)thread); char ptid_s[100]; - int core = -1; + int core = target_core_of_thread (ptid); char core_s[21]; write_ptid (ptid_s, ptid); - if (the_target->core_of_thread) - core = (*the_target->core_of_thread) (ptid); - if (core != -1) { sprintf (core_s, "%d", core); diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 256cfd90490..dcf02306c89 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -540,6 +540,10 @@ ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, (*the_target->done_accessing_memory) (); \ } while (0) +#define target_core_of_thread(ptid) \ + (the_target->core_of_thread ? (*the_target->core_of_thread) (ptid) \ + : -1) + int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len); int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, -- 2.30.2