URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [doc/] [gdb.info-7] - Rev 1765
Compare with Previous | Blame | View Log
This is ./gdb.info, produced by makeinfo version 4.0 from gdb.texinfo.INFO-DIR-SECTION Programming & development tools.START-INFO-DIR-ENTRY* Gdb: (gdb). The GNU debugger.END-INFO-DIR-ENTRYThis file documents the GNU debugger GDB.This is the Eighth Edition, March 2000, of `Debugging with GDB: theGNU Source-Level Debugger' for GDB Version 5.0.Copyright (C) 1988-2000 Free Software Foundation, Inc.Permission is granted to make and distribute verbatim copies of thismanual provided the copyright notice and this permission notice arepreserved on all copies.Permission is granted to copy and distribute modified versions ofthis manual under the conditions for verbatim copying, provided alsothat the entire resulting derived work is distributed under the termsof a permission notice identical to this one.Permission is granted to copy and distribute translations of thismanual into another language, under the above conditions for modifiedversions.File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote SerialWhat you must do for the stub.............................The debugging stubs that come with GDB are set up for a particularchip architecture, but they have no information about the rest of yourdebugging target machine.First of all you need to tell the stub how to communicate with theserial port.`int getDebugChar()'Write this subroutine to read a single character from the serialport. It may be identical to `getchar' for your target system; adifferent name is used to allow you to distinguish the two if youwish.`void putDebugChar(int)'Write this subroutine to write a single character to the serialport. It may be identical to `putchar' for your target system; adifferent name is used to allow you to distinguish the two if youwish.If you want GDB to be able to stop your program while it is running,you need to use an interrupt-driven serial driver, and arrange for itto stop when it receives a `^C' (`\003', the control-C character).That is the character which GDB uses to tell the remote system to stop.Getting the debugging target to return the proper status to GDBprobably requires changes to the standard stub; one quick and dirty wayis to just execute a breakpoint instruction (the "dirty" part is thatGDB reports a `SIGTRAP' instead of a `SIGINT').Other routines you need to supply are:`void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'Write this function to install EXCEPTION_ADDRESS in the exceptionhandling tables. You need to do this because the stub does nothave any way of knowing what the exception handling tables on yourtarget system are like (for example, the processor's table mightbe in ROM, containing entries which point to a table in RAM).EXCEPTION_NUMBER is the exception number which should be changed;its meaning is architecture-dependent (for example, differentnumbers might represent divide by zero, misaligned access, etc).When this exception occurs, control should be transferred directlyto EXCEPTION_ADDRESS, and the processor state (stack, registers,and so on) should be just as it is when a processor exceptionoccurs. So if you want to use a jump instruction to reachEXCEPTION_ADDRESS, it should be a simple jump, not a jump tosubroutine.For the 386, EXCEPTION_ADDRESS should be installed as an interruptgate so that interrupts are masked while the handler runs. Thegate should be at privilege level 0 (the most privileged level).The SPARC and 68k stubs are able to mask interrupts themselveswithout help from `exceptionHandler'.`void flush_i_cache()'On SPARC and SPARCLITE only, write this subroutine to flush theinstruction cache, if any, on your target machine. If there is noinstruction cache, this subroutine may be a no-op.On target machines that have instruction caches, GDB requires thisfunction to make certain that the state of your program is stable.You must also make sure this library routine is available:`void *memset(void *, int, int)'This is the standard library function `memset' that sets an area ofmemory to a known value. If you have one of the free versions of`libc.a', `memset' can be found there; otherwise, you must eitherobtain it from your hardware manufacturer, or write your own.If you do not use the GNU C compiler, you may need other standardlibrary subroutines as well; this varies from one stub to another, butin general the stubs are likely to use any of the common librarysubroutines which `gcc' generates as inline code.File: gdb.info, Node: Debug Session, Next: Protocol, Prev: Bootstrapping, Up: Remote SerialPutting it all together.......................In summary, when your program is ready to debug, you must followthese steps.1. Make sure you have defined the supporting low-level routines(*note What you must do for the stub: Bootstrapping.):`getDebugChar', `putDebugChar',`flush_i_cache', `memset', `exceptionHandler'.2. Insert these lines near the top of your program:set_debug_traps();breakpoint();3. For the 680x0 stub only, you need to provide a variable called`exceptionHook'. Normally you just use:void (*exceptionHook)() = 0;but if before calling `set_debug_traps', you set it to point to afunction in your program, that function is called when `GDB'continues after stopping on a trap (for example, bus error). Thefunction indicated by `exceptionHook' is called with oneparameter: an `int' which is the exception number.4. Compile and link together: your program, the GDB debugging stub foryour target architecture, and the supporting subroutines.5. Make sure you have a serial connection between your target machineand the GDB host, and identify the serial port on the host.6. Download your program to your target machine (or get it there bywhatever means the manufacturer provides), and start it.7. To start remote debugging, run GDB on the host machine, and specifyas an executable file the program that is running in the remotemachine. This tells GDB how to find your program's symbols andthe contents of its pure text.8. Establish communication using the `target remote' command. Itsargument specifies how to communicate with the targetmachine--either via a devicename attached to a direct serial line,or a TCP port (usually to a terminal server which in turn has aserial line to the target). For example, to use a serial lineconnected to the device named `/dev/ttyb':target remote /dev/ttybTo use a TCP connection, use an argument of the form `HOST:port'.For example, to connect to port 2828 on a terminal server named`manyfarms':target remote manyfarms:2828Now you can use all the usual commands to examine and change dataand to step and continue the remote program.To resume the remote program and stop debugging it, use the `detach'command.Whenever GDB is waiting for the remote program, if you type theinterrupt character (often <C-C>), GDB attempts to stop the program.This may or may not succeed, depending in part on the hardware and theserial drivers the remote system uses. If you type the interruptcharacter once again, GDB displays this prompt:Interrupted while waiting for the program.Give up (and stop debugging it)? (y or n)If you type `y', GDB abandons the remote debugging session. (If youdecide you want to try again later, you can use `target remote' againto connect once more.) If you type `n', GDB goes back to waiting.File: gdb.info, Node: Protocol, Next: Server, Prev: Debug Session, Up: Remote SerialCommunication protocol......................The stub files provided with GDB implement the target side of thecommunication protocol, and the GDB side is implemented in the GDBsource file `remote.c'. Normally, you can simply allow thesesubroutines to communicate, and ignore the details. (If you'reimplementing your own stub file, you can still ignore the details: startwith one of the existing stub files. `sparc-stub.c' is the bestorganized, and therefore the easiest to read.)However, there may be occasions when you need to know something aboutthe protocol--for example, if there is only one serial port to yourtarget machine, you might want your program to do something special ifit recognizes a packet meant for GDB.In the examples below, `<-' and `->' are used to indicatetransmitted and received data respectfully.All GDB commands and responses (other than acknowledgments) are sentas a PACKET. A PACKET is introduced with the character `$', the actualPACKET-DATA, and the terminating character `#' followed by a two-digitCHECKSUM:`$'PACKET-DATA`#'CHECKSUMThe two-digit CHECKSUM is computed as the modulo 256 sum of allcharacters between the leading `$' and the trailing `#' (an eight bitunsigned checksum).Implementors should note that prior to GDB 5.0 the protocolspecification also included an optional two-digit SEQUENCE-ID:`$'SEQUENCE-ID`:'PACKET-DATA`#'CHECKSUMThat SEQUENCE-ID was appended to the acknowledgment. GDB has neveroutput SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0must not accept SEQUENCE-ID.When either the host or the target machine receives a packet, thefirst response expected is an acknowledgment: either `+' (to indicatethe package was received correctly) or `-' (to request retransmission):<- `$'PACKET-DATA`#'CHECKSUM-> `+'The host (GDB) sends COMMANDs, and the target (the debugging stubincorporated in your program) sends a RESPONSE. In the case of stepand continue COMMANDs, the response is only sent when the operation hascompleted (the target has again stopped).PACKET-DATA consists of a sequence of characters with the exceptionof `#' and `$' (see `X' packet for additional exceptions).Fields within the packet should be separated using `,' `;' or `:'.Except where otherwise noted all numbers are represented in HEX withleading zeros suppressed.Implementors should note that prior to GDB 5.0, the character `:'could not appear as the third character in a packet (as it wouldpotentially conflict with the SEQUENCE-ID).Response DATA can be run-length encoded to save space. A `*' meansthat the next character is an ASCII encoding giving a repeat countwhich stands for that many repetitions of the character preceding the`*'. The encoding is `n+29', yielding a printable character where `n>=3' (which is where rle starts to win). The printable characters `$',`#', `+' and `-' or with a numeric value greater than 126 should not beused.Some remote systems have used a different run-length encodingmechanism loosely refered to as the cisco encoding. Following the `*'character are two hex digits that indicate the size of the packet.So:"`0* '"means the same as "0000".The error response returned for some packets includes a two charactererror number. That number is not well defined.For any COMMAND not supported by the stub, an empty response(`$#00') should be returned. That way it is possible to extend theprotocol. A newer GDB can tell if a packet is supported based on thatresponse.A stub is required to support the `g', `G', `m', `M', `c', and `s'COMMANDs. All other COMMANDs are optional.Below is a complete list of all currently defined COMMANDs and theircorresponding response DATA:Packet Request Descriptionextended ops `!' Use the extended remoteprotocol. Sticky--onlyneeds to be set once. Theextended remote protocolsupports the `R' packet.reply `' Stubs that support theextended remote protocolreturn `' which,unfortunately, is identicalto the response returned bystubs that do not supportprotocol extensions.last signal `?' Indicate the reason thetarget halted. The reply isthe same as for step andcontinue.reply see belowreserved `a' Reserved for future useset program arguments `A'ARGLEN`,'ARGNUM`,'ARG`,...'*(reserved)*Initialized `argv[]' arraypassed into program. ARGLENspecifies the number ofbytes in the hex encodedbyte stream ARG. See`gdbserver' for more details.reply `OK'reply `E'NNset baud `b'BAUD Change the serial line speed*(deprecated)* to BAUD. JTC: _When does thetransport layer statechange? When it's received,or after the ACK istransmitted. In eithercase, there are problems ifthe command or theacknowledgment packet isdropped._ Stan: _If peoplereally wanted to addsomething like this, and getit working for the firsttime, they ought to modifyser-unix.c to send some kindof out-of-band message to aspecially-setup stub andhave the switch happen "inbetween" packets, so thatfrom remote protocol's pointof view, nothing actuallyhappened._set breakpoint `B'ADDR,MODE Set (MODE is `S') or clear*(deprecated)* (MODE is `C') a breakpointat ADDR. _This has beenreplaced by the `Z' and `z'packets._continue `c'ADDR ADDR is address to resume.If ADDR is omitted, resume atcurrent address.reply see belowcontinue with signal `C'SIG`;'ADDR Continue with signal SIG(hex signal number). If`;'ADDR is omitted, resumeat same address.reply see belowtoggle debug `d' toggle debug flag.*(deprecated)*detach `D' Detach GDB from the remotesystem. Sent to the remotetarget before GDBdisconnects.reply _no response_ GDB does not check for anyresponse after sending thispacket.reserved `e' Reserved for future usereserved `E' Reserved for future usereserved `f' Reserved for future usereserved `F' Reserved for future useread registers `g' Read general registers.reply XX... Each byte of register datais described by two hexdigits. The bytes with theregister are transmitted intarget byte order. The sizeof each register and theirposition within the `g'PACKET are determined by theGDB internal macrosREGISTER_RAW_SIZE andREGISTER_NAME macros. Thespecification of severalstandard `g' packets isspecified below.`E'NN for an error.write regs `G'XX... See `g' for a description ofthe XX... data.reply `OK' for successreply `E'NN for an errorreserved `h' Reserved for future useset thread `H'CT... Set thread for subsequentoperations (`m', `M', `g',`G', et.al.). C = `c' forthread used in step andcontinue; T... can be -1 forall threads. C = `g' forthread used in otheroperations. If zero, pick athread, any thread.reply `OK' for successreply `E'NN for an errorcycle step *(draft)* `i'ADDR`,'NNN Step the remote target by asingle clock cycle. If`,'NNN is present, cyclestep NNN cycles. If ADDR ispresent, cycle step startingat that address.signal then cycle `I' See `i' and `S' for likelystep *(reserved)* syntax and semantics.reserved `j' Reserved for future usereserved `J' Reserved for future usekill request `k' FIXME: _There is nodescription of how operatewhen a specific threadcontext has been selected(ie. does 'k' kill only thatthread?)_.reserved `l' Reserved for future usereserved `L' Reserved for future useread memory `m'ADDR`,'LENGTH Read LENGTH bytes of memorystarting at address ADDR.Neither GDB nor the stubassume that sized memorytransfers are assumed usingword alligned accesses.FIXME: _A word aligned memorytransfer mechanism isneeded._reply XX... XX... is mem contents. Canbe fewer bytes thanrequested if able to readonly part of the data.Neither GDB nor the stubassume that sized memorytransfers are assumed usingword alligned accesses.FIXME: _A word alignedmemory transfer mechanism isneeded._reply `E'NN NN is errnowrite mem `M'ADDR,LENGTH`:'XX... Write LENGTH bytes of memorystarting at address ADDR.XX... is the data.reply `OK' for successreply `E'NN for an error (this includesthe case where only part ofthe data was written).reserved `n' Reserved for future usereserved `N' Reserved for future usereserved `o' Reserved for future usereserved `O' Reserved for future useread reg *(reserved)* `p'N... See write register.return R.... The hex encoded value of theregister in target byteorder.write reg `P'N...`='R... Write register N... withvalue R..., which containstwo hex digits for each bytein the register (target byteorder).reply `OK' for successreply `E'NN for an errorgeneral query `q'QUERY Request info about QUERY.In general GDB queries havea leading upper case letter.Custom vendor queriesshould use a company prefix(in lower case) ex:`qfsf.var'. QUERY mayoptionally be followed by a`,' or `;' separated list.Stubs must ensure that theymatch the full QUERY name.reply `XX...' Hex encoded data from query.The reply can not be empty.reply `E'NN error replyreply `' Indicating an unrecognizedQUERY.general set `Q'VAR`='VAL Set value of VAR to VAL.See `q' for a discussing ofnaming conventions.reset *(deprecated)* `r' Reset the entire system.remote restart `R'XX Restart the remote server.XX while needed has no cleardefinition. FIXME: _Anexample interactionexplaining how this packetis used in extended-remotemode is needed_.step `s'ADDR ADDR is address to resume.If ADDR is omitted, resume atsame address.reply see belowstep with signal `S'SIG`;'ADDR Like `C' but step notcontinue.reply see belowsearch `t'ADDR`:'PP`,'MM Search backwards starting ataddress ADDR for a matchwith pattern PP and mask MM.PP and MM are 4 bytes.ADDR must be at least 3digits.thread alive `T'XX Find out if the thread XX isalive.reply `OK' thread is still alivereply `E'NN thread is deadreserved `u' Reserved for future usereserved `U' Reserved for future usereserved `v' Reserved for future usereserved `V' Reserved for future usereserved `w' Reserved for future usereserved `W' Reserved for future usereserved `x' Reserved for future usewrite mem (binary) `X'ADDR`,'LENGTH:XX... ADDR is address, LENGTH isnumber of bytes, XX... isbinary data. The characters`$', `#', and `0x7d' areescaped using `0x7d'.reply `OK' for successreply `E'NN for an errorreserved `y' Reserved for future usereserved `Y' Reserved for future useremove break or `z'T`,'ADDR`,'LENGTH See `Z'.watchpoint *(draft)*insert break or `Z'T`,'ADDR`,'LENGTH T is type: `0' - softwarewatchpoint *(draft)* breakpoint, `1' - hardwarebreakpoint, `2' - writewatchpoint, `3' - readwatchpoint, `4' - accesswatchpoint; ADDR is address;LENGTH is in bytes. For asoftware breakpoint, LENGTHspecifies the size of theinstruction to be patched.For hardware breakpoints andwatchpoints LENGTH specifiesthe memory region to bemonitored. To avoidpotential problems withduplicate packets, theoperations should beimplemented in an idempotentway.reply `E'NN for an errorreply `OK' for success`' If not supported.reserved <other> Reserved for future useThe `C', `c', `S', `s' and `?' packets can receive any of the belowas a reply. In the case of the `C', `c', `S' and `s' packets, thatreply is only returned when the target halts. In the below the exactmeaning of `signal number' is poorly defined. In general one of theUNIX signal numbering conventions is used.`S'AA AA is the signal number`T'AAN...`:'R...`;'N...`:'R...`;'N...`:'R...`;'AA = two hex digit signal number; N... =register number (hex), R... = target byteordered register contents, size defined by`REGISTER_RAW_SIZE'; N... = `thread', R...= thread process ID, this is a hexinteger; N... = other string not startingwith valid hex digit. GDB should ignorethis N..., R... pair and go on to thenext. This way we can extend the protocol.`W'AA The process exited, and AA is the exitstatus. This is only applicable forcertains sorts of targets.`X'AA The process terminated with signal AA.`N'AA`;'T...`;'D...`;'B... AA = signal number; T... = address of*(obsolete)* symbol "_start"; D... = base of datasection; B... = base of bss section._Note: only used by Cisco Systems targets.The difference between this reply and the"qOffsets" query is that the 'N' packetmay arrive spontaneously whereas the'qOffsets' is a query initiated by the hostdebugger._`O'XX... XX... is hex encoding of ASCII data. Thiscan happen at any time while the programis running and the debugger shouldcontinue to wait for 'W', 'T', etc.The following set and query packets have already been defined.current thread `q'`C' Return the current thread id.reply `QC'PID Where PID is a HEX encoded 16 bit processid.reply * Any other reply implies the old pid.all thread ids `q'`fThreadInfo'`q'`sThreadInfo'Obtain a list of active thread ids fromthe target (OS). Since there may be toomany active threads to fit into one replypacket, this query works iteratively: itmay require more than one query/replysequence to obtain the entire list ofthreads. The first query of the sequencewill be the `qf'`ThreadInfo' query;subsequent queries in the sequence will bethe `qs'`ThreadInfo' query.NOTE: replaces the `qL' query (see below).reply `m'<ID> A single thread idreply a comma-separated list of thread ids`m'<ID>,<ID>...reply `l' (lower case 'el') denotes end of list.In response to each query, the target willreply with a list of one or more threadids, in big-endian hex, separated bycommas. GDB will respond to each replywith a request for more thread ids (usingthe `qs' form of the query), until thetarget responds with `l' (lower-case el,for `'last'').extra thread `q'`ThreadExtraInfo'`,'IDinfoWhere <ID> is a thread-id in big-endianhex. Obtain a printable stringdescription of a thread's attributes fromthe target OS. This string may containanything that the target OS thinks isinteresting for GDB to tell the user aboutthe thread. The string is displayed inGDB's `info threads' display. Someexamples of possible thread extra infostrings are "Runnable", or "Blocked onMutex".reply XX... Where XX... is a hex encoding of ASCIIdata, comprising the printable stringcontaining the extra information about thethread's attributes.query LIST or `q'`L'STARTFLAGTHREADCOUNTNEXTTHREADTHREADLIST*(deprecated)*Obtain thread information from RTOS.Where: STARTFLAG (one hex digit) is one toindicate the first query and zero toindicate a subsequent query; THREADCOUNT(two hex digits) is the maximum number ofthreads the response packet can contain;and NEXTTHREAD (eight hex digits), forsubsequent queries (STARTFLAG is zero), isreturned in the response as ARGTHREAD.NOTE: this query is replaced by the`q'`fThreadInfo' query (see above).reply`q'`M'COUNTDONEARGTHREADTHREAD...Where: COUNT (two hex digits) is thenumber of threads being returned; DONE(one hex digit) is zero to indicate morethreads and one indicates no furtherthreads; ARGTHREADID (eight hex digits) isNEXTTHREAD from the request packet;THREAD... is a sequence of thread IDs fromthe target. THREADID (eight hex digits).See `remote.c:parse_threadlist_response()'.compute CRC `q'`CRC:'ADDR`,'LENGTHof memoryblockreply `E'NN An error (such as memory fault)reply `C'CRC32 A 32 bit cyclic redundancy check of thespecified memory region.query sect `q'`Offsets' Get section offsets that the target usedoffs when re-locating the downloaded image._Note: while a `Bss' offset is included inthe response, GDB ignores this and insteadapplies the `Data' offset to the `Bss'section._reply`Text='XXX`;Data='YYY`;Bss='ZZZthread info `q'`P'MODETHREADIDrequestReturns information on THREADID. Where:MODE is a hex encoded 32 bit mode;THREADID is a hex encoded 64 bit thread ID.reply * See`remote.c:remote_unpack_thread_info_response()'.remote command `q'`Rcmd,'COMMANDCOMMAND (hex encoded) is passed to thelocal interpreter for execution. Invalidcommands should be reported using theoutput string. Before the final resultpacket, the target may also respond with anumber of intermediate `O'OUTPUT consoleoutput packets. _Implementors should notethat providing access to a stubs'sinterpreter may have securityimplications_.reply `OK' A command response with no output.reply OUTPUT A command response with the hex encodedoutput string OUTPUT.reply `E'NN Indicate a badly formed request.reply `' When `q'`Rcmd' is not recognized.The following `g'/`G' packets have previously been defined. In thebelow, some thirty-two bit registers are transferred as sixty-fourbits. Those registers should be zero/sign extended (which?) to fill thespace allocated. Register bytes are transfered in target byte order.The two nibbles within a register byte are transfered most-significant -least-significant.MIPS32 All registers are transfered asthirty-two bit quantities in theorder: 32 general-purpose; sr; lo;hi; bad; cause; pc; 32floating-point registers; fsr; fir;fp.MIPS64 All registers are transfered assixty-four bit quantities (includingthirty-two bit registers such as`sr'). The ordering is the same as`MIPS32'.Example sequence of a target being re-started. Notice how therestart does not get any direct output:<- `R00'-> `+'_target restarts_<- `?'-> `+'-> `T001:1234123412341234'<- `+'Example sequence of a target being stepped by a single instruction:<- `G1445...'-> `+'<- `s'-> `+'_time passes_-> `T001:1234123412341234'<- `+'<- `g'-> `+'-> `1455...'<- `+'File: gdb.info, Node: Server, Next: NetWare, Prev: Protocol, Up: Remote SerialUsing the `gdbserver' program.............................`gdbserver' is a control program for Unix-like systems, which allowsyou to connect your program with a remote GDB via `target remote'--butwithout linking in the usual debugging stub.`gdbserver' is not a complete replacement for the debugging stubs,because it requires essentially the same operating-system facilitiesthat GDB itself does. In fact, a system that can run `gdbserver' toconnect to a remote GDB could also run GDB locally! `gdbserver' issometimes useful nevertheless, because it is a much smaller programthan GDB itself. It is also easier to port than all of GDB, so you maybe able to get started more quickly on a new system by using`gdbserver'. Finally, if you develop code for real-time systems, youmay find that the tradeoffs involved in real-time operation make itmore convenient to do as much development work as possible on anothersystem, for example by cross-compiling. You can use `gdbserver' tomake a similar choice for debugging.GDB and `gdbserver' communicate via either a serial line or a TCPconnection, using the standard GDB remote serial protocol._On the target machine,_you need to have a copy of the program you want to debug.`gdbserver' does not need your program's symbol table, so you canstrip the program if necessary to save space. GDB on the hostsystem does all the symbol handling.To use the server, you must tell it how to communicate with GDB;the name of your program; and the arguments for your program. Thesyntax is:target> gdbserver COMM PROGRAM [ ARGS ... ]COMM is either a device name (to use a serial line) or a TCPhostname and portnumber. For example, to debug Emacs with theargument `foo.txt' and communicate with GDB over the serial port`/dev/com1':target> gdbserver /dev/com1 emacs foo.txt`gdbserver' waits passively for the host GDB to communicate withit.To use a TCP connection instead of a serial line:target> gdbserver host:2345 emacs foo.txtThe only difference from the previous example is the firstargument, specifying that you are communicating with the host GDBvia TCP. The `host:2345' argument means that `gdbserver' is toexpect a TCP connection from machine `host' to local TCP port 2345.(Currently, the `host' part is ignored.) You can choose any numberyou want for the port number as long as it does not conflict withany TCP ports already in use on the target system (for example,`23' is reserved for `telnet').(1) You must use the same portnumber with the host GDB `target remote' command._On the GDB host machine,_you need an unstripped copy of your program, since GDB needssymbols and debugging information. Start up GDB as usual, usingthe name of the local copy of your program as the first argument.(You may also need the `--baud' option if the serial line isrunning at anything other than 9600bps.) After that, use `targetremote' to establish communications with `gdbserver'. Its argumentis either a device name (usually a serial device, like`/dev/ttyb'), or a TCP port descriptor in the form `HOST:PORT'.For example:(gdb) target remote /dev/ttybcommunicates with the server via serial line `/dev/ttyb', and(gdb) target remote the-target:2345communicates via a TCP connection to port 2345 on host`the-target'. For TCP connections, you must start up `gdbserver'prior to using the `target remote' command. Otherwise you may getan error whose text depends on the host system, but which usuallylooks something like `Connection refused'.---------- Footnotes ----------(1) If you choose a port number that conflicts with another service,`gdbserver' prints an error message and exits.File: gdb.info, Node: NetWare, Prev: Server, Up: Remote SerialUsing the `gdbserve.nlm' program................................`gdbserve.nlm' is a control program for NetWare systems, whichallows you to connect your program with a remote GDB via `targetremote'.GDB and `gdbserve.nlm' communicate via a serial line, using thestandard GDB remote serial protocol._On the target machine,_you need to have a copy of the program you want to debug.`gdbserve.nlm' does not need your program's symbol table, so youcan strip the program if necessary to save space. GDB on the hostsystem does all the symbol handling.To use the server, you must tell it how to communicate with GDB;the name of your program; and the arguments for your program. Thesyntax is:load gdbserve [ BOARD=BOARD ] [ PORT=PORT ][ BAUD=BAUD ] PROGRAM [ ARGS ... ]BOARD and PORT specify the serial line; BAUD specifies the baudrate used by the connection. PORT and NODE default to 0, BAUDdefaults to 9600bps.For example, to debug Emacs with the argument `foo.txt'andcommunicate with GDB over serial port number 2 or board 1 using a19200bps connection:load gdbserve BOARD=1 PORT=2 BAUD=19200 emacs foo.txt_On the GDB host machine,_you need an unstripped copy of your program, since GDB needssymbols and debugging information. Start up GDB as usual, usingthe name of the local copy of your program as the first argument.(You may also need the `--baud' option if the serial line isrunning at anything other than 9600bps. After that, use `targetremote' to establish communications with `gdbserve.nlm'. Itsargument is a device name (usually a serial device, like`/dev/ttyb'). For example:(gdb) target remote /dev/ttybcommunications with the server via serial line `/dev/ttyb'.File: gdb.info, Node: KOD, Prev: Remote, Up: TargetsKernel Object Display=====================Some targets support kernel object display. Using this facility,GDB communicates specially with the underlying operating system and candisplay information about operating system-level objects such asmutexes and other synchronization objects. Exactly which objects can bedisplayed is determined on a per-OS basis.Use the `set os' command to set the operating system. This tellsGDB which kernel object display module to initialize:(gdb) set os ciscoIf `set os' succeeds, GDB will display some information about theoperating system, and will create a new `info' command which can beused to query the target. The `info' command is named after theoperating system:(gdb) info ciscoList of Cisco Kernel ObjectsObject Descriptionany Any and all objectsFurther subcommands can be used to query about particular objectsknown by the kernel.There is currently no way to determine whether a given operatingsystem is supported other than to try it.File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Targets, Up: TopConfiguration-Specific Information**********************************While nearly all GDB commands are available for all native and crossversions of the debugger, there are some exceptions. This chapterdescribes things that are only available in certain configurations.There are three major categories of configurations: nativeconfigurations, where the host and target are the same, embeddedoperating system configurations, which are usually the same for severaldifferent processor architectures, and bare embedded processors, whichare quite different from each other.* Menu:* Native::* Embedded OS::* Embedded Processors::* Architectures::File: gdb.info, Node: Native, Next: Embedded OS, Up: ConfigurationsNative======This section describes details specific to particular nativeconfigurations.* Menu:* HP-UX:: HP-UX* SVR4 Process Information:: SVR4 process informationFile: gdb.info, Node: HP-UX, Next: SVR4 Process Information, Up: NativeHP-UX-----On HP-UX systems, if you refer to a function or variable name thatbegins with a dollar sign, GDB searches for a user or system namefirst, before it searches for a convenience variable.File: gdb.info, Node: SVR4 Process Information, Prev: HP-UX, Up: NativeSVR4 process information------------------------Many versions of SVR4 provide a facility called `/proc' that can beused to examine the image of a running process using file-systemsubroutines. If GDB is configured for an operating system with thisfacility, the command `info proc' is available to report on severalkinds of information about the process running your program. `infoproc' works only on SVR4 systems that include the `procfs' code. Thisincludes OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but notHP-UX or Linux, for example.`info proc'Summarize available information about the process.`info proc mappings'Report on the address ranges accessible in the program, withinformation on whether your program may read, write, or executeeach range.`info proc times'Starting time, user CPU time, and system CPU time for your programand its children.`info proc id'Report on the process IDs related to your program: its own processID, the ID of its parent, the process group ID, and the session ID.`info proc status'General information on the state of the process. If the process isstopped, this report includes the reason for stopping, and anysignal received.`info proc all'Show all the above information about the process.File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: ConfigurationsEmbedded Operating Systems==========================This section describes configurations involving the debugging ofembedded operating systems that are available for several differentarchitectures.* Menu:* VxWorks:: Using GDB with VxWorksGDB includes the ability to debug programs running on variousreal-time operating systems.
