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: [RFA] windows: do not crash if inferior


On Wed, Jan 20, 2010 at 12:37:46PM -0500, Christopher Faylor wrote:
>On Wed, Jan 20, 2010 at 11:15:49AM -0500, Christopher Faylor wrote:
>>On Tue, Jan 19, 2010 at 01:22:27PM +0400, Joel Brobecker wrote:
>>>> 2010-01-13  gingold  <gingold@adacore.com>
>>>> 
>>>>         * windows-nat.c (do_initial_windows_stuff): Call error() if the
>>>>         inferior doesn't exist anymore.
>>>
>>>Just some thoughts, as Chris usually reviews Windows patches...
>>>
>>>I don't see a "generic" way of dealing with this situation.  So the type
>>>of approach you took (returning early from do_initial_windows_stuff)
>>>seems to be the only approach I can see. I was initially a little
>>>reluctant about throwing an error: As far as I can tell from the code,
>>>the debugger should have already printed an error message such as
>>>"Inferior exited with code ..." (is that correct?) - and so an extra
>>>"inferior exited early" message could be considered superfluous. However,
>>>if you do not error-out now, core GDB will assume that target_create_inferior
>>>succeeded and thus possibly do something unexpected as well.
>>>
>>>Bottom line - I cannot propose a better approach short of revamping
>>>a bit the target_create_inferior routine to add error-handling,
>>>I think the patch is fine.
>>>
>>>I would suggest a different wording, to explain that we were trying
>>>to run the program when the error occured.
>>>
>>>    error (_("cannot run program, inferior exited prematurely during startup"));
>>
>>Does inferior_thread really need the assert()?  If not, we could jsut test
>>tp for NULL.
>>
>>Otherwise, I agree with Joel's assessment.
>
>Actually, how about something like this instead?  I used the same wording as fork-child.c
>after seeing Pedro's note.
>
>cgf
>
>Index: windows-nat.c
>===================================================================
>RCS file: /cvs/src/src/gdb/windows-nat.c,v
>retrieving revision 1.196.4.1
>diff -d -u -r1.196.4.1 windows-nat.c
>--- windows-nat.c	30 Sep 2009 07:40:10 -0000	1.196.4.1
>+++ windows-nat.c	20 Jan 2010 17:35:47 -0000
>@@ -41,6 +41,7 @@
> #include <psapi.h>
> #ifdef __CYGWIN__
> #include <sys/cygwin.h>
>+#include <cygwin/version.h>
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sorry, that part is not needed.

cgf


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