Re: How to connect to children process
- From: "Oleg Starodumov" <com-dot-debuginfo-at-oleg>
- Date: Mon, 5 Feb 2007 12:11:15 +0200
Is the main problem that the debugger keeps symbols file loaded
(and thus locked) even after the dll has been unloaded by the process?
AFAIK that's how VS2003 debugger works, but WinDbg should usually
unload symbols completely (and unlock the symbols file) after the dll
has been unloaded by the debuggee process.
Also, when setting breakpoint on the needed function (in WinDbg),
try yourdll!yourfunc notation (to avoid dependency on source line numbers
that can change after dll rebuild).
Or have I misunderstood the problem again?
Oleg
"Metek" <Metek@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E105C2CC-F9FB-4A77-B9AB-78BE9C117154@xxxxxxxxxxxxxxxx
Hi Oleg,news:E918DCE4-E723-4341-A75A-6A7CCAEB160E@xxxxxxxxxxxxxxxx
I very much appreciate your time and any help you provide to me.
Sorry if my message was not clear. I will try again.
Process "A" from time to time starts process "B" (several times in one debug
session) and process "B" dynamically links to DLL "C". I'm creating several
DLLs "C".
Now debug procedure is as follow:
1. I'm creating code with int 3 in place that I'm willing debug.
2. Software works on remote PC starting in Kernel mode debugger
with WinDbg and VS2003 running on separate host PC
3. When execution stops on int 3, I'm loading symbols (.reload /user)
and do debug and corrections in code
4. Then I break remote machine (Ctrl+Break) and reload symbols again
(.reload /user) for unlock .PDB file
5. Then project is rebuild in VS 2003 and target DLL is copied to remote PC
The above procedure is too much time consuming in my case. Ideally I would
like:
1. Debug on the same platform (and ideally whithin of VS 2003)
Thanks to your help I'm able now using WinDbg on local machine.
2. Get symbols load automatically
3. Get symbols unlock automatically
4. Get possibility to set break points on particular function as usually
using
function symbol instead of using embedded int 3.
I'm not sure if VS debugger provides any API, but WinDbg certainly does.
Question: Do you know how to add code (and which code to add) to DLL for get
DLL symbols reload at each DLL startup, break-points set in VS 2003 applied
to started instance and DLL PDB unlocked for write.
"Oleg Starodumov" wrote:
Hi Al,
I'm sorry but it looks like I can't understand what you are trying to do.
Could you please try to describe the whole sequence of actions
you are currently doing, and how/what you would like to be improved there?
Oleg
"Metek" <Metek@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
Hi Oleg,
Thank you very much for the hint. The WinDbg approach is clear for me.
I also read your article - it's really very interesting and helpful - thank
you very much. I have another small question to you related to my debug
situation.
For your understanding: I have neither source nor symbols for process "A"
and "B". My task is to create several (about 200) DLLs "C". Process "A" is
almost always working (however this is a User process in Administrative
account).
Because of huge number of DLLs, I need to decrease amount of manual
operations to minimum.
DLLs are created in VS2003 with huge amount of tracings and breaks to
debugger at any place that can require debug. However connection to debugger
is time consuming. Right now I'm using remote PC and WinDbg started in kernel
mode. This mode is not ideal since VS2003 and WinDbg always try to lock DLL
.PDB file and I have to reload symbols to WinDbg after each rebuild. I would
prefer to use VS debugger or WinDbg on local PC, if possible.
I'm looking for the method that allow to start debugger and load proper
symbols for DLL automatically (either at DLL WinMain or at first break). It
could be some code added to checked version of DLL and dealing with Debug API
or any kind of script in debugger.
Do you have any experience with such kind of tasks? Can you indicate any
sample of code that doing similar task?
With best regards,
Al
"Oleg Starodumov" wrote:
I have following debug situation:
Process "A" randomly starts process "B". Process "B" works for short (2-5
sec) time and during execution links dynamically to DLL "C". I debug DLL "C"
and need catch debug tracing from it.
The problem is that I cannot start process "B" in debugger (since I do not
start it directly) and cannot attach to running process since ptocess "B"
appears in the list of running process for very short time.
Any recommendation how configure Visual Studio debugger and/or WinDbg will
be highly appreciated.
There are many ways to achieve it. The easiest but intrusive way is to
suspend the dll "C" temporarily while it is called (using MessageBox or Sleep)
and use this timeout to attach debugger. DebugBreak and the like can also
be used to break into that process.
If you don't want to modify the code to be able to debug, the easiest approach
is with WinDbg. Attach debugger to process "A" and use '.childdbg 1' command
to enable debugging of child processes. After this command, WinDbg will
automatically start debugging any process launched by process "A".
Visual Studio does not support .childdbg-like approach, but similar effect
still can be achieved e.g. using IFEO approach. You can find more details about it here:
http://www.debuginfo.com/articles/debugstartup.html
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
.
- Follow-Ups:
- Re: How to connect to children process
- From: Metek
- Re: How to connect to children process
- References:
- Re: How to connect to children process
- From: Oleg Starodumov
- Re: How to connect to children process
- From: Metek
- Re: How to connect to children process
- From: Oleg Starodumov
- Re: How to connect to children process
- From: Metek
- Re: How to connect to children process
- Prev by Date: Visual Studio busy! any suggestions??
- Next by Date: Re: Visual Studio busy! any suggestions??
- Previous by thread: Re: How to connect to children process
- Next by thread: Re: How to connect to children process
- Index(es):
Relevant Pages
|