PDA

View Full Version : Multi-Process Debugging in Delphi



vcldeveloper
یک شنبه 14 فروردین 1384, 04:47 صبح
چند روز قبل داشتم وبلاگ Chris Hesik رو می خوندم که این مطلب نظرم رو جلب کرد. خودم قبلا از وجود همچین امکانی در debugger دلفی خبر نداشتم، شما رو نمی دونم:
http://blogs.borland.com/chrishesik/archive/2004/09/15/1367.aspx

<div class="pagelayout">
<div class="leftcolumn">
<div class="singlepost">
<p dir="ltr">Project Groups </p>
<p dir="ltr">Although not required, using project groups make
multi-process debugging much more useful. If you have a project group
with more than one project in it, you can start a debug session for each
project in the project group. The key here is to make sure that all
projects in the project group are up to date. To do this, use the
“Compile all Projects” menu item in the Project menu. Once you do that,
you are ready to go. Start a debug session on the active project the way
you would normally start a debug session (Run, Step Over, Step Into,
etc...). Now, go back to the project manager and make a different
project active (the easiest way to do this is to double click the
project target). The next debugger command you issue will initiate a
second debug session -- if you click the green Run arrow toolbar button,
the second process will be run. You will now be debugging two processes
simultaneously.</p>
<p dir="ltr">Changing the Active Process </p>
<p dir="ltr">When you are debugging more than one process, only one of
the processes can be active at a time.&amp;nbsp;&amp;nbsp;All debugger commands&amp;nbsp;(things
like Step Over, Pause, Reset, Show Execution Point) operate on
the&amp;nbsp;active process. &amp;nbsp;There are several ways to change the active
process. One is to use the Project Manager, as described earlier. When
you activate a project in the Project Manager, if it is being debugged,
it's process will become the active process. Another way is to use the
drop down menu connected to the Run toolbar button (the green arrow).
When you click the little down arrow next to the button to drop&amp;nbsp;down the
menu, it will show a list of processes currently being debugged, as well
as any additional projects from the project group that can be debugged.
The active process will be shown in a bold font. Choose any other item
in the menu to set a new active process. </p>
<p dir="ltr">You can also change the active process using the debugger's
Thread Status View. Use the local menu item “Make Current” (or double
click) any non-current process to make that process active.&amp;nbsp;&amp;nbsp; </p>
<p dir="ltr">One additional note with regards to the active process.&amp;nbsp; If
any non-active process hits a breakpoint, gets notified of&amp;nbsp;an exception
or encounters any similar debug event, it will become the active
process.</p>
<p dir="ltr">“Multi-Process” vs. “Active-Process” Debugger Views</p>
<p dir="ltr">Several of the debugger views only operate on the active
process.&amp;nbsp;The Call Stack view, Watch List view, Local Variables View, CPU
view, and FPU&amp;nbsp;view&amp;nbsp;are the views that only operate on the current
process.&amp;nbsp; Actually to be precise, they all only operate on the current
thread within the current process.&amp;nbsp; </p>
<p dir="ltr">The Breakpoint List view, Thread Status view, Event Log
view and the Modules view, on the other hand, are multi-process views.&amp;nbsp;
They will show information pertaining to all processes loaded in the
debugger, rather than just the active process.&amp;nbsp; For instance, if you
have more than one process loaded in the debugger, the Thread Status
view will show all threads in all processes.&amp;nbsp; The Modules view will show
all the modules that are loaded in each process.&amp;nbsp; The Event Log view
will show all debug events generated by all loaded processes.</p>
<p dir="ltr">“Load Process” and “Attach to Process“</p>
<p dir="ltr">In addition to using a Project Group to manage
multi-process debugging, you can also use the Run Parameters dialog (or
Load Process dialog if you're fortunate enough to be using the
Diamondback preview) to load additional processes into the debugger.&amp;nbsp;
Simply bring up the dialog and specify a process that you want to debug
and click the Load button.&amp;nbsp; Do this more than once and you are debugging
multiple processes!</p>
<p dir="ltr">You can also initiate a multi-process debugging session
using the Attach to Process dialog.&amp;nbsp; You can use this dialog to attach
to as many processes as you like.</p>
<p dir="ltr">Additional&amp;nbsp;Note</p>
<p dir="ltr">One other question I received was “Is there a limit to the
number of processes I can debug?“.&amp;nbsp; You'll only be limited by your
available system resources.&amp;nbsp; The IDE does nothing to limit the number of
processes you can debug, but keep in mind that symbol tables tend to be
memory-hogs, so if you have a large project group or lots of processes
loaded in the debugger at the same time, you're likely to run into some
limitations.&amp;nbsp; FWIW, this is one of the performance issues we hope to
improve on before we unleash Diamonback into the wild.</div>
</div>
</div>