aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/linux-low.c3
-rw-r--r--gdb/gdbserver/server.c16
-rw-r--r--gdb/gdbserver/target.h8
4 files changed, 28 insertions, 8 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index e265798..6e2a95d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,12 @@
+2015-11-26 Daniel Colascione <dancol@dancol.org>
+2015-11-26 Simon Marchi <simon.marchi@ericsson.com>
+
+ * linux-low.c (linux_target_ops): Use linux_proc_tid_get_name.
+ * server.c (handle_qxfer_threads_worker): Refactor to include thread
+ name in reply.
+ * target.h (struct target_ops) <thread_name>: New field.
+ (target_thread_name): New macro.
+
2015-11-23 Joel Brobecker <brobecker@adacore.com>
* regcache.h (regcache_invalidate_pid): Add declaration.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e3a56a7..a70868c 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -7043,7 +7043,8 @@ static struct target_ops linux_target_ops = {
linux_mntns_unlink,
linux_mntns_readlink,
linux_breakpoint_kind_from_pc,
- linux_sw_breakpoint_from_kind
+ linux_sw_breakpoint_from_kind,
+ linux_proc_tid_get_name,
};
static void
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 7d6c9cc..0105b99 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1456,20 +1456,22 @@ handle_qxfer_threads_worker (struct inferior_list_entry *inf, void *arg)
char ptid_s[100];
int core = target_core_of_thread (ptid);
char core_s[21];
+ const char *name = target_thread_name (ptid);
write_ptid (ptid_s, ptid);
+ buffer_xml_printf (buffer, "<thread id=\"%s\"", ptid_s);
+
if (core != -1)
{
sprintf (core_s, "%d", core);
- buffer_xml_printf (buffer, "<thread id=\"%s\" core=\"%s\"/>\n",
- ptid_s, core_s);
- }
- else
- {
- buffer_xml_printf (buffer, "<thread id=\"%s\"/>\n",
- ptid_s);
+ buffer_xml_printf (buffer, " core=\"%s\"", core_s);
}
+
+ if (name != NULL)
+ buffer_xml_printf (buffer, " name=\"%s\"", name);
+
+ buffer_xml_printf (buffer, "/>\n");
}
/* Helper for handle_qxfer_threads. */
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 358a8ab..8903da5 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -453,6 +453,10 @@ struct target_ops
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);
};
extern struct target_ops *the_target;
@@ -663,6 +667,10 @@ ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
(the_target->core_of_thread ? (*the_target->core_of_thread) (ptid) \
: -1)
+#define target_thread_name(ptid) \
+ (the_target->thread_name ? (*the_target->thread_name) (ptid) \
+ : NULL)
+
int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,