Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Subject: Re: [RFC] Fix for gdb crash in "info thread" after exec().
Date: Wed, 28 May 2008 07:10:00 -0000	[thread overview]
Message-ID: <20080527190702.6956D3A6952@localhost> (raw)
In-Reply-To: <8ac60eac0805201048p46413531p3691bf7ec6a732dd@mail.gmail.com>

Ping.

http://sourceware.org/ml/gdb-patches/2008-05/msg00386.html

Also re-sending the patch as inline plain-text.

--
Paul Pluzhnikov

ChangeLog:
2008-05-12  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb/linux-thread-dl.c (check_for_thread_db): reinitialize
	thread list after exec().

testsuite/ChangeLog:
2008-05-12  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.threads/execl.c, gdb.threads/execl.exp: Add test for
	"info threads" after exec.


Index: gdb/linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 linux-thread-db.c
--- gdb/linux-thread-db.c	4 May 2008 14:12:34 -0000	1.42
+++ gdb/linux-thread-db.c	13 May 2008 01:28:48 -0000
@@ -613,6 +613,10 @@ check_for_thread_db (void)
       push_target (&thread_db_ops);
       using_thread_db = 1;
 
+      /* Existing entries in thread_list might not have thread_info.private
+	 set, so clear it out.  */
+      init_thread_list ();
+
       enable_thread_event_reporting ();
       thread_db_find_new_threads ();
       break;
Index: gdb/testsuite/gdb.threads/execl.c
===================================================================
RCS file: gdb/testsuite/gdb.threads/execl.c
diff -N gdb/testsuite/gdb.threads/execl.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/testsuite/gdb.threads/execl.c	13 May 2008 01:28:48 -0000
@@ -0,0 +1,12 @@
+/* Test handling thread control across an execl.  */
+
+#include <unistd.h>
+
+int
+main (int argc, char* argv[])
+{
+  if (argc == 1)
+    execl (argv[0], argv[0], "second", NULL);
+
+  return 0;
+}
Index: gdb/testsuite/gdb.threads/execl.exp
===================================================================
RCS file: gdb/testsuite/gdb.threads/execl.exp
diff -N gdb/testsuite/gdb.threads/execl.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/testsuite/gdb.threads/execl.exp	13 May 2008 01:28:48 -0000
@@ -0,0 +1,48 @@
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# Test handling of threads across an execl.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set testfile "execl"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+runto_main
+
+# When continuing from this point we'll hit the breakpoint in main()
+# again, this time in the exec'd process.
+gdb_test "continue" ".*Breakpoint 1, main.*" \
+    "continue across exec"
+
+gdb_test "info threads" ".*" "info threads after exec"
+
+gdb_test "continue" ".*Program exited normally\\." \
+    "continue to end"


  reply	other threads:[~2008-05-27 19:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 22:12 Paul Pluzhnikov
2008-05-28  7:10 ` Paul Pluzhnikov [this message]
2008-05-28 15:27   ` Pedro Alves
2008-05-28 17:10     ` Paul Pluzhnikov
2008-05-28 21:25       ` [new patch] " Pedro Alves
2008-05-28 21:34         ` Paul Pluzhnikov
2008-05-28 22:24           ` Pedro Alves
2008-06-05  1:16             ` Paul Pluzhnikov
2008-06-05 17:23               ` Michael Snyder
2008-06-05 20:43                 ` Daniel Jacobowitz
2008-06-05 21:07                   ` Pedro Alves
2008-05-28 17:49     ` Paul Pluzhnikov
  -- strict thread matches above, loose matches on Subject: below --
2008-05-13 18:07 Paul Pluzhnikov

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=20080527190702.6956D3A6952@localhost \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@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