From: Pierre Muller <muller@cerbere.u-strasbg.fr>
To: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] run > file for win32
Date: Wed, 20 Feb 2002 08:41:00 -0000 [thread overview]
Message-ID: <4.2.0.58.20020220171640.0168c2b0@ics.u-strasbg.fr> (raw)
In-Reply-To: <20020220161113.GH26603@redhat.com>
> >To sort the events and only handles those of the process that you want
> >to debug you use saw_create variable.
>
>IMO, the right way to handle this is to inspect the name of each process
>as it is created. That presents some interesting difficulties, however.
>It means that gdb has to understand how the shell will find the executable,
>however.
>
>Alternatively, gdb could detect the transition from shell -> program where
>the pid stays the same. Hmm. I think that would be the most foolproof.
But that is not the case... the windows pid does change when you pass from the
shell to the debuggee. My patch is even based on that change.
>I'll try to come up with some kind of solution to this that uses your method
>plus the above. It will probably take a couple of days, though.
As the win32 API clearly says that the lpImageName field of the
CREATE_PROCESS_DEBUG_EVENT can be null,
this is not an option.
May I suggest using GetFileInformationByHandle
function?
If you open the file in the child_create_inferior function
and leave it open until the program is killed or exits,
then the nFileIndexHigh,nFileIndexLow and dwVolumeSerialNumber
identifies uniquely the file.
Using the handle given by the CREATE_PROCESS_DEBUG_EVENT
and calling again GetFileInformationByHandle
should be able to check if the correct file is used.
Remarks:
-- if a different file (in some other dir) is found,
it will need to be handled somehow...
-- Even with my patch, there is still a
problem: the shell does not exit (because
there is one more ContinueDebugEvent needed to
the shell exit also, that is at least the feeling I had...)
So after runnig the same program 10 times, you have got 10 zomby shells.
-- I don't know if this is a problem with my configuration,
but the getenv("SHELL") returns NULL in _initialize_inftarg
while I do have SHELL=/bin/bash
in the bash that I use as shell...
-- This reminds me of one more question:
do all shells accept "exec" command and -c option ?
-- We need to be very careful about the different handles that I given
by the different events, failing to close some might
result in problems later.
Finally, wouldn't it be wise to set the default value of useshell to 0
until this problem is fixed?
Currently the variable is set to 1 in _initialize_inftarg
if a shell is found.
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99
next prev parent reply other threads:[~2002-02-20 16:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-16 2:03 Christopher Faylor
2002-02-20 1:58 ` Pierre Muller
2002-02-20 8:11 ` Christopher Faylor
2002-02-20 8:41 ` Pierre Muller [this message]
2002-02-20 8:58 ` Christopher Faylor
2002-02-20 10:42 ` muller
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=4.2.0.58.20020220171640.0168c2b0@ics.u-strasbg.fr \
--to=muller@cerbere.u-strasbg.fr \
--cc=gdb-patches@sources.redhat.com \
/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