Use the thread_section_name helper class in fbsd_core_thread_name.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 28 Jun 2017 18:21:10 +0000 (11:21 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 7 Jul 2017 23:09:13 +0000 (16:09 -0700)
gdb/ChangeLog:

* fbsd-tdep.c (fbsd_core_thread_name): Use thread_section_name.

gdb/ChangeLog
gdb/fbsd-tdep.c

index 35762a90a2ca101caffc28dbd6d405a2be9c5d1a..02397dfd581f42cabf60057e71b2592755d4a1ea 100644 (file)
@@ -1,3 +1,7 @@
+2017-07-07  John Baldwin  <jhb@FreeBSD.org>
+
+       * fbsd-tdep.c (fbsd_core_thread_name): Use thread_section_name.
+
 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
 
        * corelow.c (get_core_siginfo): Remove.
index 24a3c20dd60716028afeab23d77d7df4fe6e5739..32df10420802b74ea3872ec0d7520bcdbddd96b9 100644 (file)
@@ -75,7 +75,6 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
   static char buf[80];
   struct bfd_section *section;
   bfd_size_type size;
-  char sectionstr[32];
 
   if (ptid_get_lwp (thr->ptid) != 0)
     {
@@ -86,9 +85,9 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
         structure.  Rather than define the full structure here, just
         extract the null-terminated name from the start of the
         note.  */
-      xsnprintf (sectionstr, sizeof sectionstr, ".thrmisc/%ld",
-               ptid_get_lwp (thr->ptid));
-      section = bfd_get_section_by_name (core_bfd, sectionstr);
+      thread_section_name section_name (".thrmisc", thr->ptid);
+
+      section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
       if (section != NULL && bfd_section_size (core_bfd, section) > 0)
        {
          /* Truncate the name if it is longer than "buf".  */