public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Make windows_thread_info::name a unique_xmalloc_ptr
Date: Fri, 24 Apr 2020 18:41:40 -0400	[thread overview]
Message-ID: <2950fdf7423a404f6ebc691606d04917fd68228a@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 2950fdf7423a404f6ebc691606d04917fd68228a ***

commit 2950fdf7423a404f6ebc691606d04917fd68228a
Author:     Tom Tromey <tromey@adacore.com>
AuthorDate: Wed Apr 8 14:33:35 2020 -0600
Commit:     Tom Tromey <tromey@adacore.com>
CommitDate: Wed Apr 8 14:47:58 2020 -0600

    Make windows_thread_info::name a unique_xmalloc_ptr
    
    This changes windows_thread_info::name to be a unique_xmalloc_ptr,
    removing some manual memory management.
    
    gdb/ChangeLog
    2020-04-08  Tom Tromey  <tromey@adacore.com>
    
            * windows-nat.c (handle_exception)
            (windows_nat_target::thread_name): Update.
            * nat/windows-nat.h (windows_thread_info): Remove destructor.
            <name>: Now unique_xmalloc_ptr.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6fce48c09a..a7ffec7876 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2020-04-08  Tom Tromey  <tromey@adacore.com>
+
+	* windows-nat.c (handle_exception)
+	(windows_nat_target::thread_name): Update.
+	* nat/windows-nat.h (windows_thread_info): Remove destructor.
+	<name>: Now unique_xmalloc_ptr.
+
 2020-04-08  Tom Tromey  <tromey@adacore.com>
 
 	* windows-nat.c (thread_rec)
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index 27fd7ed19d..543de895e7 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -32,11 +32,6 @@ struct windows_thread_info
   {
   }
 
-  ~windows_thread_info ()
-  {
-    xfree (name);
-  }
-
   DISABLE_COPY_AND_ASSIGN (windows_thread_info);
 
   /* The Win32 thread identifier.  */
@@ -77,7 +72,7 @@ struct windows_thread_info
   bool reload_context = false;
 
   /* The name of the thread, allocated by xmalloc.  */
-  char *name = nullptr;
+  gdb::unique_xmalloc_ptr<char> name;
 };
 
 #endif
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b7f21cb741..7fbc9a4d27 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1414,8 +1414,7 @@ handle_exception (struct target_waitstatus *ourstatus)
 	      if (thread_name_len > 0)
 		{
 		  thread_name.get ()[thread_name_len - 1] = '\0';
-		  xfree (named_thread->name);
-		  named_thread->name = thread_name.release ();
+		  named_thread->name = std::move (thread_name);
 		}
 	    }
 	  ourstatus->value.sig = GDB_SIGNAL_TRAP;
@@ -3394,7 +3393,7 @@ windows_nat_target::get_ada_task_ptid (long lwp, long thread)
 const char *
 windows_nat_target::thread_name (struct thread_info *thr)
 {
-  return thread_rec (thr->ptid.tid (), 0)->name;
+  return thread_rec (thr->ptid.tid (), 0)->name.get ();
 }
 
 


             reply	other threads:[~2020-04-24 22:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 22:41 gdb-buildbot [this message]
2020-04-24 22:41 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-04-24 23:02 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-04-24 23:31 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-04-24 23:52 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-04-25  0:28 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-04-25  0:53 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-25  4:30 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-04-26  3:25 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-04-29  7:26 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2950fdf7423a404f6ebc691606d04917fd68228a@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).