aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-01-18 09:49:23 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2016-01-19 08:18:20 -0800
commit4dfc5dbc4e1b267d440dd515a42fe6fd96a8d860 (patch)
tree6cec1021e910abd6adbf097333c65669d188e0b9 /gdb/gdbarch.c
parent5b2c414df12bb61ab1e40099b92fc8f00983b930 (diff)
downloadfsf-binutils-gdb-4dfc5dbc4e1b267d440dd515a42fe6fd96a8d860.zip
fsf-binutils-gdb-4dfc5dbc4e1b267d440dd515a42fe6fd96a8d860.tar.gz
fsf-binutils-gdb-4dfc5dbc4e1b267d440dd515a42fe6fd96a8d860.tar.bz2
Add support for extracting thread names from cores.
Add a new gdbarch method to extract a thread name from a core for a given thread. Use this new method in core_thread_name to implement the to_thread_name target op. gdb/ChangeLog: * corelow.c (core_thread_name): New function. (init_core_ops): Use "core_thread_name" for the "to_thread_name" target op. * gdbarch.sh (core_thread_name): New gdbarch callback. * gdbarch.h: Re-generate. * gdbarch.c: Re-generate.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index d45af1a..4143744 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -269,6 +269,7 @@ struct gdbarch
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix;
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
+ gdbarch_core_thread_name_ftype *core_thread_name;
const char * gcore_bfd_target;
int vtable_function_descriptors;
int vbit_in_delta;
@@ -612,6 +613,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of core_xfer_shared_libraries, has predicate. */
/* Skip verify of core_xfer_shared_libraries_aix, has predicate. */
/* Skip verify of core_pid_to_str, has predicate. */
+ /* Skip verify of core_thread_name, has predicate. */
/* Skip verify of gcore_bfd_target, has predicate. */
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
/* Skip verify of vbit_in_delta, invalid_p == 0 */
@@ -824,6 +826,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: core_read_description = <%s>\n",
host_address_to_string (gdbarch->core_read_description));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_core_thread_name_p() = %d\n",
+ gdbarch_core_thread_name_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: core_thread_name = <%s>\n",
+ host_address_to_string (gdbarch->core_thread_name));
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
gdbarch_core_xfer_shared_libraries_p (gdbarch));
fprintf_unfiltered (file,
@@ -3554,6 +3562,30 @@ set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch,
}
int
+gdbarch_core_thread_name_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->core_thread_name != NULL;
+}
+
+const char *
+gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->core_thread_name != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_core_thread_name called\n");
+ return gdbarch->core_thread_name (gdbarch, thr);
+}
+
+void
+set_gdbarch_core_thread_name (struct gdbarch *gdbarch,
+ gdbarch_core_thread_name_ftype core_thread_name)
+{
+ gdbarch->core_thread_name = core_thread_name;
+}
+
+int
gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);