Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

405 lines
13KB

  1. .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is turned on, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{
  60. . if \nF \{
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "GDB 1"
  136. .TH GDB 1 "2020-11-24" "gdb-10.1.90.20201028-git" "GNU Development Tools"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. gdb \- The GNU Debugger
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. gdb [\fB\-help\fR] [\fB\-nh\fR] [\fB\-nx\fR] [\fB\-q\fR]
  146. [\fB\-batch\fR] [\fB\-cd=\fR\fIdir\fR] [\fB\-f\fR]
  147. [\fB\-b\fR\ \fIbps\fR]
  148. [\fB\-tty=\fR\fIdev\fR] [\fB\-s\fR \fIsymfile\fR]
  149. [\fB\-e\fR\ \fIprog\fR] [\fB\-se\fR\ \fIprog\fR]
  150. [\fB\-c\fR\ \fIcore\fR] [\fB\-p\fR\ \fIprocID\fR]
  151. [\fB\-x\fR\ \fIcmds\fR] [\fB\-d\fR\ \fIdir\fR]
  152. [\fIprog\fR|\fIprog\fR \fIprocID\fR|\fIprog\fR \fIcore\fR]
  153. .SH "DESCRIPTION"
  154. .IX Header "DESCRIPTION"
  155. The purpose of a debugger such as \s-1GDB\s0 is to allow you to see what is
  156. going on \*(L"inside\*(R" another program while it executes \*(-- or what another
  157. program was doing at the moment it crashed.
  158. .PP
  159. \&\s-1GDB\s0 can do four main kinds of things (plus other things in support of
  160. these) to help you catch bugs in the act:
  161. .IP "\(bu" 4
  162. Start your program, specifying anything that might affect its behavior.
  163. .IP "\(bu" 4
  164. Make your program stop on specified conditions.
  165. .IP "\(bu" 4
  166. Examine what has happened, when your program has stopped.
  167. .IP "\(bu" 4
  168. Change things in your program, so you can experiment with correcting the
  169. effects of one bug and go on to learn about another.
  170. .PP
  171. You can use \s-1GDB\s0 to debug programs written in C, \*(C+, Fortran and
  172. Modula\-2.
  173. .PP
  174. \&\s-1GDB\s0 is invoked with the shell command \f(CW\*(C`gdb\*(C'\fR. Once started, it reads
  175. commands from the terminal until you tell it to exit with the \s-1GDB\s0
  176. command \f(CW\*(C`quit\*(C'\fR. You can get online help from \s-1GDB\s0 itself
  177. by using the command \f(CW\*(C`help\*(C'\fR.
  178. .PP
  179. You can run \f(CW\*(C`gdb\*(C'\fR with no arguments or options; but the most
  180. usual way to start \s-1GDB\s0 is with one argument or two, specifying an
  181. executable program as the argument:
  182. .PP
  183. .Vb 1
  184. \& gdb program
  185. .Ve
  186. .PP
  187. You can also start with both an executable program and a core file specified:
  188. .PP
  189. .Vb 1
  190. \& gdb program core
  191. .Ve
  192. .PP
  193. You can, instead, specify a process \s-1ID\s0 as a second argument or use option
  194. \&\f(CW\*(C`\-p\*(C'\fR, if you want to debug a running process:
  195. .PP
  196. .Vb 2
  197. \& gdb program 1234
  198. \& gdb \-p 1234
  199. .Ve
  200. .PP
  201. would attach \s-1GDB\s0 to process \f(CW1234\fR. With option \fB\-p\fR you
  202. can omit the \fIprogram\fR filename.
  203. .PP
  204. Here are some of the most frequently needed \s-1GDB\s0 commands:
  205. .IP "\fBbreak [\fR\fIfile\fR\fB:]\fR\fIfunction\fR" 4
  206. .IX Item "break [file:]function"
  207. Set a breakpoint at \fIfunction\fR (in \fIfile\fR).
  208. .IP "\fBrun [\fR\fIarglist\fR\fB]\fR" 4
  209. .IX Item "run [arglist]"
  210. Start your program (with \fIarglist\fR, if specified).
  211. .IP "\fBbt\fR" 4
  212. .IX Item "bt"
  213. Backtrace: display the program stack.
  214. .IP "\fBprint\fR \fIexpr\fR" 4
  215. .IX Item "print expr"
  216. Display the value of an expression.
  217. .IP "\fBc\fR" 4
  218. .IX Item "c"
  219. Continue running your program (after stopping, e.g. at a breakpoint).
  220. .IP "\fBnext\fR" 4
  221. .IX Item "next"
  222. Execute next program line (after stopping); step \fIover\fR any
  223. function calls in the line.
  224. .IP "\fBedit [\fR\fIfile\fR\fB:]\fR\fIfunction\fR" 4
  225. .IX Item "edit [file:]function"
  226. look at the program line where it is presently stopped.
  227. .IP "\fBlist [\fR\fIfile\fR\fB:]\fR\fIfunction\fR" 4
  228. .IX Item "list [file:]function"
  229. type the text of the program in the vicinity of where it is presently stopped.
  230. .IP "\fBstep\fR" 4
  231. .IX Item "step"
  232. Execute next program line (after stopping); step \fIinto\fR any
  233. function calls in the line.
  234. .IP "\fBhelp [\fR\fIname\fR\fB]\fR" 4
  235. .IX Item "help [name]"
  236. Show information about \s-1GDB\s0 command \fIname\fR, or general information
  237. about using \s-1GDB.\s0
  238. .IP "\fBquit\fR" 4
  239. .IX Item "quit"
  240. Exit from \s-1GDB.\s0
  241. .PP
  242. For full details on \s-1GDB,\s0
  243. see \fIUsing \s-1GDB: A\s0 Guide to the \s-1GNU\s0 Source-Level Debugger\fR,
  244. by Richard M. Stallman and Roland H. Pesch. The same text is available online
  245. as the \f(CW\*(C`gdb\*(C'\fR entry in the \f(CW\*(C`info\*(C'\fR program.
  246. .SH "OPTIONS"
  247. .IX Header "OPTIONS"
  248. Any arguments other than options specify an executable
  249. file and core file (or process \s-1ID\s0); that is, the first argument
  250. encountered with no
  251. associated option flag is equivalent to a \fB\-se\fR option, and the second,
  252. if any, is equivalent to a \fB\-c\fR option if it's the name of a file.
  253. Many options have
  254. both long and short forms; both are shown here. The long forms are also
  255. recognized if you truncate them, so long as enough of the option is
  256. present to be unambiguous. (If you prefer, you can flag option
  257. arguments with \fB+\fR rather than \fB\-\fR, though we illustrate the
  258. more usual convention.)
  259. .PP
  260. All the options and command line arguments you give are processed
  261. in sequential order. The order makes a difference when the \fB\-x\fR
  262. option is used.
  263. .IP "\fB\-help\fR" 4
  264. .IX Item "-help"
  265. .PD 0
  266. .IP "\fB\-h\fR" 4
  267. .IX Item "-h"
  268. .PD
  269. List all options, with brief explanations.
  270. .IP "\fB\-symbols=\fR\fIfile\fR" 4
  271. .IX Item "-symbols=file"
  272. .PD 0
  273. .IP "\fB\-s\fR \fIfile\fR" 4
  274. .IX Item "-s file"
  275. .PD
  276. Read symbol table from file \fIfile\fR.
  277. .IP "\fB\-write\fR" 4
  278. .IX Item "-write"
  279. Enable writing into executable and core files.
  280. .IP "\fB\-exec=\fR\fIfile\fR" 4
  281. .IX Item "-exec=file"
  282. .PD 0
  283. .IP "\fB\-e\fR \fIfile\fR" 4
  284. .IX Item "-e file"
  285. .PD
  286. Use file \fIfile\fR as the executable file to execute when
  287. appropriate, and for examining pure data in conjunction with a core
  288. dump.
  289. .IP "\fB\-se=\fR\fIfile\fR" 4
  290. .IX Item "-se=file"
  291. Read symbol table from file \fIfile\fR and use it as the executable
  292. file.
  293. .IP "\fB\-core=\fR\fIfile\fR" 4
  294. .IX Item "-core=file"
  295. .PD 0
  296. .IP "\fB\-c\fR \fIfile\fR" 4
  297. .IX Item "-c file"
  298. .PD
  299. Use file \fIfile\fR as a core dump to examine.
  300. .IP "\fB\-command=\fR\fIfile\fR" 4
  301. .IX Item "-command=file"
  302. .PD 0
  303. .IP "\fB\-x\fR \fIfile\fR" 4
  304. .IX Item "-x file"
  305. .PD
  306. Execute \s-1GDB\s0 commands from file \fIfile\fR.
  307. .IP "\fB\-ex\fR \fIcommand\fR" 4
  308. .IX Item "-ex command"
  309. Execute given \s-1GDB \s0\fIcommand\fR.
  310. .IP "\fB\-directory=\fR\fIdirectory\fR" 4
  311. .IX Item "-directory=directory"
  312. .PD 0
  313. .IP "\fB\-d\fR \fIdirectory\fR" 4
  314. .IX Item "-d directory"
  315. .PD
  316. Add \fIdirectory\fR to the path to search for source files.
  317. .IP "\fB\-nh\fR" 4
  318. .IX Item "-nh"
  319. Do not execute commands from \fI~/.gdbinit\fR.
  320. .IP "\fB\-nx\fR" 4
  321. .IX Item "-nx"
  322. .PD 0
  323. .IP "\fB\-n\fR" 4
  324. .IX Item "-n"
  325. .PD
  326. Do not execute commands from any \fI.gdbinit\fR initialization files.
  327. .IP "\fB\-quiet\fR" 4
  328. .IX Item "-quiet"
  329. .PD 0
  330. .IP "\fB\-q\fR" 4
  331. .IX Item "-q"
  332. .PD
  333. \&\*(L"Quiet\*(R". Do not print the introductory and copyright messages. These
  334. messages are also suppressed in batch mode.
  335. .IP "\fB\-batch\fR" 4
  336. .IX Item "-batch"
  337. Run in batch mode. Exit with status \f(CW0\fR after processing all the command
  338. files specified with \fB\-x\fR (and \fI.gdbinit\fR, if not inhibited).
  339. Exit with nonzero status if an error occurs in executing the \s-1GDB\s0
  340. commands in the command files.
  341. .Sp
  342. Batch mode may be useful for running \s-1GDB\s0 as a filter, for example to
  343. download and run a program on another computer; in order to make this
  344. more useful, the message
  345. .Sp
  346. .Vb 1
  347. \& Program exited normally.
  348. .Ve
  349. .Sp
  350. (which is ordinarily issued whenever a program running under \s-1GDB\s0 control
  351. terminates) is not issued when running in batch mode.
  352. .IP "\fB\-cd=\fR\fIdirectory\fR" 4
  353. .IX Item "-cd=directory"
  354. Run \s-1GDB\s0 using \fIdirectory\fR as its working directory,
  355. instead of the current directory.
  356. .IP "\fB\-fullname\fR" 4
  357. .IX Item "-fullname"
  358. .PD 0
  359. .IP "\fB\-f\fR" 4
  360. .IX Item "-f"
  361. .PD
  362. Emacs sets this option when it runs \s-1GDB\s0 as a subprocess. It tells
  363. \&\s-1GDB\s0 to output the full file name and line number in a standard,
  364. recognizable fashion each time a stack frame is displayed (which
  365. includes each time the program stops). This recognizable format looks
  366. like two \fB\e032\fR characters, followed by the file name, line number
  367. and character position separated by colons, and a newline. The
  368. Emacs-to-GDB interface program uses the two \fB\e032\fR
  369. characters as a signal to display the source code for the frame.
  370. .IP "\fB\-b\fR \fIbps\fR" 4
  371. .IX Item "-b bps"
  372. Set the line speed (baud rate or bits per second) of any serial
  373. interface used by \s-1GDB\s0 for remote debugging.
  374. .IP "\fB\-tty=\fR\fIdevice\fR" 4
  375. .IX Item "-tty=device"
  376. Run using \fIdevice\fR for your program's standard input and output.
  377. .SH "SEE ALSO"
  378. .IX Header "SEE ALSO"
  379. The full documentation for \s-1GDB\s0 is maintained as a Texinfo manual.
  380. If the \f(CW\*(C`info\*(C'\fR and \f(CW\*(C`gdb\*(C'\fR programs and \s-1GDB\s0's Texinfo
  381. documentation are properly installed at your site, the command
  382. .PP
  383. .Vb 1
  384. \& info gdb
  385. .Ve
  386. .PP
  387. should give you access to the complete manual.
  388. .PP
  389. \&\fIUsing \s-1GDB: A\s0 Guide to the \s-1GNU\s0 Source-Level Debugger\fR,
  390. Richard M. Stallman and Roland H. Pesch, July 1991.
  391. .SH "COPYRIGHT"
  392. .IX Header "COPYRIGHT"
  393. Copyright (c) 1988\-2020 Free Software Foundation, Inc.
  394. .PP
  395. Permission is granted to copy, distribute and/or modify this document
  396. under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or
  397. any later version published by the Free Software Foundation; with the
  398. Invariant Sections being \*(L"Free Software\*(R" and \*(L"Free Software Needs
  399. Free Documentation\*(R", with the Front-Cover Texts being \*(L"A \s-1GNU\s0 Manual,\*(R"
  400. and with the Back-Cover Texts as in (a) below.
  401. .PP
  402. (a) The \s-1FSF\s0's Back-Cover Text is: \*(L"You are free to copy and modify
  403. this \s-1GNU\s0 Manual. Buying copies from \s-1GNU\s0 Press supports the \s-1FSF\s0 in
  404. developing \s-1GNU\s0 and promoting software freedom.\*(R"