* utils.c (quit): Also call gdb_flush on standard output and error.
[deliverable/binutils-gdb.git] / gdb / doc / remote.texi
1 @c -*- Texinfo -*-
2 @c Copyright (c) 1990 1991 1992 1993 Free Software Foundation, Inc.
3 @c This file is part of the source for the GDB manual.
4 @c This text diverted to "Remote Debugging" section in general case;
5 @c however, if we're doing a manual specifically for one of these, it
6 @c belongs up front (in "Getting In and Out" chapter).
7
8 @ifset REMOTESTUB
9 @node Remote Serial
10 @subsection The @value{GDBN} remote serial protocol
11
12 @cindex remote serial debugging, overview
13 To debug a program running on another machine (the debugging
14 @dfn{target} machine), you must first arrange for all the usual
15 prerequisites for the program to run by itself. For example, for a C
16 program, you need
17
18 @enumerate
19 @item
20 A startup routine to set up the C runtime environment; these usually
21 have a name like @file{crt0}. The startup routine may be supplied by
22 your hardware supplier, or you may have to write your own.
23
24 @item
25 You probably need a C subroutine library to support your program's
26 subroutine calls, notably managing input and output.
27
28 @item
29 A way of getting your program to the other machine---for example, a
30 download program. These are often supplied by the hardware
31 manufacturer, but you may have to write your own from hardware
32 documentation.
33 @end enumerate
34
35 The next step is to arrange for your program to use a serial port to
36 communicate with the machine where @value{GDBN} is running (the @dfn{host}
37 machine). In general terms, the scheme looks like this:
38
39 @table @emph
40 @item On the host,
41 @value{GDBN} already understands how to use this protocol; when everything
42 else is set up, you can simply use the @samp{target remote} command
43 (@pxref{Targets,,Specifying a Debugging Target}).
44
45 @item On the target,
46 you must link with your program a few special-purpose subroutines that
47 implement the @value{GDBN} remote serial protocol. The file containing these
48 subroutines is called a @dfn{debugging stub}.
49
50 @ifset GDBSERVER
51 On certain remote targets, you can use an auxiliary program
52 @code{gdbserver} instead of linking a stub into your program.
53 @xref{Server,,Using the @code{gdbserver} program}, for details.
54 @end ifset
55 @end table
56
57 The debugging stub is specific to the architecture of the remote
58 machine; for example, use @file{sparc-stub.c} to debug programs on
59 @sc{sparc} boards.
60
61 @cindex remote serial stub list
62 These working remote stubs are distributed with @value{GDBN}:
63
64 @table @code
65 @item sparc-stub.c
66 @kindex sparc-stub.c
67 For @sc{sparc} architectures.
68
69 @item m68k-stub.c
70 @kindex m68k-stub.c
71 @cindex Motorola 680x0
72 @cindex m680x0
73 For Motorola 680x0 architectures.
74
75 @item i386-stub.c
76 @kindex i386-stub.c
77 @cindex Intel
78 @cindex i386
79 For Intel 386 and compatible architectures.
80 @end table
81
82 The @file{README} file in the @value{GDBN} distribution may list other
83 recently added stubs.
84
85 @menu
86 * Stub Contents:: What the stub can do for you
87 * Bootstrapping:: What you must do for the stub
88 * Debug Session:: Putting it all together
89 * Protocol:: Outline of the communication protocol
90 @ifset GDBSERVER
91 * Server:: Using the `gdbserver' program
92 @end ifset
93 @end menu
94
95 @node Stub Contents
96 @subsubsection What the stub can do for you
97
98 @cindex remote serial stub
99 The debugging stub for your architecture supplies these three
100 subroutines:
101
102 @table @code
103 @item set_debug_traps
104 @kindex set_debug_traps
105 @cindex remote serial stub, initialization
106 This routine arranges for @code{handle_exception} to run when your
107 program stops. You must call this subroutine explicitly near the
108 beginning of your program.
109
110 @item handle_exception
111 @kindex handle_exception
112 @cindex remote serial stub, main routine
113 This is the central workhorse, but your program never calls it
114 explicitly---the setup code arranges for @code{handle_exception} to
115 run when a trap is triggered.
116
117 @code{handle_exception} takes control when your program stops during
118 execution (for example, on a breakpoint), and mediates communications
119 with @value{GDBN} on the host machine. This is where the communications
120 protocol is implemented; @code{handle_exception} acts as the @value{GDBN}
121 representative on the target machine; it begins by sending summary
122 information on the state of your program, then continues to execute,
123 retrieving and transmitting any information @value{GDBN} needs, until you
124 execute a @value{GDBN} command that makes your program resume; at that point,
125 @code{handle_exception} returns control to your own code on the target
126 machine.
127
128 @item breakpoint
129 @cindex @code{breakpoint} subroutine, remote
130 Use this auxiliary subroutine to make your program contain a
131 breakpoint. Depending on the particular situation, this may be the only
132 way for @value{GDBN} to get control. For instance, if your target
133 machine has some sort of interrupt button, you won't need to call this;
134 pressing the interrupt button will transfer control to
135 @code{handle_exception}---in effect, to @value{GDBN}. On some machines,
136 simply receiving characters on the serial port may also trigger a trap;
137 again, in that situation, you don't need to call @code{breakpoint} from
138 your own program---simply running @samp{target remote} from the host
139 @value{GDBN} session will get control.
140
141 Call @code{breakpoint} if none of these is true, or if you simply want
142 to make certain your program stops at a predetermined point for the
143 start of your debugging session.
144 @end table
145
146 @node Bootstrapping
147 @subsubsection What you must do for the stub
148
149 @cindex remote stub, support routines
150 The debugging stubs that come with @value{GDBN} are set up for a particular
151 chip architecture, but they have no information about the rest of your
152 debugging target machine.
153
154 First of all you need to tell the stub how to communicate with the
155 serial port.
156
157 @table @code
158 @item int getDebugChar()
159 @kindex getDebugChar
160 Write this subroutine to read a single character from the serial port.
161 It may be identical to @code{getchar} for your target system; a
162 different name is used to allow you to distinguish the two if you wish.
163
164 @item void putDebugChar(int)
165 @kindex putDebugChar
166 Write this subroutine to write a single character to the serial port.
167 It may be identical to @code{putchar} for your target system; a
168 different name is used to allow you to distinguish the two if you wish.
169 @end table
170
171 If you want @value{GDBN} to be able to stop your program while it is
172 running, you need to use an interrupt-driven serial driver, and arrange
173 for it to stop when it receives a control C character (getting it to
174 return the proper status to GDB probably requires changes to the
175 standard stub; one quick and dirty way is to just execute a breakpoint
176 instruction. @value{GDBN} will return a SIGTRAP instead of a SIGINT).
177 That is the character which @value{GDBN} uses to tell the remote system
178 to stop.
179
180 Other routines you need to supply are:
181
182 @table @code
183 @item void exceptionHandler (int @var{exception_number}, void *@var{exception_address})
184 @kindex exceptionHandler
185 Write this function to install @var{exception_address} in the exception
186 handling tables. You need to do this because the stub does not have any
187 way of knowing what the exception handling tables on your target system
188 are like (for example, the processor's table might be in @sc{rom},
189 containing entries which point to a table in @sc{ram}).
190 @var{exception_number} is the exception number which should be changed;
191 its meaning is architecture-dependent (for example, different numbers
192 might represent divide by zero, misaligned access, etc). When this
193 exception occurs, control should be transferred directly to
194 @var{exception_address}, and the processor state (stack, registers,
195 etc.) should be just as it is when a processor exception occurs. So if
196 you want to use a jump instruction to reach @var{exception_address}, it
197 should be a simple jump, not a jump to subroutine.
198
199 For the 386, @var{exception_address} should be installed as an interrupt
200 gate so that interrupts are masked while the handler runs. The gate
201 should be at privilege level 0 (the most privileged level). The
202 @sc{sparc} and 68k stubs are able to mask interrupts themself without
203 help from @code{exceptionHandler}.
204
205 @item void flush_i_cache()
206 @kindex flush_i_cache
207 Write this subroutine to flush the instruction cache, if any, on your
208 target machine. If there is no instruction cache, this subroutine may
209 be a no-op.
210
211 On target machines that have instruction caches, @value{GDBN} requires this
212 function to make certain that the state of your program is stable.
213 @end table
214
215 @noindent
216 You must also make sure this library routine is available:
217
218 @table @code
219 @item void *memset(void *, int, int)
220 @kindex memset
221 This is the standard library function @code{memset} that sets an area of
222 memory to a known value. If you have one of the free versions of
223 @code{libc.a}, @code{memset} can be found there; otherwise, you must
224 either obtain it from your hardware manufacturer, or write your own.
225 @end table
226
227 If you do not use the GNU C compiler, you may need other standard
228 library subroutines as well; this will vary from one stub to another,
229 but in general the stubs are likely to use any of the common library
230 subroutines which @code{gcc} generates as inline code.
231
232
233 @node Debug Session
234 @subsubsection Putting it all together
235
236 @cindex remote serial debugging summary
237 In summary, when your program is ready to debug, you must follow these
238 steps.
239
240 @enumerate
241 @item
242 Make sure you have the supporting low-level routines
243 (@pxref{Bootstrapping,,What you must do for the stub}):
244 @display
245 @code{getDebugChar}, @code{putDebugChar},
246 @code{flush_i_cache}, @code{memset}, @code{exceptionHandler}.
247 @end display
248
249 @item
250 Insert these lines near the top of your program:
251
252 @example
253 set_debug_traps();
254 breakpoint();
255 @end example
256
257 @item
258 For the 680x0 stub only, you need to provide a variable called
259 @code{exceptionHook}. Normally you just use
260
261 @example
262 void (*exceptionHook)() = 0;
263 @end example
264
265 but if before calling @code{set_debug_traps}, you set it to point to a
266 function in your program, that function is called when
267 @code{@value{GDBN}} continues after stopping on a trap (for example, bus
268 error). The function indicated by @code{exceptionHook} is called with
269 one parameter: an @code{int} which is the exception number.
270
271 @item
272 Compile and link together: your program, the @value{GDBN} debugging stub for
273 your target architecture, and the supporting subroutines.
274
275 @item
276 Make sure you have a serial connection between your target machine and
277 the @value{GDBN} host, and identify the serial port used for this on the host.
278
279 @item
280 @c The "remote" target now provides a `load' command, so we should
281 @c document that. FIXME.
282 Download your program to your target machine (or get it there by
283 whatever means the manufacturer provides), and start it.
284
285 @item
286 To start remote debugging, run @value{GDBN} on the host machine, and specify
287 as an executable file the program that is running in the remote machine.
288 This tells @value{GDBN} how to find your program's symbols and the contents
289 of its pure text.
290
291 @cindex serial line, @code{target remote}
292 Then establish communication using the @code{target remote} command.
293 Its argument specifies how to communicate with the target
294 machine---either via a devicename attached to a direct serial line, or a
295 TCP port (usually to a terminal server which in turn has a serial line
296 to the target). For example, to use a serial line connected to the
297 device named @file{/dev/ttyb}:
298
299 @example
300 target remote /dev/ttyb
301 @end example
302
303 @cindex TCP port, @code{target remote}
304 To use a TCP connection, use an argument of the form
305 @code{@var{host}:port}. For example, to connect to port 2828 on a
306 terminal server named @code{manyfarms}:
307
308 @example
309 target remote manyfarms:2828
310 @end example
311 @end enumerate
312
313 Now you can use all the usual commands to examine and change data and to
314 step and continue the remote program.
315
316 To resume the remote program and stop debugging it, use the @code{detach}
317 command.
318
319 @cindex interrupting remote programs
320 @cindex remote programs, interrupting
321 Whenever @value{GDBN} is waiting for the remote program, if you type the
322 interrupt character (often @key{C-C}), @value{GDBN} attempts to stop the
323 program. This may or may not succeed, depending in part on the hardware
324 and the serial drivers the remote system uses. If you type the
325 interrupt character once again, @value{GDBN} displays this prompt:
326
327 @example
328 Interrupted while waiting for the program.
329 Give up (and stop debugging it)? (y or n)
330 @end example
331
332 If you type @kbd{y}, @value{GDBN} abandons the remote debugging session.
333 (If you decide you want to try again later, you can use @samp{target
334 remote} again to connect once more.) If you type @kbd{n}, @value{GDBN}
335 goes back to waiting.
336
337 @node Protocol
338 @subsubsection Outline of the communication protocol
339
340 @cindex debugging stub, example
341 @cindex remote stub, example
342 @cindex stub example, remote debugging
343 The stub files provided with @value{GDBN} implement the target side of the
344 communication protocol, and the @value{GDBN} side is implemented in the
345 @value{GDBN} source file @file{remote.c}. Normally, you can simply allow
346 these subroutines to communicate, and ignore the details. (If you're
347 implementing your own stub file, you can still ignore the details: start
348 with one of the existing stub files. @file{sparc-stub.c} is the best
349 organized, and therefore the easiest to read.)
350
351 However, there may be occasions when you need to know something about
352 the protocol---for example, if there is only one serial port to your
353 target machine, you might want your program to do something special if
354 it recognizes a packet meant for @value{GDBN}.
355
356 @cindex protocol, @value{GDBN} remote serial
357 @cindex serial protocol, @value{GDBN} remote
358 @cindex remote serial protocol
359 All @value{GDBN} commands and responses (other than acknowledgements, which
360 are single characters) are sent as a packet which includes a
361 checksum. A packet is introduced with the character @samp{$}, and ends
362 with the character @samp{#} followed by a two-digit checksum:
363
364 @example
365 $@var{packet info}#@var{checksum}
366 @end example
367
368 @cindex checksum, for @value{GDBN} remote
369 @noindent
370 @var{checksum} is computed as the modulo 256 sum of the @var{packet
371 info} characters.
372
373 When either the host or the target machine receives a packet, the first
374 response expected is an acknowledgement: a single character, either
375 @samp{+} (to indicate the package was received correctly) or @samp{-}
376 (to request retransmission).
377
378 The host (@value{GDBN}) sends commands, and the target (the debugging stub
379 incorporated in your program) sends data in response. The target also
380 sends data when your program stops.
381
382 Command packets are distinguished by their first character, which
383 identifies the kind of command.
384
385 These are the commands currently supported:
386
387 @table @code
388 @item g
389 Requests the values of CPU registers.
390
391 @item G
392 Sets the values of CPU registers.
393
394 @item m@var{addr},@var{count}
395 Read @var{count} bytes at location @var{addr}.
396
397 @item M@var{addr},@var{count}:@dots{}
398 Write @var{count} bytes at location @var{addr}.
399
400 @item c
401 @itemx c@var{addr}
402 Resume execution at the current address (or at @var{addr} if supplied).
403
404 @item s
405 @itemx s@var{addr}
406 Step the target program for one instruction, from either the current
407 program counter or from @var{addr} if supplied.
408
409 @item k
410 Kill the target program.
411
412 @item ?
413 Report the most recent signal. To allow you to take advantage of the
414 @value{GDBN} signal handling commands, one of the functions of the debugging
415 stub is to report CPU traps as the corresponding POSIX signal values.
416 @end table
417
418 @kindex set remotedebug
419 @kindex show remotedebug
420 @cindex packets, reporting on stdout
421 @cindex serial connections, debugging
422 If you have trouble with the serial connection, you can use the command
423 @code{set remotedebug}. This makes @value{GDBN} report on all packets sent
424 back and forth across the serial line to the remote machine. The
425 packet-debugging information is printed on the @value{GDBN} standard output
426 stream. @code{set remotedebug off} turns it off, and @code{show
427 remotedebug} will show you its current state.
428
429 @ifset GDBSERVER
430 @node Server
431 @subsubsection Using the @code{gdbserver} program
432
433 @kindex gdbserver
434 @cindex remote connection without stubs
435 @code{gdbserver} is a control program for Unix-like systems, which
436 allows you to connect your program with a remote @value{GDBN} via
437 @code{target remote}---but without linking in the usual debugging stub.
438
439 @code{gdbserver} is not a complete replacement for the debugging stubs,
440 because it requires essentially the same operating-system facilities
441 that @value{GDBN} itself does. In fact, a system that can run
442 @code{gdbserver} to connect to a remote @value{GDBN} could also run
443 @var{GDBN} locally! @code{gdbserver} is sometimes useful nevertheless,
444 because it is a much smaller program than @value{GDBN} itself. It is
445 also easier to port than all of @var{GDBN}, so you may be able to get
446 started more quickly on a new system by using @code{gdbserver}.
447
448 @value{GDBN} and @code{gdbserver} communicate via either a serial line
449 or a TCP connection, using the standard @value{GDBN} remote serial
450 protocol.
451
452 @table @emph
453 @item On the target,
454 you need to have a copy of the program you want to debug.
455 @code{gdbserver} does not need your program's symbol table, so you can
456 strip the program if necessary to save space. @value{GDBN} on the host
457 system does all the symbol handling.
458
459 To use the server, you must tell it how to communicate with @value{GDB};
460 the name of your program; and the arguments for your program. The
461 syntax is:
462
463 @smallexample
464 target> gdbserver @var{comm} @var{program} [ @var{args} @dots{} ]
465 @end smallexample
466
467 @var{comm} is either a device name (to use a serial line) or a TCP
468 hostname and portnumber. For example, to debug emacs with the argument
469 @samp{foo.txt} and communicate with @value{GDBN} over the serial port
470 @file{/dev/com1}:
471
472 @smallexample
473 target> gdbserver /dev/com1 emacs foo.txt
474 @end smallexample
475
476 @code{gdbserver} waits passively for the host @value{GDBN} to communicate
477 with it.
478
479 To use a TCP connection instead of a serial line:
480
481 @smallexample
482 target> gdbserver host:2345 emacs foo.txt
483 @end smallexample
484
485 The only difference from the previous example is the first argument,
486 specifying that you are communicating with the host @value{GDBN} via
487 TCP. The @samp{host:2345} argument means that @code{gdbserver} is to
488 expect a TCP connection from machine @samp{host} to local TCP port 2345.
489 (Currently, the @samp{host} part is ignored.) You can choose any number
490 you want for the port number as long as it does not conflict with any
491 TCP ports already in use on the target system.@footnote{If you choose a
492 port number that conflicts with another service, @code{gdbserver} prints
493 an error message and exits.} You must use the same port number with the
494 host @value{GDBN} @code{target remote} command.
495
496 @item On the host,
497 you need an unstripped copy of your program, since
498 @value{GDBN} needs symbols and debugging information. Start up
499 @value{GDBN} as usual, using the name of the local copy of your program
500 as the first argument. (You may also need the
501 @samp{--baud} option if the serial line is running at anything other than 9600 bps.)
502 After that, use @code{target remote} to establish communications with @code{gdbserver}. Its argument is either
503 a device name (usually a serial device, like @file{/dev/ttyb}), or a TCP
504 port descriptof in the form @code{@var{host}:@var{PORT}}. For example:
505
506 @smallexample
507 (@value{GDBP}) target remote /dev/ttyb
508 @end smallexample
509
510 @noindent
511 communicates with the server via serial line @file{/dev/ttyb}, and
512
513 @smallexample
514 (@value{GDBP}) target remote the-target:2345
515 @end smallexample
516
517 @noindent
518 communicates via a TCP connection to port 2345 on host @file{the-target}.
519 For TCP connections, you must start up @code{gdbserver} prior to using
520 the @code{target remote} command. Otherwise you may get an error whose
521 text depends on the host system, but which usually looks something like
522 @samp{Connection refused}.
523 @end table
524 @end ifset
525
526 @end ifset
527
528 @ifset I960
529 @node i960-Nindy Remote
530 @subsection @value{GDBN} with a remote i960 (Nindy)
531
532 @cindex Nindy
533 @cindex i960
534 @dfn{Nindy} is a ROM Monitor program for Intel 960 target systems. When
535 @value{GDBN} is configured to control a remote Intel 960 using Nindy, you can
536 tell @value{GDBN} how to connect to the 960 in several ways:
537
538 @itemize @bullet
539 @item
540 Through command line options specifying serial port, version of the
541 Nindy protocol, and communications speed;
542
543 @item
544 By responding to a prompt on startup;
545
546 @item
547 By using the @code{target} command at any point during your @value{GDBN}
548 session. @xref{Target Commands, ,Commands for managing targets}.
549
550 @end itemize
551
552 @menu
553 * Nindy Startup:: Startup with Nindy
554 * Nindy Options:: Options for Nindy
555 * Nindy Reset:: Nindy reset command
556 @end menu
557
558 @node Nindy Startup
559 @subsubsection Startup with Nindy
560
561 If you simply start @code{@value{GDBP}} without using any command-line
562 options, you are prompted for what serial port to use, @emph{before} you
563 reach the ordinary @value{GDBN} prompt:
564
565 @example
566 Attach /dev/ttyNN -- specify NN, or "quit" to quit:
567 @end example
568
569 @noindent
570 Respond to the prompt with whatever suffix (after @samp{/dev/tty})
571 identifies the serial port you want to use. You can, if you choose,
572 simply start up with no Nindy connection by responding to the prompt
573 with an empty line. If you do this and later wish to attach to Nindy,
574 use @code{target} (@pxref{Target Commands, ,Commands for managing targets}).
575
576 @node Nindy Options
577 @subsubsection Options for Nindy
578
579 These are the startup options for beginning your @value{GDBN} session with a
580 Nindy-960 board attached:
581
582 @table @code
583 @item -r @var{port}
584 Specify the serial port name of a serial interface to be used to connect
585 to the target system. This option is only available when @value{GDBN} is
586 configured for the Intel 960 target architecture. You may specify
587 @var{port} as any of: a full pathname (e.g. @samp{-r /dev/ttya}), a
588 device name in @file{/dev} (e.g. @samp{-r ttya}), or simply the unique
589 suffix for a specific @code{tty} (e.g. @samp{-r a}).
590
591 @item -O
592 (An uppercase letter ``O'', not a zero.) Specify that @value{GDBN} should use
593 the ``old'' Nindy monitor protocol to connect to the target system.
594 This option is only available when @value{GDBN} is configured for the Intel 960
595 target architecture.
596
597 @quotation
598 @emph{Warning:} if you specify @samp{-O}, but are actually trying to
599 connect to a target system that expects the newer protocol, the connection
600 fails, appearing to be a speed mismatch. @value{GDBN} repeatedly
601 attempts to reconnect at several different line speeds. You can abort
602 this process with an interrupt.
603 @end quotation
604
605 @item -brk
606 Specify that @value{GDBN} should first send a @code{BREAK} signal to the target
607 system, in an attempt to reset it, before connecting to a Nindy target.
608
609 @quotation
610 @emph{Warning:} Many target systems do not have the hardware that this
611 requires; it only works with a few boards.
612 @end quotation
613 @end table
614
615 The standard @samp{-b} option controls the line speed used on the serial
616 port.
617
618 @c @group
619 @node Nindy Reset
620 @subsubsection Nindy reset command
621
622 @table @code
623 @item reset
624 @kindex reset
625 For a Nindy target, this command sends a ``break'' to the remote target
626 system; this is only useful if the target has been equipped with a
627 circuit to perform a hard reset (or some other interesting action) when
628 a break is detected.
629 @end table
630 @c @end group
631 @end ifset
632
633 @ifset AMD29K
634 @node UDI29K Remote
635 @subsection @value{GDBN} and the UDI protocol for AMD29K
636
637 @cindex UDI
638 @cindex AMD29K via UDI
639 @value{GDBN} supports AMD's UDI (``Universal Debugger Interface'')
640 protocol for debugging the a29k processor family. To use this
641 configuration with AMD targets running the MiniMON monitor, you need the
642 program @code{MONTIP}, available from AMD at no charge. You can also
643 use @value{GDBN} with the UDI conformant a29k simulator program
644 @code{ISSTIP}, also available from AMD.
645
646 @table @code
647 @item target udi @var{keyword}
648 @kindex udi
649 Select the UDI interface to a remote a29k board or simulator, where
650 @var{keyword} is an entry in the AMD configuration file @file{udi_soc}.
651 This file contains keyword entries which specify parameters used to
652 connect to a29k targets. If the @file{udi_soc} file is not in your
653 working directory, you must set the environment variable @samp{UDICONF}
654 to its pathname.
655 @end table
656
657 @node EB29K Remote
658 @subsection @value{GDBN} and the EBMON protocol for AMD29K
659
660 @cindex EB29K board
661 @cindex running 29K programs
662
663 AMD distributes a 29K development board meant to fit in a PC, together
664 with a DOS-hosted monitor program called @code{EBMON}. As a shorthand
665 term, this development system is called the ``EB29K''. To use
666 @value{GDBN} from a Unix system to run programs on the EB29K board, you
667 must first connect a serial cable between the PC (which hosts the EB29K
668 board) and a serial port on the Unix system. In the following, we
669 assume you've hooked the cable between the PC's @file{COM1} port and
670 @file{/dev/ttya} on the Unix system.
671
672 @menu
673 * Comms (EB29K):: Communications setup
674 * gdb-EB29K:: EB29K cross-debugging
675 * Remote Log:: Remote log
676 @end menu
677
678 @node Comms (EB29K)
679 @subsubsection Communications setup
680
681 The next step is to set up the PC's port, by doing something like this
682 in DOS on the PC:
683
684 @example
685 C:\> MODE com1:9600,n,8,1,none
686 @end example
687
688 @noindent
689 This example---run on an MS DOS 4.0 system---sets the PC port to 9600
690 bps, no parity, eight data bits, one stop bit, and no ``retry'' action;
691 you must match the communications parameters when establishing the Unix
692 end of the connection as well.
693 @c FIXME: Who knows what this "no retry action" crud from the DOS manual may
694 @c mean? It's optional; leave it out? ---pesch@cygnus.com, 25feb91
695
696 To give control of the PC to the Unix side of the serial line, type
697 the following at the DOS console:
698
699 @example
700 C:\> CTTY com1
701 @end example
702
703 @noindent
704 (Later, if you wish to return control to the DOS console, you can use
705 the command @code{CTTY con}---but you must send it over the device that
706 had control, in our example over the @file{COM1} serial line).
707
708 From the Unix host, use a communications program such as @code{tip} or
709 @code{cu} to communicate with the PC; for example,
710
711 @example
712 cu -s 9600 -l /dev/ttya
713 @end example
714
715 @noindent
716 The @code{cu} options shown specify, respectively, the linespeed and the
717 serial port to use. If you use @code{tip} instead, your command line
718 may look something like the following:
719
720 @example
721 tip -9600 /dev/ttya
722 @end example
723
724 @noindent
725 Your system may require a different name where we show
726 @file{/dev/ttya} as the argument to @code{tip}. The communications
727 parameters, including which port to use, are associated with the
728 @code{tip} argument in the ``remote'' descriptions file---normally the
729 system table @file{/etc/remote}.
730 @c FIXME: What if anything needs doing to match the "n,8,1,none" part of
731 @c the DOS side's comms setup? cu can support -o (odd
732 @c parity), -e (even parity)---apparently no settings for no parity or
733 @c for character size. Taken from stty maybe...? John points out tip
734 @c can set these as internal variables, eg ~s parity=none; man stty
735 @c suggests that it *might* work to stty these options with stdin or
736 @c stdout redirected... ---pesch@cygnus.com, 25feb91
737
738 @kindex EBMON
739 Using the @code{tip} or @code{cu} connection, change the DOS working
740 directory to the directory containing a copy of your 29K program, then
741 start the PC program @code{EBMON} (an EB29K control program supplied
742 with your board by AMD). You should see an initial display from
743 @code{EBMON} similar to the one that follows, ending with the
744 @code{EBMON} prompt @samp{#}---
745
746 @example
747 C:\> G:
748
749 G:\> CD \usr\joe\work29k
750
751 G:\USR\JOE\WORK29K> EBMON
752 Am29000 PC Coprocessor Board Monitor, version 3.0-18
753 Copyright 1990 Advanced Micro Devices, Inc.
754 Written by Gibbons and Associates, Inc.
755
756 Enter '?' or 'H' for help
757
758 PC Coprocessor Type = EB29K
759 I/O Base = 0x208
760 Memory Base = 0xd0000
761
762 Data Memory Size = 2048KB
763 Available I-RAM Range = 0x8000 to 0x1fffff
764 Available D-RAM Range = 0x80002000 to 0x801fffff
765
766 PageSize = 0x400
767 Register Stack Size = 0x800
768 Memory Stack Size = 0x1800
769
770 CPU PRL = 0x3
771 Am29027 Available = No
772 Byte Write Available = Yes
773
774 # ~.
775 @end example
776
777 Then exit the @code{cu} or @code{tip} program (done in the example by
778 typing @code{~.} at the @code{EBMON} prompt). @code{EBMON} will keep
779 running, ready for @value{GDBN} to take over.
780
781 For this example, we've assumed what is probably the most convenient
782 way to make sure the same 29K program is on both the PC and the Unix
783 system: a PC/NFS connection that establishes ``drive @code{G:}'' on the
784 PC as a file system on the Unix host. If you do not have PC/NFS or
785 something similar connecting the two systems, you must arrange some
786 other way---perhaps floppy-disk transfer---of getting the 29K program
787 from the Unix system to the PC; @value{GDBN} will @emph{not} download it over the
788 serial line.
789
790 @node gdb-EB29K
791 @subsubsection EB29K cross-debugging
792
793 Finally, @code{cd} to the directory containing an image of your 29K
794 program on the Unix system, and start @value{GDBN}---specifying as argument the
795 name of your 29K program:
796
797 @example
798 cd /usr/joe/work29k
799 @value{GDBP} myfoo
800 @end example
801
802 Now you can use the @code{target} command:
803
804 @example
805 target amd-eb /dev/ttya 9600 MYFOO
806 @c FIXME: test above 'target amd-eb' as spelled, with caps! caps are meant to
807 @c emphasize that this is the name as seen by DOS (since I think DOS is
808 @c single-minded about case of letters). ---pesch@cygnus.com, 25feb91
809 @end example
810
811 @noindent
812 In this example, we've assumed your program is in a file called
813 @file{myfoo}. Note that the filename given as the last argument to
814 @code{target amd-eb} should be the name of the program as it appears to DOS.
815 In our example this is simply @code{MYFOO}, but in general it can include
816 a DOS path, and depending on your transfer mechanism may not resemble
817 the name on the Unix side.
818
819 At this point, you can set any breakpoints you wish; when you are ready
820 to see your program run on the 29K board, use the @value{GDBN} command
821 @code{run}.
822
823 To stop debugging the remote program, use the @value{GDBN} @code{detach}
824 command.
825
826 To return control of the PC to its console, use @code{tip} or @code{cu}
827 once again, after your @value{GDBN} session has concluded, to attach to
828 @code{EBMON}. You can then type the command @code{q} to shut down
829 @code{EBMON}, returning control to the DOS command-line interpreter.
830 Type @code{CTTY con} to return command input to the main DOS console,
831 and type @kbd{~.} to leave @code{tip} or @code{cu}.
832
833 @node Remote Log
834 @subsubsection Remote log
835 @kindex eb.log
836 @cindex log file for EB29K
837
838 The @code{target amd-eb} command creates a file @file{eb.log} in the
839 current working directory, to help debug problems with the connection.
840 @file{eb.log} records all the output from @code{EBMON}, including echoes
841 of the commands sent to it. Running @samp{tail -f} on this file in
842 another window often helps to understand trouble with @code{EBMON}, or
843 unexpected events on the PC side of the connection.
844
845 @end ifset
846
847 @ifset ST2000
848 @node ST2000 Remote
849 @subsection @value{GDBN} with a Tandem ST2000
850
851 To connect your ST2000 to the host system, see the manufacturer's
852 manual. Once the ST2000 is physically attached, you can run
853
854 @example
855 target st2000 @var{dev} @var{speed}
856 @end example
857
858 @noindent
859 to establish it as your debugging environment. @var{dev} is normally
860 the name of a serial device, such as @file{/dev/ttya}, connected to the
861 ST2000 via a serial line. You can instead specify @var{dev} as a TCP
862 connection (for example, to a serial line attached via a terminal
863 concentrator) using the syntax @code{@var{hostname}:@var{portnumber}}.
864
865 The @code{load} and @code{attach} commands are @emph{not} defined for
866 this target; you must load your program into the ST2000 as you normally
867 would for standalone operation. @value{GDBN} will read debugging information
868 (such as symbols) from a separate, debugging version of the program
869 available on your host computer.
870 @c FIXME!! This is terribly vague; what little content is here is
871 @c basically hearsay.
872
873 @cindex ST2000 auxiliary commands
874 These auxiliary @value{GDBN} commands are available to help you with the ST2000
875 environment:
876
877 @table @code
878 @item st2000 @var{command}
879 @kindex st2000 @var{cmd}
880 @cindex STDBUG commands (ST2000)
881 @cindex commands to STDBUG (ST2000)
882 Send a @var{command} to the STDBUG monitor. See the manufacturer's
883 manual for available commands.
884
885 @item connect
886 @cindex connect (to STDBUG)
887 Connect the controlling terminal to the STDBUG command monitor. When
888 you are done interacting with STDBUG, typing either of two character
889 sequences will get you back to the @value{GDBN} command prompt:
890 @kbd{@key{RET}~.} (Return, followed by tilde and period) or
891 @kbd{@key{RET}~@key{C-d}} (Return, followed by tilde and control-D).
892 @end table
893 @end ifset
894
895 @ifset VXWORKS
896 @node VxWorks Remote
897 @subsection @value{GDBN} and VxWorks
898 @cindex VxWorks
899
900 @value{GDBN} enables developers to spawn and debug tasks running on networked
901 VxWorks targets from a Unix host. Already-running tasks spawned from
902 the VxWorks shell can also be debugged. @value{GDBN} uses code that runs on
903 both the Unix host and on the VxWorks target. The program
904 @code{gdb} is installed and executed on the Unix host. (It may be
905 installed with the name @code{vxgdb}, to distinguish it from a
906 @value{GDBN} for debugging programs on the host itself.)
907
908 The following information on connecting to VxWorks was current when
909 this manual was produced; newer releases of VxWorks may use revised
910 procedures.
911
912 @kindex INCLUDE_RDB
913 To use @value{GDBN} with VxWorks, you must rebuild your VxWorks kernel
914 to include the remote debugging interface routines in the VxWorks
915 library @file{rdb.a}. To do this, define @code{INCLUDE_RDB} in the
916 VxWorks configuration file @file{configAll.h} and rebuild your VxWorks
917 kernel. The resulting kernel will contain @file{rdb.a} and spawn the
918 source debugging task @code{tRdbTask} when VxWorks is booted. For more
919 information on configuring and remaking VxWorks, see the manufacturer's
920 manual.
921 @c VxWorks, see the @cite{VxWorks Programmer's Guide}.
922
923 Once you have included @file{rdb.a} in your VxWorks system image and set
924 your Unix execution search path to find @value{GDBN}, you are ready to
925 run @value{GDBN}. From your Unix host, run @code{gdb} (or @code{vxgdb},
926 depending on your installation).
927
928 @value{GDBN} comes up showing the prompt:
929
930 @example
931 (vxgdb)
932 @end example
933
934 @menu
935 * VxWorks Connection:: Connecting to VxWorks
936 * VxWorks Download:: VxWorks download
937 * VxWorks Attach:: Running tasks
938 @end menu
939
940 @node VxWorks Connection
941 @subsubsection Connecting to VxWorks
942
943 The @value{GDBN} command @code{target} lets you connect to a VxWorks target on the
944 network. To connect to a target whose host name is ``@code{tt}'', type:
945
946 @example
947 (vxgdb) target vxworks tt
948 @end example
949
950 @value{GDBN} displays messages like these:
951
952 @smallexample
953 Attaching remote machine across net...
954 Connected to tt.
955 @end smallexample
956
957 @value{GDBN} then attempts to read the symbol tables of any object modules
958 loaded into the VxWorks target since it was last booted. @value{GDBN} locates
959 these files by searching the directories listed in the command search
960 path (@pxref{Environment, ,Your program's environment}); if it fails
961 to find an object file, it displays a message such as:
962
963 @example
964 prog.o: No such file or directory.
965 @end example
966
967 When this happens, add the appropriate directory to the search path with
968 the @value{GDBN} command @code{path}, and execute the @code{target}
969 command again.
970
971 @node VxWorks Download
972 @subsubsection VxWorks download
973
974 @cindex download to VxWorks
975 If you have connected to the VxWorks target and you want to debug an
976 object that has not yet been loaded, you can use the @value{GDBN}
977 @code{load} command to download a file from Unix to VxWorks
978 incrementally. The object file given as an argument to the @code{load}
979 command is actually opened twice: first by the VxWorks target in order
980 to download the code, then by @value{GDBN} in order to read the symbol
981 table. This can lead to problems if the current working directories on
982 the two systems differ. If both systems have NFS mounted the same
983 filesystems, you can avoid these problems by using absolute paths.
984 Otherwise, it is simplest to set the working directory on both systems
985 to the directory in which the object file resides, and then to reference
986 the file by its name, without any path. For instance, a program
987 @file{prog.o} may reside in @file{@var{vxpath}/vw/demo/rdb} in VxWorks
988 and in @file{@var{hostpath}/vw/demo/rdb} on the host. To load this
989 program, type this on VxWorks:
990
991 @example
992 -> cd "@var{vxpath}/vw/demo/rdb"
993 @end example
994
995 Then, in @value{GDBN}, type:
996
997 @example
998 (vxgdb) cd @var{hostpath}/vw/demo/rdb
999 (vxgdb) load prog.o
1000 @end example
1001
1002 @value{GDBN} displays a response similar to this:
1003
1004 @smallexample
1005 Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
1006 @end smallexample
1007
1008 You can also use the @code{load} command to reload an object module
1009 after editing and recompiling the corresponding source file. Note that
1010 this will cause @value{GDBN} to delete all currently-defined breakpoints,
1011 auto-displays, and convenience variables, and to clear the value
1012 history. (This is necessary in order to preserve the integrity of
1013 debugger data structures that reference the target system's symbol
1014 table.)
1015
1016 @node VxWorks Attach
1017 @subsubsection Running tasks
1018
1019 @cindex running VxWorks tasks
1020 You can also attach to an existing task using the @code{attach} command as
1021 follows:
1022
1023 @example
1024 (vxgdb) attach @var{task}
1025 @end example
1026
1027 @noindent
1028 where @var{task} is the VxWorks hexadecimal task ID. The task can be running
1029 or suspended when you attach to it. If running, it will be suspended at
1030 the time of attachment.
1031 @end ifset
1032
1033 @ifset H8
1034 @node Hitachi Remote
1035 @subsection @value{GDBN} and Hitachi Microprocessors
1036 @value{GDBN} needs to know these things to talk to your
1037 Hitachi SH, H8/300, or H8/500:
1038
1039 @enumerate
1040 @item
1041 that you want to use @samp{target hms}, the remote debugging interface
1042 for Hitachi microprocessors (this is the default when GDB is configured
1043 specifically for the Hitachi SH, H8/300, or H8/500);
1044
1045 @item
1046 what serial device connects your host to your Hitachi board (the first
1047 serial device available on your host is the default);
1048
1049 @ignore
1050 @c this is only for Unix hosts, not currently of interest.
1051 @item
1052 what speed to use over the serial device.
1053 @end ignore
1054 @end enumerate
1055
1056 @ifclear H8EXCLUSIVE
1057 @c only for Unix hosts
1058 @kindex device
1059 @cindex serial device, Hitachi micros
1060 Use the special @code{@value{GDBP}} command @samp{device @var{port}} if you
1061 need to explicitly set the serial device. The default @var{port} is the
1062 first available port on your host. This is only necessary on Unix
1063 hosts, where it is typically something like @file{/dev/ttya}.
1064
1065 @kindex speed
1066 @cindex serial line speed, Hitachi micros
1067 @code{@value{GDBP}} has another special command to set the communications
1068 speed: @samp{speed @var{bps}}. This command also is only used from Unix
1069 hosts; on DOS hosts, set the line speed as usual from outside GDB with
1070 the DOS @kbd{mode} command (for instance, @w{@samp{mode
1071 com2:9600,n,8,1,p}} for a 9600 bps connection).
1072
1073 The @samp{device} and @samp{speed} commands are available only when you
1074 use a Unix host to debug your Hitachi microprocessor programs. If you
1075 use a DOS host,
1076 @end ifclear
1077 @value{GDBN} depends on an auxiliary terminate-and-stay-resident program
1078 called @code{asynctsr} to communicate with the development board
1079 through a PC serial port. You must also use the DOS @code{mode} command
1080 to set up the serial port on the DOS side.
1081
1082 @ifset DOSHOST
1083 The following sample session illustrates the steps needed to start a
1084 program under @value{GDBN} control on an H8/300. The example uses a
1085 sample H8/300 program called @file{t.x}. The procedure is the same for
1086 the Hitachi SH and the H8/500.
1087
1088 First hook up your development board. In this example, we use a
1089 board attached to serial port @code{COM2}; if you use a different serial
1090 port, substitute its name in the argument of the @code{mode} command.
1091 When you call @code{asynctsr}, the auxiliary comms program used by the
1092 degugger, you give it just the numeric part of the serial port's name;
1093 for example, @samp{asyncstr 2} below runs @code{asyncstr} on
1094 @code{COM2}.
1095
1096 @example
1097 (eg-C:\H8300\TEST) mode com2:9600,n,8,1,p
1098
1099 Resident portion of MODE loaded
1100
1101 COM2: 9600, n, 8, 1, p
1102
1103 (eg-C:\H8300\TEST) asynctsr 2
1104 @end example
1105
1106 @quotation
1107 @emph{Warning:} We have noticed a bug in PC-NFS that conflicts with
1108 @code{asynctsr}. If you also run PC-NFS on your DOS host, you may need to
1109 disable it, or even boot without it, to use @code{asynctsr} to control
1110 your development board.
1111 @end quotation
1112
1113 @kindex target hms
1114 Now that serial communications are set up, and the development board is
1115 connected, you can start up @value{GDBN}. Call @code{@value{GDBP}} with
1116 the name of your program as the argument. @code{@value{GDBP}} prompts
1117 you, as usual, with the prompt @samp{(@value{GDBP})}. Use two special
1118 commands to begin your debugging session: @samp{target hms} to specify
1119 cross-debugging to the Hitachi board, and the @code{load} command to
1120 download your program to the board. @code{load} displays the names of
1121 the program's sections, and a @samp{*} for each 2K of data downloaded.
1122 (If you want to refresh @value{GDBN} data on symbols or on the
1123 executable file without downloading, use the @value{GDBN} commands
1124 @code{file} or @code{symbol-file}. These commands, and @code{load}
1125 itself, are described in @ref{Files,,Commands to specify files}.)
1126
1127 @smallexample
1128 (eg-C:\H8300\TEST) @value{GDBP} t.x
1129 GDB is free software and you are welcome to distribute copies
1130 of it under certain conditions; type "show copying" to see
1131 the conditions.
1132 There is absolutely no warranty for GDB; type "show warranty"
1133 for details.
1134 GDB @value{GDBVN}, Copyright 1992 Free Software Foundation, Inc...
1135 (gdb) target hms
1136 Connected to remote H8/300 HMS system.
1137 (gdb) load t.x
1138 .text : 0x8000 .. 0xabde ***********
1139 .data : 0xabde .. 0xad30 *
1140 .stack : 0xf000 .. 0xf014 *
1141 @end smallexample
1142
1143 At this point, you're ready to run or debug your program. From here on,
1144 you can use all the usual @value{GDBN} commands. The @code{break} command
1145 sets breakpoints; the @code{run} command starts your program;
1146 @code{print} or @code{x} display data; the @code{continue} command
1147 resumes execution after stopping at a breakpoint. You can use the
1148 @code{help} command at any time to find out more about @value{GDBN} commands.
1149
1150 Remember, however, that @emph{operating system} facilities aren't
1151 available on your development board; for example, if your program hangs,
1152 you can't send an interrupt---but you can press the @sc{reset} switch!
1153
1154 Use the @sc{reset} button on the development board
1155 @itemize @bullet
1156 @item
1157 to interrupt your program (don't use @kbd{ctl-C} on the DOS host---it has
1158 no way to pass an interrupt signal to the development board); and
1159
1160 @item
1161 to return to the @value{GDBN} command prompt after your program finishes
1162 normally. The communications protocol provides no other way for @value{GDBN}
1163 to detect program completion.
1164 @end itemize
1165
1166 In either case, @value{GDBN} will see the effect of a @sc{reset} on the
1167 development board as a ``normal exit'' of your program.
1168 @end ifset
1169 @end ifset
1170
1171 @ifset MIPS
1172 @node MIPS Remote
1173 @subsection @value{GDBN} and remote MIPS boards
1174
1175 @cindex MIPS boards
1176 @value{GDBN} can use the MIPS remote debugging protocol to talk to a
1177 MIPS board attached to a serial line. This is available when
1178 you configure @value{GDBN} with @samp{--target=mips-idt-ecoff}.
1179
1180 @kindex target mips @var{port}
1181 To run a program on the board, start up @code{@value{GDBP}} with the
1182 name of your program as the argument. To connect to the board, use the
1183 command @samp{target mips @var{port}}, where @var{port} is the name of
1184 the serial port connected to the board. If the program has not already
1185 been downloaded to the board, you may use the @code{load} command to
1186 download it. You can then use all the usual @value{GDBN} commands.
1187
1188 You can also specify @var{port} as a TCP connection (for instance, to a
1189 serial line managed by a terminal concentrator), using the syntax
1190 @code{@var{hostname}:@var{portnumber}}.
1191
1192 @cindex @code{remotedebug}, MIPS protocol
1193 @c FIXME! For this to be useful, you must know something about the MIPS
1194 @c FIXME...protocol. Where is it described?
1195 You can see some debugging information about communications with the board
1196 by setting the @code{remotedebug} variable. If you set it to 1 using
1197 @samp{set remotedebug 1} every packet will be displayed. If you set it
1198 to 2 every character will be displayed. You can check the current value
1199 at any time with the command @samp{show remotedebug}.
1200
1201 @cindex @code{timeout}, MIPS protocol
1202 @cindex @code{retransmit-timeout}, MIPS protocol
1203 @kindex set timeout
1204 @kindex show timeout
1205 @kindex set retransmit-timeout
1206 @kindex show retransmit-timeout
1207 You can control the timeout used while waiting for a packet, in the MIPS
1208 remote protocol, with the @code{set timeout @var{seconds}} command. The
1209 default is 5 seconds. Similarly, you can control the timeout used while
1210 waiting for an acknowledgement of a packet with the @code{set
1211 retransmit-timeout @var{seconds}} command. The default is 3 seconds.
1212 You can inspect both values with @code{show timeout} and @code{show
1213 retransmit-timeout}. (These commands are @emph{only} available when
1214 @value{GDBN} is configured for @samp{--target=mips-idt-ecoff}.)
1215
1216 @kindex set mipsfpu off
1217 @cindex MIPS remote floating point
1218 @cindex floating point, MIPS remote
1219 If your target board does not support the MIPS floating point
1220 coprocessor, you should use the command @samp{set mipsfpu off} (you may
1221 wish to put this in your @value{GDBINIT} file). This tells @value{GDBN}
1222 how to find the return value of functions which return floating point
1223 values. It also allows @value{GDBN} to avoid saving the floating point
1224 registers when calling functions on the board.
1225 @end ifset
1226
1227 @ifset SIMS
1228 @node Simulator
1229 @subsection Simulated CPU target
1230
1231 @ifset GENERIC
1232 @cindex simulator
1233 @cindex simulator, Z8000
1234 @cindex Z8000 simulator
1235 @cindex simulator, H8/300 or H8/500
1236 @cindex H8/300 or H8/500 simulator
1237 @cindex simulator, Hitachi SH
1238 @cindex Hitachi SH simulator
1239 @cindex CPU simulator
1240 For some configurations, @value{GDBN} includes a CPU simulator that you
1241 can use instead of a hardware CPU to debug your programs. Currently,
1242 a simulator is available when @value{GDBN} is configured to debug Zilog
1243 Z8000 or Hitachi microprocessor targets.
1244 @end ifset
1245
1246 @ifclear GENERIC
1247 @ifset H8
1248 @cindex simulator, H8/300 or H8/500
1249 @cindex Hitachi H8/300 or H8/500 simulator
1250 @cindex simulator, Hitachi SH
1251 @cindex Hitachi SH simulator
1252 When configured for debugging Hitachi microprocessor targets,
1253 @value{GDBN} includes a CPU simulator for the target chip (a Hitachi SH,
1254 H8/300, or H8/500).
1255 @end ifset
1256
1257 @ifset Z8K
1258 @cindex simulator, Z8000
1259 @cindex Zilog Z8000 simulator
1260 When configured for debugging Zilog Z8000 targets, @value{GDBN} includes
1261 a Z8000 simulator.
1262 @end ifset
1263 @end ifclear
1264
1265 @ifset Z8K
1266 For the Z8000 family, @samp{target sim} simulates either the Z8002 (the
1267 unsegmented variant of the Z8000 architecture) or the Z8001 (the
1268 segmented variant). The simulator recognizes which architecture is
1269 appropriate by inspecting the object code.
1270 @end ifset
1271
1272 @table @code
1273 @item target sim
1274 @kindex sim
1275 @kindex target sim
1276 Debug programs on a simulated CPU
1277 @ifset GENERIC
1278 (which CPU depends on the @value{GDBN} configuration)
1279 @end ifset
1280 @end table
1281
1282 @noindent
1283 After specifying this target, you can debug programs for the simulated
1284 CPU in the same style as programs for your host computer; use the
1285 @code{file} command to load a new program image, the @code{run} command
1286 to run your program, and so on.
1287
1288 As well as making available all the usual machine registers (see
1289 @code{info reg}), this debugging target provides three additional items
1290 of information as specially named registers:
1291
1292 @table @code
1293 @item cycles
1294 Counts clock-ticks in the simulator.
1295
1296 @item insts
1297 Counts instructions run in the simulator.
1298
1299 @item time
1300 Execution time in 60ths of a second.
1301 @end table
1302
1303 You can refer to these values in @value{GDBN} expressions with the usual
1304 conventions; for example, @w{@samp{b fputc if $cycles>5000}} sets a
1305 conditional breakpoint that will suspend only after at least 5000
1306 simulated clock ticks.
1307 @end ifset
This page took 0.057523 seconds and 4 git commands to generate.