Chinaunix首页 | 论坛 | 博客
  • 博客访问: 353688
  • 博文数量: 83
  • 博客积分: 5322
  • 博客等级: 中校
  • 技术积分: 1057
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-11 11:27
个人简介

爱生活,爱阅读

文章分类

全部博文(83)

文章存档

2015年(1)

2013年(1)

2012年(80)

2011年(1)

分类:

2012-08-28 08:22:45

[admin@localhost ~]$ man gdb
gdb(1)                             GNU Tools                            gdb(1)

NAME
名称
       gdb - The GNU Debugger
       gdb - GNU 调试器

SYNOPSIS
概要
       gdb    [-help] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps] [-tty=dev] [-s symfile] [-e prog] [-se prog] [-c core]
              [-x cmds] [-d dir] [prog[core|procID]]

DESCRIPTION
描述
       The purpose of a debugger such as GDB is to allow you to see what is going on ‘‘inside’’ another program while it
       executes—or what another program was doing at the moment it crashed.
       像GDB这样的调试器的目的是允许你能够看到另一个正在执行中的程序的内部将要执行什么,或者另一个程序死掉时正在做什么。

       GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:
       GDB能够做四类事情(在这些事情的支持下加上其它东西)以帮助你找到缺陷,通过以下行为:

          ·   Start your program, specifying anything that might affect its behavior.
              运行你的程序,指定任何可能影响其行为的条件。

          ·   Make your program stop on specified conditions.
              让你的程序在指定的条件上停止。

          ·   Examine what has happened, when your program has stopped.
              当你的程序停止下来时检查发生了什么事情。

          ·   Change  things  in your program, so you can experiment with correcting the effects of one bug and go on to
              learn about another.
              改变你程序中的事情,这样你可以通过更正一个缺陷进行试验,然后继续研究另一个缺陷。

       You can use GDB to debug programs written in C, C++, and Modula-2.  Fortran support will be added when a GNU For-
       tran compiler is ready.
       你可以使用GDB调试用C C++ modula-2编写的程序。等到GNU Fortran编译器准备好后,再增加对Fortran的支持。

       GDB  is  invoked with the shell command gdb.  Once started, it reads commands from the terminal until you tell it
       to exit with the GDB command quit.  You can get online help from gdb itself by using the command help.
       GDB 通过shell下命令gdb启动。一旦启动,gdb将从终端读取命令,直到你通过输入GDB退出命令quit让其退出。你可以通过命令help
       获取在线帮助。

       You can run gdb with no arguments or options; but the most usual way to start GDB is with one  argument  or  two,
       specifying an executable program as the argument:
       你可以运行不带参数或者选项的gdb命令;但是最常用的启动GDB时带有一个或者两个命令,指定一个可执行作为参数:

       gdb program

       You can also start with both an executable program and a core file specified:
       你也可以启动一个可执行程序和一个指定的核文件:
       
       gdb program core

       You can, instead, specify a process ID as a second argument, if you want to debug a running process:
       你也可以指定一个进程ID作为第二个参数,如果你想调试一个运行的进程:

       gdb program 1234

       would  attach  GDB  to  process  1234  (unless  you also have a file named ‘1234’; GDB does check for a core file
       first).
       将GDB连接到进程1234(除非你也有一个名字为‘1234’的文件;GDB的确首先检查和文件)。

       Here are some of the most frequently needed GDB commands:
       以下是一些最常用的GDB命令:

       break [file:]function
               Set a breakpoint at function (in file).
               在函数function处设定断点(在一个文件中)。

       run [arglist]
              Start your program (with arglist, if specified).
              启动你的程序(如果指定arglist,则作为参数)

       bt     Backtrace: display the program stack.
              追踪:列出程序栈。

       print expr
               Display the value of an expression.
               显示表达式的值。

       c      Continue running your program (after stopping, e.g. at a breakpoint).
              继续运行你的程序(在一个断点处停止之后)。

       next   Execute next program line (after stopping); step over any function calls in the line.
              执行程序的下一行(停止之后);越过该行的任意函数调用。

       edit [file:]function
              look at the program line where it is presently stopped.
              查看当前停止运行的程序行。

       list [file:]function
              type the text of the program in the vicinity of where it is presently stopped.
              列出程序当前停止位置附近的文本。

       step   Execute next program line (after stopping); step into any function calls in the line.
              执行程序下一行;进入该行的任意函数调用。

       help [name]
              Show information about GDB command name, or general information about using GDB.
              列出GDB命令name的帮助信息,或者关于使用GDB的常规信息。

       quit   Exit from GDB.
              退出GDB.

       For full details on GDB, see Using GDB: A Guide to the GNU Source-Level Debugger,  by  Richard  M.  Stallman  and
       Roland H. Pesch.  The same text is available online as the gdb entry in the info program.
       为获取GDB的详细信息,参见:GDB-GNU代码级别调试器使用指导。by。。。。

