GDB GNU - Fifth Edition, for GDB version April 1998 Richard M. Stallman and Roland H. Pesch : GDB o o GDB GDB GDB o GDB o GDB o Shell GDB o o o GDB o o o o o o o o o o
o o Breakpoints, watchpoints, breakpoint watchpoint Breakpoint breakpoint breakpoint Disable Breakpoint Breakpoint o o o o o Backtraces o o o MIPS o o o o o o o o o o o Print o (Value Histor) o (Convenience variables) o o (Floating point hardware) GDB o working language GDB
o o o C C++ C C++ C C++ C++ C C++ C C++ GDB C C++ GDB Modula-2 Modula-2 Modula-2 Modula-2 ::. GDB Modula-2 o o o o o o GDB o o o (Active) o o o GDB stub stub Putting it all together
gdbserver gdbserve.nlm i960(nindy) GDB Nindy Nindy Nindy AMD29K UDI AMD29K EBMON EB29K Tandem ST2000 GDB GDB VxWorks VxWorks VxWorks GDB Sparclet Sparclet Sparclet GDB Hitachi Hitachi E7000 in-circuit emulator Hitachi micros GDB GDB MIPS CPU GDB o Prompt o o o o o o - o - (hooks) o o GNU Emacs GDB GDB
o? o GDB o GDB o o configure Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Published by the Free Software Foundation 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA Printed copies are available for $20 each. ISBN 1-882114-11-6 Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions. GDB GDB. --. GDB 4 ( )....
,. C C++ GDB., C C++. Modula-2 Chill. Modula-2, Modula-2. Chill. sets, subranges, Pascal. GDB,, Pascal.,, Fortran GDB Fortran.. GDB GNU General Public License(GPL). GPL. -- ( ). ; Free Software Foundation GPL., General Public License. GDB Richard Stallman GDB GDB... ;,. GDB `ChangeLog'. 2.0.
:. ( )., GDB.: Stan Shebs (release 4.14), Fred Fish (releases 4.13, 4.12, 4.11, 4.10, and 4.9), Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4), John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim Kingdon (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 3.1, and 3.0). GDB,. Peter TerMaat, Chris Hanson, Richard Mlynarik Richard Stallman 2.8. Michael Tiemann Per Bothner GDB GNU C++. James Clark C++ (demangler). C++ Peter TerMatt(3.0.). GDB 4 - BFD ; BFD David V.Henkel-Wallace, Rich Pixley, Steve Chamberlain, John Gilmore. David Johnson COFF ; Pace Willson COFF. Harris Computer Systems Brent Benson DWARF2. Adam de Boor Bradley Davis ISI Optimum V. Per Bothner, Noboyuki Hikichi, Alessandro Forin MIPS. Jean-Daniel Fekete Sun 386i. Chris Hanson HP9000. Noboyuki Hikichi Tomoyuki Hasei Sony/News OS 3. David Johnson Encore Umax. Jyrki Kuoppala Altos 3068. Jeff Law HP PA SOM. Keith Packard NS32K. Doug Rabson Acorn Risc Machine. Bob Rusk Harris Nighthawk CX-UX. Chris Smith Convex ( ). Jonathan Stone Pyramid. Michael Tiemann SPARC. Tim Tucker Gould NP1 Gould Powernode. Pace Willison Intel 386. Jay Vosburgh Symmetry. Rich Schaefer Peter Schauer SunOS.
Jay Fenlason Roland McGrath GDB GAS. Patrick Duval, Ted Goldstein, Vikram Koka Glenn Engel. Intel Corporation, Wind River Systems, AMD, ARM i960, VxWorks, A29K UDI, RDI targets. Brian Fox readline. SUNY Buffalo Andrew Beers -switch, Modula-2 Language chapter. Fred Fish Unix System Vr4. C++ -. Hitachi America, Ltd. Hitachi microprocessors. Kung Hsu, Jeff Law, Rick Sladkey watchpoints. Michael Snyder tracepoint. Stu Grossman gdbserver. Jim Kingdon, Peter Schauer, Ian Taylor, Stu Grossman GDB. Cygnus Solutions 1991 GDB. GDB GDB.,.., :input, GNU m4( ) :,
stop. m4, 0000 foo ; bar m4 defn., <QUOTE> <UNQUOTE>, baz. $ cd gnu/m4 $./m4 define(foo,0000) foo 0000 define(bar,defn(`foo')) bar 0000 changequote(<quote>,<unquote>) define(baz,defn(<quote>foo<unquote>)) baz C-d m4: End of input: 0: fatal error: EOF in string GDB. $ gdb m4 GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB, Copyright 1995 Free Software Foundation, Inc... (gdb) GDB.;,. GDB.. (gdb) set width 70
m4 changequote., m4_changequote, GDB break breakpoint. (gdb) break m4_changequote Breakpoint 1 at 0x62f4: file builtin.c, line 879. run, GDB m4 ; m4_changequote,. (gdb) run Starting program: /work/editorial/gdb/gnu/m4/m4 define(foo,0000) foo 0000 breakpoint, changequote. GDB m4. changequote(<quote>,<unquote>) Breakpoint 1, m4_changequote (argc=3, argv=0x33c70) at builtin.c:879 879 if (bad_argc(token_data_text(argv[0]),argc,1,3)) n(next). (gdb) n 882 set_quotes((argc >= 2)? TOKEN_DATA_TEXT(argv[1])\ : nil, set_quotes. next s (step). step any. set_quotes. (gdb) s set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>") at input.c:530 530 if (lquote!= def_lquote)
m4.. backtrace( bt) : backtrace. (gdb) bt #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>") at input.c:530 #1 0x6344 in m4_changequote (argc=3, argv=0x33c70) at builtin.c:882 #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242 #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30) at macro.c:71 #4 0x79dc in expand_input () at macro.c:40 #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195., `s' ;, xstrdup n. (gdb) s 0x3b5c 532 if (rquote!= def_rquote) (gdb) s 0x3b80 535 lquote = (lq == nil *lq == '\0')? \ def_lquote : xstrdup(lq); (gdb) n 536 rquote = (rq == nil *rq == '\0')? def_rquote\ : xstrdup(rq); (gdb) n 538 len_lquote = strlen(rquote); ; lquote rquote. p(print). (gdb) p lquote $1 = 0x35d40 "<QUOTE>" (gdb) p rquote $2 = 0x35d50 "<UNQUOTE>"
lquote rquote,., l(list) 10. (gdb) l 533 xfree(rquote); 534 535 lquote = (lq == nil *lq == '\0')? def_lquote\ : xstrdup (lq); 536 rquote = (rq == nil *rq == '\0')? def_rquote\ : xstrdup (rq); 537 538 len_lquote = strlen(rquote); 539 len_rquote = strlen(lquote); 540 } 541 542 void len_lquote len_rquote. (gdb) n 539 len_rquote = strlen(lquote); (gdb) n 540 } (gdb) p len_lquote $3 = 9 (gdb) p len_rquote $4 = 7 len_lquote len_rquote lquote rquote. p.. --. (gdb) p len_lquote=strlen(lquote) $5 = 7 (gdb) p len_rquote=strlen(rquote) $6 = 9
m4 defn? c(continue) m4.. (gdb) c Continuing. define(baz,defn(<quote>foo<unquote>)) baz 0000!.. EOF m4. C-d Program exited normally. `Program exited normally.' GDB ; m4. GDB quit GDB. (gdb) quit GDB GDB. : GDB `gdb'. quit C-d. GDB gdb GDB., GDB (exit). gdb.
-.;,. GDB 1. gdb program (core) : gdb program core ID. gdb program 1234 1234 GDB.( `1234' ; GDB.) OS.; bare GDB, " ".. -silent GDB gdb. gdb -silent - GDB. GDB. gdb -help.(`gdb -h'.). `-x'.
GDB, GDB ( ID). `-se' `-c'. (GDB `-se' ; `-c'.) long short ;. GDB. (, `-' `- -'.) -symbols file -s file file. -exec file -e file file. -se file file. -core file -c file file. -c number attach ID number. ( number -, `-c' ) -command file -x file file GDB.. -directory directory -d directory directory. -m -mapped : OS. - (memory-map) mmap,. `/tmp/fred', `./fred.syms'. GDB
. `.syms' GDB. GDB.. -r -readnow.. -mapped -readnow `.syms'. (.) `.syms' : gdb -batch -nx -mapped -readnow programname GDB --, -nx -n -quiet -q -batch ( `.gdbinit' ).,.. " ".... `-x'( `-n' ) 0. GDB 0. GDB.;. ( GDB.) Program exited normally. -cd directory
GDB directory. -fullname -f GNU Emacs GDB. ( ) GDB. `\032',,,. Emacs-to-GDB `\032'. -b bps GDB (baud rate bits per second). -tty device device. GDB quit GDB, quit( q). EOF ( C- d). expression, GDB ; expression. ( C-c) GDB GDB GDB.. GDB. GDB, detach. (.) Shell shell, GDB ; shell. shell command string
command string shell. shell, SHELL shell. GDB /bin/sh. make. GDB shell : make make-args make. `shell make make-args'. GDB GDB ; RET GDB. GDB TAB.( 1,.) GDB..., step `step 5'. step.. GDB..,.;, s s step. help. GDB ( RET ). (, run) ;. list x RET,..
GDB RET : more.(screen.) RET, GDB. # ;..(.) GDB.;. GDB, GDB,. TAB., GDB. ( RET.), (gdb) info bre TAB GDB `breakpoints'. `bre' info. (gdb) info breakpoints info breakpoints RET, backspace. ( info breakpoints, `info bre' RET.) TAB GDB. 2 TAB.; GDB., `make_' breakpoint. b make_tab GDB.TAB. : (gdb) b make_ TAB
GDB sounds bell; press TAB again, to see: make_a_section_from_file make_environ make_abs_section make_function_type make_blockvector make_pointer_type make_cleanup make_reference_type make_command make_symbol_completion_list (gdb) b make_, GDB ( `b make_')., TAB M-?. M-? META?. META shift? ESC?.., GDB '( ). C++. C++.( ), breakpoint, int name(int), float name(float). -, '. TAB M-? GDB. (gdb) b 'bubble( M-? bubble(double,double) bubble(int,int) (gdb) b 'bubble(, GDB., GDB.: (gdb) b bub TAB GDB. (gdb) b 'bubble(
,, GDB. help GDB. help h help( h). (gdb) help List of classes of commands: running -- Running the program stack -- Examining the stack data -- Examining data breakpoints -- Making program stop at certain points files -- Specifying and examining files status -- Status inquiries support -- Support facilities user-defined -- User-defined commands aliases -- Aliases of other commands obscure -- Obscure features Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help class help,., status. (gdb) help status Status inquiries. List of commands: show -- Generic command for showing things set with "set" info -- Generic command for printing status
Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help command help, GDB. complete args complete args. args. : complete i : info inspect ignore GNU Emacs. help, GDB GDB info show. ;. info show.. info set show ( i)., info args, info registers, info breakpoints breakpoint. help info info. set., GDB set prompt $ $-sign. info, show GDB. show set ;, set radix, show radix.,
show ; info set.. set 3 show. show version GDB. GDB -. GDB, GDB.; GDB. GDB. show copying GDB. show warranty GNU "NO WARRANTY". GDB GDB,. GDB.,,.,. ;.., `-g'. C `-g' `-O'.,. GNU C Compiler GCC `-g' `-O'. `-g'.,.
`-g -O', (optimizer).;.! :, GDB.--., `-g -O' `-g'., `-g'., (!). GNU C `-gg'. GDB ; GNU C,. run r GDB run. (VxWorks ) file exec-file.(.), run,. (, run.). GDB,.(,.) 4.. run. shell, shell (wildcard ). Unix, SHELL shell..
. GDB, GDB set environment unset environment... GDB. GDB cd GDB... GDB. run tty.. :,.;, GDB. run,.,., print call.. GDB, GDB., GDB breakpoint. run. shell, wildcard I/O. SHELL ( ) GDB shell. SHELL, GDB /bin/sh. run run set args. set args. set args, run
. run set args. show args GDB. environment.,,. shell.., GDB. path directory GDB PATH ( ) directory. `:' whitespace. directory,. GDB `$cwd'. `.', path. GDB directory directory ( ) `.'. show paths.(path ) show environment [varname] varname. varname,. env environment. set environment varname [=] value varname value. GDB. value ;. value ;, null., : set env USER = foo Unix `foo'. (`=' ;.) unset environment varname
varname. `set env varname =' ; unset environment. : shell ( /bin/sh) GDB SHELL shell. SHELL shell --C-shell `.cshrc', BASH `.bashrc'--. `.login' `.profile'. run, GDB. GDB, cd GDB. GDB GDB.. cd directory GDB directory. pwd GDB., GDB GDB. GDB. GDB. info terminal GDB. run shell., run > outfile
, `outfile'. tty. run. run,., tty /dev/ttyb run `/dev/ttyb'. run tty.. tty run,. GDB. attach process-id --GDB. (info files.) ID. Unix ID ps `jobs -l' shell. 2 RET attach. attach,.;, attach OS bare-.. attach, file... GDB. run GDB. breakpoint ; step continue ;
., GDB continue. detach, GDB detach.. detach, GDB attach run. RET detach. GDB run,., GDB.; set confirm.(.) kill GDB.. GDB. OS, GDB breakpoint GDB. kill. kill.. run, GDB. ( breakpoint ) OS `/proc'. GDB OS, info proc
. info proc procfs SVR4. info proc. info proc mappings,,. info proc times CPU, CPU. info proc id ID ; ID, ID, ID ID. info proc status.,. info proc all. OS,. OS,.-- (,.),. GDB. `thread threadno' `info threads' `thread apply [threadno] [all] args' thread breakpoints : OS GDB. GDB,., `info threads' thread.:
(gdb) info threads (gdb) thread 1 Thread ID 1 not known. Use the "info threads" command to see the IDs of currently known threads. GDB. -- GDB,. current thread.. GDB, `[New systag]'. systag., LynxOS ; [New process 35 thread 27] GDB., SGI systag `process 368'., GDB -- --. info threads. GDB.: 1. GDB 2. (systag) 3. GDB `*'., (gdb) info threads 3 process 35 thread 27 0x34e5 in sigpause () 2 process 35 thread 23 0x34e5 in sigpause () * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8) at threadtest.c:68 thread threadno threadno. threadno `info threads' GDB. GDB ; (gdb) thread 2
[Switching to process 35 thread 23] 0x34e5 in sigpause () `[New...]', `Switching to'. thread apply [threadno] [all] args thread apply. threadno. threadno `info threads'., thread apply all args. GDB breakpoint, signal, GDB breakpoint signal. GDB `[Switching to systag]'. GDB,. watchpoint watchpoints. GDB fork. fork, GDB. breakpoint, ( ) SIGTRAP.,,. fork sleep. sleep. sleep, ID ps. GDB( GDB ) (.).,.
.;,. GDB, signal, breakpoint step GDB. breakpoint., GDB.--. info program.:,. Breakpoints, watchpoints, breakpoint. breakpoint. break (breakpoints.) breakpoint.. (GNU C++ ), (Breakpoints.) breakpoint. SunOS 4.x, SVR4 Alpha OSF/1, breakpoint. watchpoint breakpoint. watchpoint(watchpoints.). breakpoint watchpoint : breakpoint watchpoint,. GDB breakpoint.. GDB breakpoint watchpoint ; 1. breakpoint, breakpoint breakpoint. breakpoint enabled disabled.;
diabled, breakpoint. breakpoints Breakpoint break ( b). `$bpnum' breakpoint ;. breakpoint. break function function function breakpoint. C++, function break., Breakpoint. break +offset break -offset, breakpoint. break linenum linenum breakpoint.. breakpoint. break filename:linenum filename linenum breakpoint. break filename:function filename function breakpoint.. break *address address breakpoint. breakpoint. break, break breakpoint.(.),. finish.-- finish breakpoint. break, GDB ;. GDB
breakpoint., breakpoint disable brekapoint. breakpoint. break... if cond cond breakpoint.; breakpoint cond, 0.--, cond. `...'. breakpoint Break. tbreak args breakpoint. Set a breakpoint enabled only for one stop. args break, breakpoint. breakpoint. breakpoints disable. hbreak args - breakpoint. args break breakpoint. breakpoint. EPROM/ROM, breakpoint. SPARClite DSU trap-. DSU trap. breakpoint breakpoint GDB. breakpoint delete disable. Break conditions. thbreak args - breakpoint. args hbreak breakpoint., tbreak, breakpoint., hbreak, breakpoint. breakpoints disable., Break. rbreak regex regex breakpoint. breakpoint breakpoint. breakpoint, break breakpoint., disable breakpoint. C++, rbreak breakpoint. info breakpoints [n]
info break [n] info watchpoints [n] Print a table of all breakpoints and watchpoints set and not deleted, with the following columns for each breakpoint: Breakpoint Numbers Type breakpoint watchpoint. Disposition breakpoint disable deleted. Enabled or Disabled enable breakpoint `y'. `n' enable breakpoint. Address breakpoint. What breakpoint. breakpoint, info break breakpoint.;, breakpoint. breakpoint number n info break breakpoint. $_ x - breakpoint. (..) info break breakpoint. ignore. breakpoint, breakpoint breakpoint info. breakpoitn. GDB breakpoint.. breakpoint,. (Break.). GDB longjmp(c ) breakpoint. breakpoint -1.; `info breakpoints'. GDB `maint info breakpoints' breakpoint. maint info breakpoints Using the same format as `info breakpoints', breakpoint. GDB. breakpoint breakpoint
. breakpoint.: breakpoint, breakpoint. watchpoint, watchpoint. Normal, explicitly set watchpoint. longjmp longjmp stepping breakpoint longjmp resume longjmp breakpoint until GDB until breakpoint. finish GDB finish breakpoint. watchpoints watchpoint. Watchpoint breakpoint 2.. watch expr watchpoint. GDB expr break. SPARC lite DSU trap-. DSU trap. breakpoint register watchpoint. watchpoint., watch, rwatch, awatch watchpoint. watchpoint. watchpoint. watchpoint disable. rwatch expr args break watchpoint. watchpoint, rwatch. awatch expr
args break watchpoint. watchpoint, awatch. info watchpoints watchpoint breakpoint.; info break. : -, watchpoint. watchpiont, GDB. ( ), watchpoint., GDB. Breakpoints GNU C++. GDB. catch exceptions catch breakpoint. exceptions. info catch.. GDB.:, GDB., breakpoint. breakpoint GDB... catch :, before..
breakpoint,.,. GNU C++, ANSI C raise_exception. /* addr is where the exception identifier is stored. ID is the exception identifier. */ void raise_exception (void **addr, void *id);, raise_exception breakpoint. (Breakpoints, watchpoints,.) id breakpoint(break conditions >),. breakpoint. breakpoints breakpoint watchpoint. breakpoint. breakpoint ;. clear breakpoint. delete breakpoint breakpoint watchpoint. brekapoint. GDB breakpoint. clear breakpoint. (.), breakpoint. clear function clear filename:function function breakpoint. clear linenum
clear filename:linenum breakpoint. delete [breakpoints] [bnums...] breakpoint watchpoint., breakpoint.( set confirm off GDB.) d. breakpoints Disable breakpoint watchpoint, disable. breakpoint. breakpoint. enable. breakpoint, enable, disable breakpoint watchpoint disable, enable., breakpoint watchpoint info break info watch. breakpoint watchpoint 4. Enabled. breakpoint. break breakpoint. Diabled. breakpoint. Enabled once. breakpoint. disable. tbreak breakpoint. Enabled for deletion. breakpoint,. breakpoint watchpoint enable, disable : disable [breakpoints] [bnums...] breakpoint Disable --, breakpoit. disabled breakpoint. ignore-count, condition breakpoint enable. dis disable. enable [breakpoints] [bnums...] breakpoint ( breakpoint) Enable.. enable [breakpoints] once bnums...
breakpoint Enable. GDB breakpoint disable. enable [breakpoints] delete bnums... breakpoint enable. GDB breakpoint. tbreak(setting breakpoints.) breakpoint, breakpoint enable ;, disable enable.( until breakpoint. breakpoint ;.) breakpoint. breakpoint condition. Boolean.(.) breakpoint. true. ;,. --,. C, assert, breakpoint `! assert'. watchpoint.; watchpoint.-- watchpoint....,. enable breakpoint.(, GDB breakpoint.) breakpoint breakpoint. break `if', breakpoint. breakpoints. condition. watch if
; condition watchpoint. condition bnum expression breakpoint watchpoint bnum break expression., expression (C 0 ) breakpoint bnum. condition, GDB expression. breakpoint. GDB condition expression. Expressions. condition bnum breakpoint bnum. breakpoint. breakpoint breakpoint. breakpoint ignore count. breakpoint ignore count., ignore count 0. ignore count breakpoint, ignore count. ignore count n, breakpoint n. ignore bnum count ignore count breakpoint bnum count. count breakpoint, ; ignore count GDB. breakpoint, count 0. breakpoint continue, ignore continue ignore count. (stepping). breakpoint ignore count,. ignore count 0, GDB. `$foo-- <= 0' ignore count.. Breakpoint breakpoint breakpoint( watchpoint)., breakpoint. commands [bnum]
... command-list... end breakpoint bnum.. end. breakpoint, commands end.;,. bnum, commands breakpoint watchpoint.( breakpoint ) GDB RET command-list disable. breakpoint. continue step.,. ( next step ), breakpoint.--. silent, breakpoint. breakpoint continue., breakpoint. silent breakpoint. echo, output, printf. breakpoint.., x foo x breakpoint. break foo if x>0 commands silent printf "x is %d\n",x cont end breakpoint.. breakpoint.
. continue silent. : break 403 commands silent set x = y + 4 cont end Breakpoint ( C++),. overloading., `break function' breakpoint GDB., `break function(types)'., GDB breakpoint. `>'. `[0] cancel' `[1] all'. 1 function breakpoint 0 breakpoint break., String::after breakpoint. 3.: (gdb) b String::after [0] cancel [1] all [2] file:string.cc; line number:867 [3] file:string.cc; line number:860 [4] file:string.cc; line number:875 [5] file:string.cc; line number:853 [6] file:string.cc; line number:846 [7] file:string.cc; line number:735 > 2 4 6 Breakpoint 1 at 0xb26c: file String.cc, line 867. Breakpoint 2 at 0xb344: file String.cc, line 875. Breakpoint 3 at 0xafcc: file String.cc, line 846. Multiple breakpoints were set. Use the "delete" command to delete unwanted breakpoints.
(gdb) Continuing., stepping "step". "step" (.)., breakpoint. (, handle `signal 0'..) continue [ignore-count] c [ignore-count] fg [ignore-count] ; breakpoint. ignore-count breakpoint ; ignore.(break.) ignore-count breakpoint., continue. c fg continue., return(.).; jump(.). stepping breakpoint(breakpoints, watchpoints, exceptions.). breakpoint step. step. GDB. s. : step,.,
step. step stepi. step. switch. step., step. next. MIPS cc - gl., step. step count step, count. breakpoint step count, steppint. next [count] ( ). step,. next. n. count step. next. switch. finish.. return.(.) u until. stepping. until next. stepping, until., next. until. until.,, f(frame) 206 ; until, 195. (gdb) f
#0 main (argc=4, argv=0xf7fffae8) at m4.c:206 206 expand_input(); (gdb) until 195 for ( ; argc > 0; NEXTARG) {.--C for-. until.; --. until stepping. until. until location u location. location break.(setting breakpoints.) breakpoint. until. stepi si.. stepping `display/i $pc'. GDB.. step. nexti ni.. next.. OS., Unix SIGINT (C-c).; SIGSEGV.; SIGALRM alarm. ( ) SIGALRM. SIGSEGV,.; ( ). SIGINT.
GDB. GDB., GDB SIGALRM. ( ) handle. info signals GDB.. info handle info signals. handle signal keywords... GDB signal. signal ( `SIG' ). keywords. handle. : nostop stop GDB.. GDB. print. print GDB. noprint GDB. nostop. pass GDB ;. nopass GDB., continue. pass., GDB continue pass nopass handle.
signal.,, continue.;., `signal 0'.. (.), breakpoint. break linespec thread threadno break linespec thread threadno if... linespec.;. breakpoint breakpoint `thread threadno'. threadno `info threads' GDB. breakpoint `thread threadno', breakpoint. breakpoint thread. ;, breakpoint `thread threadno'. (gdb) break frik.c:13 thread 28 if bartab > lim GDB,..,. step next stepping., GDB stepping. OS(GDB.), step.,.
continue -stepping. breakpoint,.,....., GDB. GDB selected GDB., GDB. GDB.., GDB frame. (.) stack frames frames.;.., main. initial outermost.,.,.,. innermost..
,. ;. frame pointer register. GDB innermost 0, 1. ; GDB GDB..(, gcc `-fomit-frame-pointer'.). GDB. innermost, GDB. 0., GDB. frame args frame. args., frame. select-frame select-frame. frame. Backtraces backtrace. ( 0) ( 1). backtrace bt backtrace :. C-c backtrace. backtrace n bt n
, innermost n. backtrace -n bt -n, outermost n. where info stack( infos) backtrace. backtrace..-- set print address off. backtrace.. backtrace. 3 `bt 3'. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993 #1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) at macro.c:71 (More stack frames follow...) 0, builtin.c 993...;. frame n f n n. 0, 1 1. main. frame addr f addr addr..,. SPARC, frame
2.;. MIPS Alpha 2 :. 29k 3 :,,. up n n. n,,,. n 1. down n n. n,,,. down do. 2.,,,.. : (gdb) up #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) at env.c:10 10 read_input_file (argv[i]);, list 10.. up-silently n down-silently n up down.;... frame f,. f.,..
info frame info f.: ( ) ( ) ( ). info frame addr info f addr, addr.. frame.( 1 )... info args. info locals. ( ). info catch.,.(up, down frame ); info catch. Breakpoints. MIPS MIP. GDB. ( GDB ),.: set heuristic-fence-post limit limit GDB. 0., 0
heuristic-fence-post.. show heuristic-fence-post. GDB MIP. GDB.., GDB., GDB. (.). GNU Emacs GDB, Emacs.; GNU Emacs GDB. list. ( l)., 10.. list.: list linenum linenum. list function function. list. list,.;, (.),. list -.
, GDB list 10. set listsize. set listsize count list count.( list ) show listsize list. RET list. list.. `-' ;., list 0, 1 2 linespecs. linespec ;,. list : list linespec linespec. list first,last first last. linespecs. list,last last. list first, first. list +. list -. list. -- linespec number number. number linespec, linespec. +offset line offset. list linespecs, linespec offset. -offset line offset.
filename:number filename number. function function body. : C, open brace. filename:function filename function body open-brace.,. *address address. address.. forward-search regexp search regexp `forward-search regexp' regexp,.. `search regexp' fo. reverse-search regexp `reverse-search regexp' regexp,.. rev..,. GDB.; source path. GDB, GDB..,. GDB, GDB.,, GDB.
, GDB. GDB,., directory. directory dirname... dir dirname... dirname. `:' whitespace..;. GDB. `$cdir'. `$cwd'. `$cwd' `.'. -- GDB.. directory.. show directories :., GDB. : 1. directory. 2. directory. ( ) info line. disassemble. GNU Emacs, info line., info line. info line linespec linespec. list (.).
, m4_changequote info line.: (gdb) info line m4_changecom Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350. (linespec *addr ) : (gdb) info line *0x63ff Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404. info line, x. `x/i' (.)., $_(.). disassemble.. ; GDB. (, ). info line ( SPARC.) disassemble.: (gdb) disas 0x63e4 0x6404 Dump of assembler code from 0x63e4 to 0x6404: 0x63e4 <builtin_init+5340>: ble 0x63f8 <builtin_init+5360> 0x63e8 <builtin_init+5344>: sethi %hi(0x4c00), %o0 0x63ec <builtin_init+5348>: ld [%i1+4], %o0 0x63f0 <builtin_init+5352>: b 0x63fc <builtin_init+5364> 0x63f4 <builtin_init+5356>: ld [%o0+4], %o0 0x63f8 <builtin_init+5360>: or %o0, 0x1a4, %o0 0x63fc <builtin_init+5364>: call 0x9288 <path_search> 0x6400 <builtin_init+5368>: nop End of assembler dump. set assembly-language instruction-set disassemble x/i.. Intel x86
. i386 i8086 instructionset. i386. print ( p) inspect.. ( GDB ). print exp print /f exp exp ( ). exp.; `/f'. f.;. print print /f exp, GDB. (value history ; Value history ).. low-level x... print ptype exp.. print GDB., GDB.,,. #define. GDB. {element, element...}., malloc print {1, 2, 3}.
C C. GDB., GDB. C.. GDB.: @ `@'.. :: `::'.. {type} addr addr type. addr. (.). addr... (.);.: global (or static).. foo (a) int a;
{ bar (a); { int b = test (); bar (b); } } foo a. b b. :. ( ) 1.,., -. file::variable function::variable file function variable., GDB. --, `f2.c' x : (gdb) p 'f2.c'::x `::' C++. GDB GDB C++. :,. --., 1. ( );.,
1 ;..; `@' artificial array. operand of `@'.. ;.., int *array = (int *) malloc (len * sizeof (int)); array. p *array@len `@'. `@'.. (Value history )....: (gdb) p/x (short[2])0x12345678 $1 = {0x1234, 0x5678}, (`(type)[])value') GDB. (`sizeof(value)/sizeof(type)': (gdb) p/x (short[])0x12345678 $2 = {0x1234, 0x5678} ;. --,
. ( (Convenience variables).). RET., dtab fv. : set $i = 0 p dtab[$i++]->fv RET RET..., GDB.., 16 10.... print (/). : x d u o t a. 16. 10. 10. 8.. `t' "two". (1) 16. ( ). (gdb) p/a 0x54320 $3 = 0x54320 <_initialize_vx+396>
c f.., 16 (PC). (Registers ) p/x $pc (/).: GDB (/)., print., `p/x' 16. x. x/nfu addr x addr x x. n, f, u. ; addr. nfu, `/'. addr. n, 10 ; 1. (u ). f, print `s' ( ), `i' ( ), `x' (16 ). x print. u,
. b. h halfword(2 ) w (4 ).. g Giant-word(8 ) x, x. (`s' `i',.) addr, addr GDB. ;.. addr. - : info breakpoints ( breakpoint ), info line ( ), print ( )., `x/3uh 0x54320' 10 (`u') 0x54320 3 halfwords (h). `x/4xw $sp' 16 (, `$sp' ;Registers.) 4 (`w').,. `4xw' `4wx'. (, n ; `wx4'.) u `s' `i', n.;, `3i' 3. disassemble.. x x.., `x/3i addr', `x/7' 7. x RET, n ; x.
x., GDB $_ and $. x, $_. $. x, ;. ( ), GDB automatic display list. ;. : 2: foo = 38 3: bar[5] = (struct hack *) 0x3804,. x print,. ;, display print x. -- x (`i' and `s') GDB x.; GDB print. display exp exp.. display RET display. display/fmt exp fmt, exp. fmt.. display/fmt addr fmt `i' `s',, addr. `x/fmt addr'..
, `display/i $pc'. (`$pc' ; Registers.). undisplay dnums... delete display dnums... dnums. RET undisplay. ( `No display number...'.) disable display dnums... dnums... enable display dnums... dnums.. display,. info display. disable...,. disable., last_char, display last_char, GDB. --- ( last_char ) --- disable. last_char. Print GDB,. : set print address set print address on
GDB,,, breakpoints. on., set print address on : (gdb) f #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") at input.c:530 530 if (lquote!= def_lquote) set print address off., set print address off.: (gdb) set print addr off (gdb) f #0 set_quotes (lq="<<", rq=">>") at input.c:530 530 if (lquote!= def_lquote) GDB `set print address off'., print address off backtrace. -- show print address. GDB,. (, ),. info line, `info line *0x4537'., GDB. set print symbol-filename on GDB. set print symbol-filename off.. show print symbol-filename GDB..; GDB.
,. set print max-symbolic-offset max-offset max-offset GDB. 0 GDB. show print max-symbolic-offset GDB., `set print symbol-filename on'. `p/a pointer'.., GDB `hi2.c' ptt t.: (gdb) set print symbol-filename on (gdb) p/a ptt $4 = 0xe008 <t in hi2.c> :, `p/a' set print.. set print array set print array on... set print array off. Return to compressed format for arrays. show print array. set print elements number-of-elements GDB. GDB, GDB set print elements.. number-of-elements 0. show print elements
GDB. 0,. set print null-stop NULL GDB.. set print pretty on GDB.: $1 = { next = 0x0, flags = { sweet = 1, sour = 1 }, meat = 0x54 "Pork" } set print pretty off GDB : $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \ meat = 0x54 "Pork"}. show print pretty GDB. set print sevenbit-strings on 7- ;, GDB \nnn 9- ( ). (ASCII) "meta". set print sevenbit-strings off 8.. show print sevenbit-strings 7- GDB. set print union on GDB.. set print union off GDB. show print union GDB.,
typedef enum {Tree, Bug} Species; typedef enum {Big_tree, Acorn, Seedling} Tree_forms; typedef enum {Caterpillar, Cocoon, Butterfly} Bug_forms; struct thing { Species it; union { Tree_forms tree; Bug_forms bug; } form; }; struct thing foo = {Tree, {Acorn}};. set print union on `p foo'. $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}} set print union off. $1 = {it = Tree, form = {...}} C++. set print demangle set print demangle on type-safe linage ("mangled") C++. `on'. show print demangle C++ mangle demangle. set print asm-demangle set print asm-demangle on, mangle C++. off. show print asm-demangle C++ mangle demangle. set demangle-style style C++. style : auto GDB. gnu GNU C++ (g++).. lucid
Lucid C++ (lcc). arm C++ Annotated Reference Manual. : cfront. GDB. foo. show demangle-style C++. set print object set print object on, declared actual. set print object off,.. show print object. set print static-members set print static-members on C++. on. set print static-members off C++. show print static-members C++. set print vtbl set print vtbl on C++. off. set print vtbl off C++. show print vtbl C++. print GDB...( file symbol-file.),..
. 1. print `$num = '.; num., `$'. $. $$. $$n n.; $$2 $$, $$1 $$ $$0 $.,.. p *$ next, : p *$.next.-- RET.. x 4 : print x set x=5 x, print 4. show values item 10. show values, `p $$9' 10. show values n item n 10. show values + 10., show values +.
show values n RET `show values +'. GDB GDB. GDB ;.. `$'. - (.), `$'. (, `$' numbers..),. : set $foo = *object_ptr object_ptr $foo.. void...,,.,. show convenience. show con.., : set $i = 0
print bar[$i++]->contents RET. GDB. $_ $_ (.) x. x $_.: info line info breakpoint. $_ $ x, void *. $ $ x.. $_exitcode $_exitcode. `$',..; info registers. info registers ( ). info all-registers. info registers regname... regname.,. regname `$',. GDB ( ) 4 " ".--. $pc $sp. $fp $ps.,.
p/x $pc. x/i $pc (2) 4. set $sp += 4, 4,. info registers., SPARC info registers $psr, $ps. GDB. ;..( `print/f $regname' print ) "raw" "virtual". OS., 68881 "extended" (raw). C "double" (virtual)., GDB virtual ( ). info registers., (.).., (`frame 0')., GDB., GDB,.
set rstack_high_address address AMD 29000, "register stack". GDB., GDB "large enough"., set rstack_high_address., 16 `0x'. show rstack_high_address AMD 29000,., GDB. info float.., `info float' ARM x86. GDB,., ANSI C p *p, Modula-2 p^.. C 16 `0x1ae' Modula-2 `1AEH'. GDB GDB. working language.. working language 2.--GDB. set language., GDB. working language,.
working language, GDB working language.,., GDB. C++ demangle. -- backtrace. GDB. C cfront f2c., C #line.; GDB. C., GDB. `.mod' Modula-2 `.c' C source file `.C' `.cc' `.cxx' `.cpp' `.cp' `.c++' C++ `.ch' `.c186' `.c286' CHILL `.s' `.S'. C, GDB stepping prologue. working language GDB,.
,., `set language lang'. lang c modula-2., `set language'. GDB working language. working language -- --., C, GDB Modula-2 : print a = b + c. C, b c a. a. Modula-2, a b+c. BOOLEAN. GDB working language GDB, `set language local' `set language auto'. GDB working language., ( breakpoint ), GDB working language. (, ), working language. GDB..,. `set language auto' working language. working language.. show language working language. print. info frame
. working language.,. info source.,. :, GDB.. -... GDB. GDB, print GDB. working language, GDB.,. Modula-2.., 1 + 2 => 3 but error--> 1 + 2.3. CARDINAL 1 REAL 2.3. GDB, GDB ; ;
., GDB,., GDB., GDB int struct foo...., Modula-2 C. C,,.. GDB : set check type auto working language.. set check type on set check type off working language on off.. on, GDB. set check type warn.., GDB. show type, GDB. (Modula-2 ), ;.,. GDB, GDB :,.
,.,. C, "wrap around".--, m, s, m + 1 => s.. GDB : set check range auto working language on off.. set check range on set check range off working language on off.. on, GDB. set check range warn GDB..,.( ) show range, GDB. GDB 4 C, C++ Modula-2. GDB.: GDB @ ::, `{type}addr' (.). GDB., GDB..
;. C C++ C C++, GDB.,. C++ GNU C++ GDB., C++, GNU C++ g++ C++. C++, stab. g++ `-gstabs' `-gstabs+'. Using GNU CC `Options for Debugging Your Program or GNU CC'. C C++., +.. C C++, : Integral types - int. ; char; enum. Floating-point types float double. Pointer types (type*). Scalar types..., = op=?:..... a op= b, a = a op b. op= =. op, ^, &, <<, >>, +, -, *, /, %. 3. a? b : c : a b, c. a.
OR.. && AND.. Bitwise OR.. ^ Bitwise exclusive-or.. & Bitwise AND.. ==,!=.. 0 0. <, >, <=, >=,,,.. 0 0. <<, >>.. @ GDB " " (.). +, -.,,. *, /, %,,.,.. ++, --,., ;,. *.. ++. &.. ++. C++, GDB C++ `&'.: C++ (`&ref' ) `&(&ref)`.(,, `&&ref') -.. ++.!.. ++. ~ Bitwise.. ++.., ->
[] () :: ::,., GDB,. struct union.. a[i] *(a+i). ->.. ->. C++. struct, union, class. GDB. (Expressions.). ::. C, C++ GDB C C++.:. 8 `0'(, 0), 16 `0x' `0X'. `l'. long.,,. : `e[[+] -]nnn', nnn. `+'.. (') -- (ASCII ) --., escape sequences, `\nnn', nnn 8 (ASCII ).; `\x', `x' --, newline `\n' (").. C `&'. `{' `}'.;, `{1,2,3}' 3 -, `{{1,2}, {3,4}, {5,6}}' three-by-two `{&"hi", &"there", &"fred"}' 3. C++ GDB C++.
: GNU C++ GDB C++., C++. GDB stab., stab a.out, MIPS ECOFF, RS/6000 XCOF, ELF,. (GNU CC, stab `-gstabs'.) COFF ELF DWARF,, GDB C++. 1..;. 2. 3. count = aml->getoriginal(x, y) 4. ( ),.:, GDB C++ this. 5. ; GDB.--. GDB -. 6. GDB C++ ; C++ --. GDB, ( );.. `set print address off', address. 7. GDB C++ :: --.,, `scope1::scope2::name' ::. GDB C, C++ (.). C C++
GDB, C C++ off. GDB. GDB, `.c', `.C', or `.cc', GDB, GDB C C++. GDB.. C C++, GDB C C++,.,, GDB. o o. typedef.,..,. GDB C set print union show print union union. `on', struct class union., `{...}'. @.. C++ GDB GDB C++. C++. : breakpoint menus breakpoint, GDB breakpoint menus. Breakpoint menus.
rbreak regex breakpoint brekapint. breakpoints. catch exceptions info catch C++. Breakpoints. ptype typename typename.. set print demangle show print demangle set print asm-demangle show print asm-demangle C++ C++.. set print object show print object.. set print vtbl show print vtbl.. Overloaded symbol names C++,.: symbol symbol(types). GDB -.,. Modula-2 Modula-2 GDB GNU Modula-2 ( ). Modula-2, GDB.., +.. Modula-2, :
o o o o o o o Integral types INTEGER, CARDINAL,. Character types CHAR. Floating-point types REAL. Pointer types POINTER TO type. Scalar types. Set types SET BITSET. Boolean types BOOLEAN..:,. :=. var := value value. <, >,,. <=, >=,,,,,. <. =, <>, #,. <. GDB, <>. #. IN.. <. OR OR.. AND, & AND.. @ GDB " " (Expressions.) +, -, * Multiplication on integral and floating-point types, or set intersection on set types. /. *. DIV, MOD.. *.
-. INTEGER REAL. ^.. NOT.. ^.. RECORD. RECORD. ^. []. ARRAY. ^. (). PROCEDURE. ^. ::,. GDB Modula-2. : Sets and their operations are not yet supported, so GDB treats the use of the operator IN, or the use of operators +, -, *, /, =,, <>, #, <=, and >= on sets as an error. Modula-2.,. a ARRAY. c CHAR. i. m. s. s SET OF mtype. (mtype m.) n. r. t. v.
x.. Modula-2. ABS(n) n. CAP(c) c,.,. CHR(i) i. DEC(v) v.. DEC(v,i) i v.. EXCL(m,s) s m.. FLOAT(i) i. HIGH(a) a. INC(v) v.. INC(v,i) i v.. INCL(m,s) m s.. MAX(t) t. MIN(t) t. ODD(i) i TRUE. ORD(x)., ASCII.( ASCII ). x,. SIZE(x). x. TRUNC(r) r. VAL(t,i)
i t. :. GDB INCL EXCL. GDB Modula-2.: o o o o o o o o., -. 16 `H' 8 `B'. 10. `E[+ -]nnn'. `[+ -]nnn'. 10. (') ("). (ASCII ), `C'. (') ("). C. C C++.. TRUE FALSE... Modula-2 GDB, Modula-2 on. GDB. GDB, `.mod' Modula-2. GDB. Modula-2
Modula-2..: o o o o Modula-2,..( Modula-2, ;.) C. GDB. - `CHR(nnn)'. (:=).. Modula-2 :, GDB. GDB Modula-2.: o o TYPEt1 = t2..( : GNU Modula-2,.) enable,.,,,. ::. Modula-2 (.) GDB (::). : module. id scope :: id
scope, module id. :: id scope GDB., GDB scope. module id. GDB., id module id module. GDB Modula-2 GDB Modula-2. set print show print C C++ : `vtbl', `demangle', `asm-demangle', `object', and `union' 4 C++ C union Modula-2. @ ( ) Modula-2. C C++ Modula-2 dynamic arrays.,, `{type}adrexp'. (.) GDB, Modula-2 #. <>. (, ).. GDB GDB ( ), - ( ).,, GDB. ( ).
, GDB 3 `foo' `.' `c' `foo.c'. GDB `foo.c', ;, p 'foo.c'::x `foo.c' x. info address symbol symbol.,. -, -. `print &symbol',. whatis exp exp. exp, ( ).. whatis $. ptype typename typename. typename `class class-name', `struct struct-tag', `union union-tag' `enum enum-tag' C. ptype exp ptype exp. ptype whatis., : struct complex {double real; double imag;} v; : (gdb) whatis v type = struct complex (gdb) ptype v type = struct complex { double real; double imag; } whatis, $ ptype.
info types regexp info types regexp(, ). ;`i type value' value. `i type ^value$' value. ptype :, whatis ;,. info source --, --. info sources, : info functions. info functions regexp, regexp., `info fun step' step.; `info fun ^step' step. info variables.(,.) info variables regexp ( ). regexp.., VxWorks., GDB. set symbol-reloading on. set symbol-reloading off. ;, symbol-reloading off. GDB (
). show symbol-reloading on off. maint print symbols filename maint print psymbols filename maint print msymbols filename filename. GDB -.. `maint print symbols', GDB. info sources. `maint print psymbols', GDB.--, GDB,., `maint print msymbols' GDB. GDB (symbol-file ),.,. GDB,.,.,,.,.., print x=4 4 x,., GDB.
, print set. set ( ) print.. set set, set set variable. set., width, `set width=13'., GDB set width.: (gdb) whatis width type = double (gdb) p width $4 = 13 (gdb) set width=47 Invalid syntax in expression. `=47'. width,. (gdb) set var width=47 GDB C.;.., ( ) `{...}'., {int} 0x83040 0x83040. set {int}0x83040 = 4 4.
,, continue.. jump linespec linespec. breakpoint. linespec,. jump,,. linespec,., jump.,. jump *address address. $pc jump. ; continue., set $pc = 0x485 continue 0x485 stepping.. jump -- breakpoint --. signal signal. signal. signal., signal 2 signal SIGINT., signal 0.
continue.;`signal 0'. signal RET. signal kill. kill GDB. ( ). signal. return return expression return. expression,. return, GDB ( ).., return. (.)... return.;., finish (.). call expr void expr. void, print. void,.
-, call_scratch_address GDB.., GDB ( ). ;., set write.,. set write on set write off `set write on', GDB.; `set write off'( ), GDB -., set write,.(exec-file core-file ) show write -. GDB GDB., GDB.. GDB. (GDB.) GDB. GDB. GDB.
file filename filename.. run. GDB, shell GDB PATH. path GDB,., `filename.syms' filename., GDB `filename.syms'. `-mapped' `-readnow'. (, file, symbol-file, add-symbol-file.) file file GDB. exec-file [ filename ] ( ) filename., GDB PATH. filename. symbol-file [ filename ] filename. PATH. file. symbol-file GDB. symbol-file GDB, breakpoint., GDB. RET, symbol-file. GDB, GDB.; GNU. GNU.;, gcc,., symbol-file.,.. GDB.,.(set verbose..)
COFF. COFF, symbol-file. symbol-file filename [ -readnow ] [ -mapped ] file filename [ -readnow ] [ -mapped ] GDB, `-readnow' 2. mmap, GDB, `-mapped'. GDB ( ). `-mapped' `-mapped' GDB.. myprog `myprog.syms'., myprog GDB. `.syms' GDB. GDB.. core-file [ filename ] " ".,.; GDB. core-file. GDB.,,., kill. (.) load filename GDB, load., filename.--,. load add-symbol-file, GDB filename. GDB load, "You can't do that when your target is...".., ; a.out,. VxWorks, load GDB
filename. Intel 960 board Nindy, load GDB 960 filename. Hitachi SH, H8/300, H8/500 board, load Hitachi board(gdb Hitachi microprocessors.) (file ) GDB. RET load. add-symbol-file filename address add-symbol-file filename address [ -readnow ] [ -mapped ] add-symbol-file filename. filename. address ; GDB. address. filename symbol-file. ADD- SYMBOL-FILE ;., symbol-file. RET, addsymbol-file. GDB filename symbol-file, `- mapped' and `-readnow'. add-shared-symbol-file add-shared-symbol-file Motorola 88k OS Harris' CXUX. GDB. GDB, add-sharedsymbol-file.. section section SECTIO ADDR. exec,.. "info files". info files info target info files info target ; GDB. (.) help target.. GB.
GDB SunOS, SVr4, Irix 5, IBM RS/6000. GDB run. ( run, GDB.--.) info share info sharedlibrary. sharedlibrary regex share regex Unix., run. regex,., GDB., GDB..,, GDB.; set complaints (.). GDB., : inner block not inside outer block in symbol ( ).. GDB., symbol "(don't know)". block at address out of order.. GDB
. ( set verbose on..) bad block start address patched. SunOS 4.1.1 ( ) C. GDB. bad string table offset in symbol n n. GDB foo,. unknown symbol type 0xnn GDB. 0xnn 16. GDB.,., gdb, complain breakpont, read_dbx_symtab *bufp. stub type has NULL name GDB. const/volatile indicator missing (ok if using g++ v1.x), got... C++. info mismatch between compiler and debugger GDB. target., GDB ;, file core. --, GDB TCP/IP -- GDB target. ( ).
(Active) :,, GDB.., `gdb a.out', a.out. -- -- GDB tandem corefile. (,. - -- --.) run,. GDB ;. core-file exec-file. ( ). attach.( ). target type parameters GDB.. type. parameters,,. RET target. help target., info target info files. (.). help target name
. set gnutarget args GDB BFD. GDB executable, core,.o, set gnutarget. target, gnutarget target. : set gnutarget, BFD.. show gnutarget gnutarget show gnutarget. gnutarget, GDB show gnutarget The current BDF target is "auto"..(gdb ): target exec program. `target exec program' `exec-file program'. target core filename. `target core filename' `core-file filename'. target remote dev GDB-. dev.(e.g. `/dev/ttya').. target remote load.. target sim CPU. CPU. target udi keyword AMD UDI AMD29k. keyword 29k. AMD29K UDI. target amd-eb dev speed PROG PC AMD EB29k. target remote dev.; speed ; PROG PC DOS.is the AMD29K EBMON. target hms dev Hitachi SH, H8/300, H8/500 board.
device speed. GDB Hitachi. target nindy devicename Nindy Monitor Intel 960. devicename. e.g. `/dev/ttya'. i960(nindy) GDB. target st2000 dev speed Tandem's STDBUG Tandem ST2000. dev ST2000 ; speed. GDB TCP Telnet ST2000. Tandem ST2000 GDB. target vxworks machinename TCP/IP VxWorks machinename IP. GDB VxWorks. target bug dev MVME187 (m88k) BUG. target cpu32bug dev CPU32 (M68K) CPU32BUG. target op50n dev OKI HPPA OP50N. target w89k dev Winbond HPPA W89K. target est dev CPU32 (M68K) EST-300 ICE. target rom68k dev IDP ROM 68K. target array dev Tech LSI33K RAID. target sparclite dev Fujitsu sparclite.. : GDB target remote dev GDB ;.. set endian big set endian little. GDB set endian auto. show endian
. :, MIPS. GDB,., OS OS. GDB TCP/IP., GDB (stubs)--gdb -- (GDB ). GDB ; help target. GDB ( target ),., C : 31. C : `crt0'.,. 32. C. 33. --,... GDB (host )., : On the host,
GDB ;, `target remote'. (.) On the target, GDB. debugging stub., stub gdbserver., gdbserver. debugging stub ;, SPARC `sparc-stub.c'. stub GDB : i386-stub.c Intel 386. m68k-stub.c Motorola 680x0. sh-stub.c Hitachi SH. sparc-stub.c SPARC. sparcl-stub.c Fujitsu SPARCLITE. GDB `README' stub. stub debugging stub.: set_debug_traps handle_exception.. handle_exception,.-- trap handle_exception. handle_exception (, breakpoint). GDB.
.; handle_exception GDB.;., GDB GDB.;, handle_exception. breakpoint breakpoint., GDB.,, ; handle_exception --, GDB., trap.;, breakpoint.--, `target remote' GDB.,, breakpoint. stub GDB debugging stub chip.. stub. int getdebugchar(). getchar ;. void putdebugchar(int). putchar ;. GDB, -driven. ^C (`\003', control- C ). GDB.
GDB stub.; breakpoint. (" " GDB SIGINT SIGTRAP.) : void exceptionhandler (int exception_number, void *exception_address) exception_address.., stub. (,, RAM.) exception_number.; - (, 0,.), exception_number. (, )., exception_address jump, jump jump. 386, exception_address. 0. SPARK 68k stub exceptionhandler. void flush_i_cache() ( sparclite )., no-op., GDB. : void *memset(void *, int, int) memset. libc.a, memset ;,. GNU C,.; stub. stub gcc inline.
Putting it all together,,. 34. -.( stub.). 35. 36. getdebugchar, putdebugchar, 37. flush_i_cache, memset, exceptionhandler. 38. : 39. 40. set_debug_traps(); 41. breakpoint(); 42. 680x0, exceptionhook. : 43. 44. void (*exceptionhook)() = 0; set_debug_traps,. GDB trap(, bus error). exceptionhook ; int. 45. :, GDB debugging stub. 46. GDB.. 47. ( ). 48., GDB.. GDB. target remote..-- TCP ( )., `/dev/ttyb' : 49. 50. target remote /dev/ttyb
TCP, host:port., manyfarms 2828 : target remote manyfarms:2828 step continue., detach. GDB, (C-C), GDB.., GDB : Interrupted while waiting for the program. Give up (and stop debugging it)? (y or n) y, GDB. (, `target remote'.) n, GDB waiting. GDB stub. GDB GDB `remote.c'.,,. ( stub, : stub. `sparcstub.c' ),.--,,.
GDB checksum. `$' `#' 2 checksum. $packet info#checksum checksum packet info modulo 256..;, `+'( ) `-'( ) (GDB), ( debugging stub)....(`gdb/remote.c.'.) g CPU. G CPU. maddr,count addr count. Maddr, count:... addr count. c caddr.( addr ) s saddr addr step. k.?. GDB, debugging stub POSIX CPU trap. T GDB stepping breakpoint stub. stepped
. GDB. GDB., set remotedebug. GDB. GDB. set remotedebug off show remotedebug. gdbserver gdbserver Unix target remote GDB. -- debugging stub. gdbserver debugging stub. GDB OS., GDB gdbserver GDB., gdbserver. GDB. GDB. gdbserver., real-time, real-time, -. gdbserver. GDB gdbserver GDB TCP.. gdbserver. strip. GDB., GDB ; ;. : target> gdbserver comm program [ args... ] comm ( ) TCP., `foo.txt' Emacs
`/dev/com1' GDB : target> gdbserver /dev/com1 emacs foo.txt gdbserver GDB. TCP : target> gdbserver host:2345 emacs foo.txt TCP GDB. `host:2345' gdbserver `host' TCP 2345 TCP. (, `host'.) TCP. (, 23 telnet.) (3) GDB target remote. GDB, strip., GDB. GDB,. ( 9600 bps `--baud'.), gdbserver target remote. host:port TCP. : (gdb) target remote /dev/ttyb `/dev/ttyb'. (gdb) target remote the-target:2345 `the-target' 2345 TCP. TCP, target remote gdbserver.. `Connection refused'. gdbserve.nlm gdbserve.nlm NetWare target remote GDB. GDB gdbserve.nlm GDB,.,
. gdbserve.nlm. strip. GDB., GDB ; ;. : load gdbserve [ BOARD=board ] [ PORT=port ] [ BAUD=baud ] program [ args... ] board port ; baud baud. port node 0 baud 9600 bps., `foo.txt' Emacs 2 19200 bps 1 GDB : load gdbserve BOARD=1 PORT=2 BAUD=19200 emacs foo.txt GDB, strip. GDB. GDB,. ( 9600 bps `--baud'.), gdbserve.nlm target remote. (`/dev/ttyb', ). : (gdb) target remote /dev/ttyb `/dev/ttyb'. i960 (Nindy) GDB Nindy Intel 960 ROM Monitor. GDB Nindy Intel 960, 960 GDB. o o o, Nindy, ; ; GDB target.. Nindy
gdb, GDB.: Attach /dev/ttynn -- specify NN, or "quit" to quit: (`/dev/tty' )., Nindy. Nindy, target. (.) Nindy Nindy-960 GDB.: -r port. GDB Intel 960. port ; (e.g. `-r /dev/ttya'), `/dev' (e.g. `-r ttya'), tty (e.g. `-r a'). -O (0 "O".) GDB "old" Nindy. GDB Intel 960. : `-O',,. GDB.. -brk GDB Nindy BREAK. : ;. `-b'.
Nindy reset Nindy, "break" ; break ( ). AMD29K UDI GDB a29k AMD UDI("Universal Debugger Interface"). MiniMON AMD, AMD MONTIP. AMD UDI-conformant a29k ISSTIP GDB. target udi keyword a29k UDI. keyword AMD `udi_soc'. a29k keyword. `udi_soc', `UDICONF'. AMD29K EBMON AMD DOS EBMON PC a29k., "EB29K". Unix GDB EB29K, PC. PC `COM1' `/dev/ttya'. PC DOS PC.: C:\> MODE com1:9600,n,8,1,none --MS DOS 4.0 -- PC 9600 bps,, 8, 1 stop "retry".; Unix.
PC Unix, DOS.: C:\> CTTY com1 (, DOS, CTTY con --. `COM1' ) Unix, PC tip cu ;, cu -s 9600 -l /dev/ttya cu. tip, : tip -9600 /dev/ttya tip `/dev/ttya'. "remote" tip.-- `/etc/remote'. tip cu, DOS a29k. PC EBMON.(EB29K AMD.) EBMON. EBMON `#'. C:\> G: G:\> CD \usr\joe\work29k G:\USR\JOE\WORK29K> EBMON Am29000 PC Coprocessor Board Monitor, version 3.0-18 Copyright 1990 Advanced Micro Devices, Inc. Written by Gibbons and Associates, Inc. Enter '?' or 'H' for help
PC Coprocessor Type = EB29K I/O Base = 0x208 Memory Base = 0xd0000 Data Memory Size = 2048KB Available I-RAM Range = 0x8000 to 0x1fffff Available D-RAM Range = 0x80002000 to 0x801fffff PageSize = 0x400 Register Stack Size = 0x800 Memory Stack Size = 0x1800 CPU PRL = 0x3 Am29027 Available = No Byte Write Available = Yes # ~. cu tip (EBMON ~. ). EBMON GDB., 29k PC ; PC/NFS PC "drive G:". PC/NFS, PC 29k -- - ; GDB. EB29K, 29k cd GDB -- 29k : cd /usr/joe/work29k gdb myfoo target : target amd-eb /dev/ttya 9600 MYFOO
, `myfoo'. target amd-eb DOS., MYFOO, DOS Unix., breakpoint ; 29k, GDB run., GDB detach. PC, GDB EBMON tip cu. EBMON q. DOS. DOS CTTY con. tip cu ~.. target amd-eb `eb.log'. `eb.log' EBMON. `tail -f' EBMON PC. Tandem ST2000 GDB ST2000. ST2000, : To connect your ST2000 to the host system, see the manufacturer's manual. Once the ST2000 is physically attached, you can run: target st2000 dev speed. dev `/dev/ttya', ST2000. hostname:portnumber TCP (, concentrator ) dev. load attach ; ST2000. GDB
( ). GDB ST2000.: st2000 command command STDBUG.. connect STDBUG. STDBUG, GDB : RET~.(Return, tilde, periold) RET~Cd(Return, tiilde, control-d) GDB VxWorks GDB Unix VxWorks spawn. VxWorks spawn. GDB Unix VxWorks. gdb. ( GDB vxgdb.) VxWorks-timeout args VxWorks vxworks-timeout. args GDB rpc. VxWorks thin. VxWorks ; VxWorks. To use GDB with VxWorks, you must rebuild your VxWorks kernel to include the remote debugging interface routines in the VxWorks library `rdb.a'. To do this, define INCLUDE_RDB in the VxWorks configuration file `configall.h' and rebuild your VxWorks kernel. The resulting kernel contains `rdb.a', and spawns the source debugging task trdbtask when VxWorks is booted. For more information on configuring and remaking VxWorks, see the manufacturer' s manual. VxWorks `rdb.a' GDB, GDB. Unix, gdb.(, vxgdb)