This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [new patch] Re: [RFC] Fix for gdb crash in "info thread" after exec().


On Wed, May 28, 2008 at 8:26 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> A Wednesday 28 May 2008 00:23:25, Paul Pluzhnikov wrote:

>> The 'ecs->new_thread_event' is set to 0 while handling
>> TARGET_WAITKIND_EXECD, and add_thread() is not called for it.
>>
>
> Hmmmm, then, how is a thread getting to the thread list, with
> a ptid{pid,0,0} format?  It should never happen in linux native.
>
> Hmmmm2, I just tried it, and it does happen to me:

Sorry about it being dense. Yes, the exact same thing happens to
me once I revert your patch:

-      return pid_to_ptid (GET_PID (ptid));
+      return ptid;

> Hope you don't mind, but I've extended your test to test that case; the
> original bug is still covered, as I still get FAILures if
> linux-thread-db.c isn't fixed.
>
> What do you think?

Looks good to me, except the "second" parameter in the test is no
longer necessary, and there is an off-by-three bug in the allocation
of new_image:

--- gdb/testsuite/gdb.threads/execl.c.orig      2008-05-28
09:55:29.000000000 -0700
+++ gdb/testsuite/gdb.threads/execl.c   2008-05-28 10:03:04.000000000 -0700
@@ -27,11 +27,11 @@ main (int argc, char* argv[])
   pthread_create (&thread1, NULL, thread_function, NULL);
   pthread_create (&thread2, NULL, thread_function, NULL);

-  new_image = malloc (strlen (argv[0] + 1));
+  new_image = malloc (strlen (argv[0]) + 2);
   strcpy (new_image, argv[0]);
   strcat (new_image, "1");

-  if (execl (new_image, new_image, "second", NULL) == -1)  /* set
breakpoint here */
+  if (execl (new_image, new_image, NULL) == -1)  /* set breakpoint here */
     return 1;

   return 0;

Thanks,
-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]