This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [PATCH] remote_detach() and inferior_pid
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: [PATCH] remote_detach() and inferior_pid
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Thu, 17 Feb 2000 16:10:14 -0500 (EST)
- Cc: Jim Kingdon <kingdon at redhat dot com>, gdb-patches at sourceware dot cygnus dot com
- References: <14505.29243.656290.516276@kwikemart.cygnus.com><bd7pynspv.fsf@rtl.cygnus.com><38ABADEC.F0320CCB@cygnus.com>
Andrew Cagney writes:
> Jim Kingdon wrote:
> >
> > > This happens because remote_detach() (and remote_async_detach()) do
> > > not reset inferior_pid to 0. Is there a reason for this being this
> > > way?
> >
> > Setting inferior_pid to 0 sounds good. I'm not completely sure why
> > the *_detach functions don't just call generic_mourn_inferior.
>
> Would that kill the target? Dig dig dig. Nope!
>
> Yes, generic_mourn_inferior looks to be doing the correct thing - namely
> pulling breakpoints and the like.
>
> Andrew
Context: the above are answers to the posting below which went
originally to the wrong list:
Elena Zannoni wrote:
>
> After a 'detach' from a remote target, if a file command is
> done, gdb errors out in symbol_file_command(), because it calls
> reinit_frame_cache(), which in turn calls get_current_frame() when
> there is no stack. (The error message comes from get_current_frame()).
>
> This happens because remote_detach() (and remote_async_detach()) do
> not reset inferior_pid to 0. Is there a reason for this being this
> way?
>
> OK to check in the following patch?
>
> Thanks
> Elena
>
> Index: remote.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/remote.c,v
> retrieving revision 1.4
> diff -c -r1.4 remote.c
> *** remote.c 2000/02/09 08:52:47 1.4
> --- remote.c 2000/02/15 15:18:07
> ***************
> *** 2115,2120 ****
> --- 2115,2121 ----
> remote_send (buf, PBUFSIZ);
>
> pop_target ();
> + inferior_pid = 0;
> if (from_tty)
> puts_filtered ("Ending remote debugging.\n");
>
> ***************
> *** 2140,2145 ****
> --- 2141,2147 ----
> SERIAL_ASYNC (remote_desc, NULL, 0);
>
> pop_target ();
> + inferior_pid = 0;
> if (from_tty)
> puts_filtered ("Ending remote debugging.\n");
> }
OK, all in agreement then. I'll add a generic_mourn_inferior() call in
there. New patch follows. OK to check in?
Elena
Index: remote.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/remote.c,v
retrieving revision 1.269
diff -c -r1.269 remote.c
*** remote.c 2000/02/02 07:47:45 1.269
--- remote.c 2000/02/17 21:06:46
***************
*** 2124,2129 ****
--- 2124,2130 ----
remote_send (buf, PBUFSIZ);
pop_target ();
+ generic_mourn_inferior ();
if (from_tty)
puts_filtered ("Ending remote debugging.\n");
***************
*** 2149,2154 ****
--- 2150,2156 ----
SERIAL_ASYNC (remote_desc, NULL, 0);
pop_target ();
+ generic_mourn_inferior ();
if (from_tty)
puts_filtered ("Ending remote debugging.\n");
}