Getting Started with GDB143
[rr@conformix 5]$ gdb arg
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or 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.
This GDB was configured as "i386-redhat-linux"...
(gdb) run test1 test2
Starting program: /home/rr/5/arg test1 test2
This program prints two command line arguments
The first argument is : test1
The second argument is : test2
Program exited with code 037.
(gdb)
Another method is to set the arguments using the
set
command as done in the following
gdb
session. You can display current arguments using the
show
command, which is also
present in this
gdb
session. After setting the arguments, you can use the
run
command to start
executing the program.
[rr@conformix 5]$ gdb arg
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or 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.
This GDB was configured as "i386-redhat-linux"...
(gdb) set args test1 test2
(gdb) show args
Argument list to give program being debugged when it is
started is "test1 test2".
(gdb) run
Starting program: /home/rr/5/arg test1 test2
This program prints two command line arguments
The first argument is : test1
The second argument is : test2
Program exited with code 037.
(gdb)
Next Page >>
<< Previous Page
Back to the Table of Contents