Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Stub-Contents.html
blob3c46ddc32727c9e6f67e601e2c41843838a561cd
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Stub%20Contents">Stub Contents</a>,
13 Next:<a rel="next" accesskey="n" href="Bootstrapping.html#Bootstrapping">Bootstrapping</a>,
14 Up:<a rel="up" accesskey="u" href="remote-stub.html#remote%20stub">remote stub</a>
15 <hr><br>
16 </div>
18 <h4 class="subsection">What the stub can do for you</h4>
20 <p>The debugging stub for your architecture supplies these three
21 subroutines:
23 <dl>
24 <dt><code>set_debug_traps</code>
25 <dd>This routine arranges for <code>handle_exception</code> to run when your
26 program stops. You must call this subroutine explicitly near the
27 beginning of your program.
29 <br><dt><code>handle_exception</code>
30 <dd>This is the central workhorse, but your program never calls it
31 explicitly--the setup code arranges for <code>handle_exception</code> to
32 run when a trap is triggered.
34 <p><code>handle_exception</code> takes control when your program stops during
35 execution (for example, on a breakpoint), and mediates communications
36 with GDB on the host machine. This is where the communications
37 protocol is implemented; <code>handle_exception</code> acts as the GDB
38 representative on the target machine. It begins by sending summary
39 information on the state of your program, then continues to execute,
40 retrieving and transmitting any information GDB needs, until you
41 execute a GDB command that makes your program resume; at that point,
42 <code>handle_exception</code> returns control to your own code on the target
43 machine.
45 <br><dt><code>breakpoint</code>
46 <dd>Use this auxiliary subroutine to make your program contain a
47 breakpoint. Depending on the particular situation, this may be the only
48 way for GDB to get control. For instance, if your target
49 machine has some sort of interrupt button, you won't need to call this;
50 pressing the interrupt button transfers control to
51 <code>handle_exception</code>--in effect, to GDB. On some machines,
52 simply receiving characters on the serial port may also trigger a trap;
53 again, in that situation, you don't need to call <code>breakpoint</code> from
54 your own program--simply running <code>target remote</code> from the host
55 GDB session gets control.
57 <p>Call <code>breakpoint</code> if none of these is true, or if you simply want
58 to make certain your program stops at a predetermined point for the
59 start of your debugging session.
60 </dl>
62 </body></html>