Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
The ONE Campaign to make poverty history

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 73 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

gdb



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 can do four main kinds of things (plus other things in
       support of these) to help you catch bugs in the act:

          ·   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 experi­
              ment 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  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.

       You can run gdb with no arguments or options; but the most
       usual way to start GDB is with one argument or two, speci­
       fying an executable program as the argument:

       gdb program

       You can also start with both an executable program  and  a
       core file specified:

       gdb program core


       run [arglist]
              Start your program (with arglist, if specified).

       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.

       quit   Exit from 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.


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.)

       All  the  options  and command line arguments you give are
       processed in sequential order.  The order makes a  differ­
       -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
              conjunction with a core dump.

       -se=file
               Read symbol table from file file and use it as the
              executable file.

       -core=file

       -c file
               Use file file as a core dump to examine.

       -command=file

       -x file
               Execute GDB commands from file file.

       -directory=directory

       -d directory
               Add directory to the path  to  search  for  source
              files.

       -nx

       -n     Do  not  execute  commands from any `.gdbinit' ini­
              tialization files.  Normally, the commands in these
              files  are  executed  after all the command options
              and arguments have been processed.

       -quiet

       -q     ``Quiet''.  Do not print the introductory and copy­
              right messages.  These messages are also suppressed
              in batch mode.

              (which is ordinarily issued whenever a program run­
              ning under GDB control terminates)  is  not  issued
              when running in batch mode.

       -cd=directory
                Run GDB using directory as its working directory,
              instead of the current directory.

       -fullname

       -f     Emacs sets this option when it runs GDB as  a  sub­
              process.  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 recog­
              nizable  format  looks  like  two ` 32' characters,
              followed by the file name, line number and  charac­
              ter  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.

       -b bps  Set the line speed (baud rate or bits per  second)
              of  any  serial  interface  used  by GDB for remote
              debugging.

       -tty=device
               Run using device for your program's standard input
              and output.


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 ver­
       sions 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
  
Help us cut cost by not downloading the whole site!
Use of automated download sofware ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and therefore is expressedly prohibited. For more details on this, take a look here

Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
The Linux Tutorial welcomes your suggestions and ideas.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.09 Seconds