OPTIONS
选项
       Any  arguments  other  than  options specify an executable file and core file (or process ID); that is, the first
       argument encountered with no associated option flag is equivalent to a ‘-se’ option, and the second, if  any,  is
       equivalent  to  a  ‘-c’ option if it’s the name of a file.  Many options have both long and short forms; both are
       shown here.  The long forms are also recognized if you truncate them, so long as enough of the option is  present
       to  be unambiguous.  (If you prefer, you can flag option arguments with ‘+’ rather than ‘-’, though we illustrate
       the more usual convention.)
       除了指定的可执行文件,核文件(或者进程ID)的其他任何参数;也就是说,任何第一个没有相关选项标记的参数等同于'-se'选项;
       第二个参数如果是一个文件的名字,则其等价于'-c'选项。很多选项有长的和短的形式;这里均有展示。长形式的选项在截断的情况下
       也能被识别,只要提供的选项长度足够的长而没有歧义。(如果你喜欢的话,你可以在选项参数前用+而不是-,尽管我们详述了更
       常用的习惯)
       
       All the options and command line arguments you give are processed in sequential order.  The order makes a differ-
       ence when the ‘-x’ option is used.
       所有给定的选项与命令行参数均按照顺序进行处理。使用-x选项时,处理顺序发生变化。

       -help

       -h     List all options, with brief explanations.
              用简明解释的方式列出所有选项。

       -symbols=file

       -s file
               Read symbol table from file file.
               从file中读取符号表。

       -write Enable writing into executable and core files.
              使能写入可执行文件与核文件。

       -exec=file

       -e file
               Use file file as the executable file to execute when appropriate, and for examining pure data in conjunc-
              tion with a core dump.
              将文件file作为可执行文件适当的运行,并联合核文件检查纯数据部分。。。。。。。

       -se=file
               Read symbol table from file file and use it as the executable file.
               从file文件读取符号表,并将之作为可执行文件

       -core=file

       -c file
               Use file file as a core dump to examine.
               将file视作核文件检查。

       -command=file

       -x file
               Execute GDB commands from file file.
               从文件file中执行GDB命令。

       -directory=directory

       -d directory
               Add directory to the path to search for source files.
               将directory作为搜索源文件的路径。

       -nx

       -n     Do not execute commands from any ‘.gdbinit’ initialization files.  Normally, the commands in  these  files
              are executed after all the command options and arguments have been processed.
              不从任何初始化的'.gdbinit'文件中执行命令。通常情况下,此类文件中的命令在命令行中的选项以及参数处理之后被执行。

       -quiet

       -q     ‘‘Quiet’’.   Do  not print the introductory and copyright messages.  These messages are also suppressed in
              batch mode.
              不要打印介绍与版权信息。这些信息在批处理模式下也是抑制输出的。

       -batch Run in batch mode.  Exit with status 0 after processing all the command files  specified  with  ‘-x’  (and
              ‘.gdbinit’,  if not inhibited).  Exit with nonzero status if an error occurs in executing the GDB commands
              in the command files.
              运行在批处理模式。在执行完通过‘-x’指定的命令文件后,以状态0退出。如果在执行命令文件中的GDB命令时发生错误,则
              退出并返回非零值。

              Batch mode may be useful for running GDB as a filter, for example to download and run a program on another
              computer; in order to make this more useful, the message
              在将GDB作为过滤器运行时,批处理模式很有用处,例如,在另一台计算机上下载并运行程序;为了是其更有意义,信息

              Program exited normally.

              (which  is  ordinarily  issued whenever a program running under GDB control terminates) is not issued when
              running in batch mode.(一个运行在GDB控制下的程序通常以上述信息输出作为终止)在批处理 模式下不会产生此信息。

       -cd=directory
               Run GDB using directory as its working directory, instead of the current directory.
               在目录directory中作为GDB工作目录,而不是当前目录。

       -fullname

       -f     Emacs sets this option when it runs GDB as a subprocess.  It tells GDB to output the full  file  name  and
              line  number in a standard, recognizable fashion each time a stack frame is displayed (which includes each
              time the program stops).  This recognizable format looks like two ‘ 32’ characters, followed by  the  file
              name,  line  number and character position separated by colons, and a newline.  The Emacs-to-GDB interface
              program uses the two ‘ 32’ characters as a signal to display the source code for the frame.
              Emacs在将GDB作为子进程运行时设置该选项。

       -b bps  Set the line speed (baud rate or bits per second) of any serial interface used by GDB for  remote  debug-
              ging.
              设置任何通过串行接口进行远程GDB调试的串口行速度(波特率)。

       -tty=device
               Run using device for your program’s standard input and output.
               采用device作为你程序的标准输入与输出。

SEE ALSO
参见其它
       ‘gdb’  entry  in  info;  Using  GDB:  A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H.
       Pesch, July 1991.

COPYING
版权
       Copyright (c) 1991 Free Software Foundation, Inc.

       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 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, except that this permission notice may be included in translations approved  by
       the Free Software Foundation instead of in the original English.
       允许在符合上述更改版本的条件下,复制与发布将本手册翻译为其他语言的译本,除非这个许可通知包括在翻译,被原始英文版本
       的自由软件基金会批准。

GNU Tools                          22may2002                            gdb(1)
阅读(974) | 评论(0) | 转发(0) |
0

上一篇:man Grep

下一篇:syslogd 守护进程

给主人留下些什么吧!~~