Displaying Variables155
XPVM_ROOT=/usr/share/pvm3/xpvm
KDEDIR=/usr
USER=rr
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=4
0;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.c
md=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=
01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01
;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.b
z2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=
01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01
;35:*.tif=01;35:
MACHTYPE=i386-redhat-linux-gnu
OLDPWD=/home/rr
MAIL=/var/spool/mail/rr
INPUTRC=/etc/inputrc
BASH_ENV=/home/rr/.bashrc
LANG=en_US
DISPLAY=192.168.2.115:1
LOGNAME=rr
SHLVL=1
SHELL=/bin/bash
HOSTTYPE=i386
OSTYPE=linux-gnu
HISTSIZE=1000
LAMHELPFILE=/etc/lam/lam-helpfile
PVM_ROOT=/usr/share/pvm3
TERM=xterm
HOME=/home/rr
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
PATH=/usr/kerberos/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/
X11:/usr/X11R6/bin
_=/usr/bin/gdb
(gdb)
You can also use the
set env
command and the
unset env
command to modify envi-
ronment variables or to create or delete variables.
5.5.4Modifying Variables
Using the
set
command, you can modify any program variable during the debugging
process. The following session shows an example where you entered a value 34 for program
variable
num1
but modified it to 11 using
set
command before the sum was calculated. You
can see that the sum calculation process takes into account the new value.
Enter first number : 34
11 printf("Enter second number : ");
(gdb) n
12 scanf("%d", &num2);
Next Page >>
<< Previous Page
Back to the Table of Contents