public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gdb] fix-dup-patch: - Fix gdbserver for threaded applications and recent glibc (BZ 328021).
@ 2026-07-23 18:29 Jan Kratochvil
  0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2026-07-23 18:29 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/gdb
Branch : fix-dup-patch
Commit : 84f82bf43b1fc1c9081e07e1c0bbf5d60bd8ae51
Author : Jan Kratochvil <jkratoch@fedoraproject.org>
Date   : 2007-10-12T09:20:08+00:00
Stats  : +85/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/84f82bf43b1fc1c9081e07e1c0bbf5d60bd8ae51?branch=fix-dup-patch

Log:
- Fix gdbserver for threaded applications and recent glibc (BZ 328021).

---
diff --git a/gdb-6.6-upstream.patch b/gdb-6.6-upstream.patch
index c41bae4..f7757c2 100644
--- a/gdb-6.6-upstream.patch
+++ b/gdb-6.6-upstream.patch
@@ -1163,3 +1163,84 @@ http://sourceware.org/ml/binutils/2007-08/msg00296.html
        :
      else
        MAKEINFO="$MISSING makeinfo"
+
+
+
+https://bugzilla.redhat.com/show_bug.cgi?id=328021
+
+2007-06-27  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* thread-db.c (thread_db_find_new_threads): Add prototype.
+	(thread_db_create_event): Check for the main thread before adding
+	a new thread.
+	(maybe_attach_thread): Only enable event reporting if TID == 0.
+	(thread_db_get_tls_address): Check for new threads.
+
+--- ./gdb/gdbserver/thread-db.c	9 Jan 2007 17:59:08 -0000	1.9
++++ ./gdb/gdbserver/thread-db.c	27 Jun 2007 11:52:02 -0000	1.10
+@@ -41,6 +41,7 @@ static struct ps_prochandle proc_handle;
+ /* Connection to the libthread_db library.  */
+ static td_thragent_t *thread_agent;
+ 
++static void thread_db_find_new_threads (void);
+ static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data);
+ 
+ static char *
+@@ -135,6 +136,8 @@ thread_db_create_event (CORE_ADDR where)
+   td_event_msg_t msg;
+   td_err_e err;
+   struct inferior_linux_data *tdata;
++  struct thread_info *inferior;
++  struct process_info *process;
+ 
+   if (debug_threads)
+     fprintf (stderr, "Thread creation event.\n");
+@@ -150,6 +153,14 @@ thread_db_create_event (CORE_ADDR where)
+     fprintf (stderr, "thread getmsg err: %s\n",
+ 	     thread_db_err_str (err));
+ 
++  /* If we do not know about the main thread yet, this would be a good time to
++     find it.  We need to do this to pick up the main thread before any newly
++     created threads.  */
++  inferior = (struct thread_info *) all_threads.head;
++  process = get_thread_process (inferior);
++  if (process->thread_known == 0)
++    thread_db_find_new_threads ();
++
+   /* msg.event == TD_EVENT_CREATE */
+ 
+   find_new_threads_callback (msg.th_p, NULL);
+@@ -232,8 +243,24 @@ maybe_attach_thread (const td_thrhandle_
+     {
+       inferior = (struct thread_info *) all_threads.head;
+       process = get_thread_process (inferior);
++
+       if (process->thread_known == 0)
+ 	{
++	  /* If the new thread ID is zero, a final thread ID will be
++	     available later.  Do not enable thread debugging yet.  */
++	  if (ti_p->ti_tid == 0)
++	    {
++	      err = td_thr_event_enable (th_p, 1);
++	      if (err != TD_OK)
++		error ("Cannot enable thread event reporting for %d: %s",
++		       ti_p->ti_lid, thread_db_err_str (err));
++	      return;
++	    }
++
++	  if (process->lwpid != ti_p->ti_lid)
++	    fatal ("PID mismatch!  Expected %ld, got %ld",
++		   (long) process->lwpid, (long) ti_p->ti_lid);
++
+ 	  /* Switch to indexing the threads list by TID.  */
+ 	  change_inferior_id (&all_threads, ti_p->ti_tid);
+ 	  goto found;
+@@ -332,6 +359,8 @@ thread_db_get_tls_address (struct thread
+ 
+   process = get_thread_process (thread);
+   if (!process->thread_known)
++    thread_db_find_new_threads ();
++  if (!process->thread_known)
+     return TD_NOTHR;
+ 
+   /* Note the cast through uintptr_t: this interface only works if

diff --git a/gdb.spec b/gdb.spec
index 2c16ef1..5ba7c71 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -11,7 +11,7 @@ Name: gdb
 Version: 6.6
 
 # The release always contains a leading reserved number, start it at 1.
-Release: 33%{?dist}
+Release: 34%{?dist}
 
 License: GPL
 Group: Development/Debuggers
@@ -697,6 +697,9 @@ fi
 # don't include the files in include, they are part of binutils
 
 %changelog
+* Fri Oct 12 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-34
+- Fix gdbserver for threaded applications and recent glibc (BZ 328021).
+
 * Tue Oct  9 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-33
 - Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64).
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-23 18:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23 18:29 [rpms/gdb] fix-dup-patch: - Fix gdbserver for threaded applications and recent glibc (BZ 328021) Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox