This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

[Fwd: Re: [nschelle@crosskeys.com: [GDB 4.18] sol-thread.c sol_detach_thread patch]]




Hi Neil, 

At first glance, your patch looks reasonable.  I'm working in
this part of GDB these days, so when I get a spare minute, I
will analyze your change more carefully, and hopefully drop it
in.
				Thanks,
				Michael Snyder

> Sender: gdb-patches-owner@sourceware.cygnus.com
> Delivered-To: mailing list gdb-patches@sourceware.cygnus.com
> From: Neil Schellenberger <nschelle@crosskeys.com>
> Date: Tue, 15 Jun 1999 23:06:35 -0400 (EDT)
> To: gdb-patches@sourceware.cygnus.com
> Subject: [GDB 4.18] sol-thread.c sol_detach_thread patch
> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs  Lucid
> Mime-Version: 1.0 (generated by tm-edit 7.108)
> Content-Type: text/plain; charset=US-ASCII
> Content-Length: 2199
> 
> Hi folks,
> 
> I had been having trouble convincing gdb 4.17 (and later) to detach
> from a multi-threaded process under Solaris 2.5.1.  It seemed that gdb
> always locked up as soon as the detach was executed.  Killing the
> debugger usually (always?) seemed to have the remedial effect of
> forcing a detach via the run-on-close on the procfs.
> 
> I finally found some time to figure out what was happening.  Seems
> that when sol_thread_detach is called, if the inferior_pid is set to a
> user thread id there will be serious grief printing the "detaching"
> message.  I won't bother with the details here.
> 
> The patch I provide below sets inferior_pid to the process pid before
> continuing.  I can't see any serious downside to losing the LWP
> information, but someone who really understands this stuff should
> decide if this is correct or not.
> 
> Of course, once I figured this all of this out, the workaround also
> became obvious: switch to a LWP before detaching.
> 
> Tue Jun 15 22:32:25 1999  Neil Schellenberger  <nschelle@crosskeys.com>
> 
>         * sol-thread.c (sol_thread_detach): Reset inferior_pid so that it
>         is definitely not a thread or LWP id.  The id is used by procfs
>         to_detach to generate the "detaching" message to the tty;
>         unfortunately it can get into an infinite loop inside
>         target_pid_to_str because solaris_pid_to_str cannot properly
>         decode user thread ids without the (just unpushed) sol_thread_ops
>         target.  This also provides better symmetry with the
>         inferior_pid manipulation done in sol_thread_attach.
> 
> *** sol-thread.c.orig   Tue Jun 15 22:05:31 1999
> - --- sol-thread.c        Tue Jun 15 22:06:51 1999
> *************** sol_thread_detach (args, from_tty)
> *** 487,492 ****
> - --- 487,493 ----
>        char *args;
>        int from_tty;
>   {
> +   inferior_pid = PIDGET (main_ph.pid);
>     unpush_target (&sol_thread_ops);
>     procfs_ops.to_detach (args, from_tty);
>   }
> 
> Regards,
> Neil
> 
> - --
> Neil Schellenberger             | Voice : (613) 599-2300 ext. 8445
> CrossKeys Systems Corporation   | Fax   : (613) 599-2330
> 350 Terry Fox Drive             | E-Mail: neil.schellenberger@crosskeys.com
> Kanata, Ont., Canada, K2K 2W5   | URL   : http://www.crosskeys.com/
>          "Bother", said the Borg, "we just assimilated Pooh."
> ------- End of forwarded message -------




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