Red Hat ENTERPRISE LINUX 3 - DEBUGGING WITH GDB Manual page 18

Debugging with gdb
Hide thumbs Also See for ENTERPRISE LINUX 3 - DEBUGGING WITH GDB:
Table of Contents

Advertisement

8
(gdb) break m4_changequote
Breakpoint 1 at 0x62f4: file builtin.c, line 879.
Using the
command, we start
run
subroutine, the program runs as usual:
m4_changequote
(gdb) run
Starting program: /work/Editorial/gdb/gnu/m4/m4
define(foo,0000)
foo
0000
To trigger the breakpoint, we call
tion about the context where it stops.
changequote( QUOTE , UNQUOTE )
Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
at builtin.c:879
879
if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
Now we use the command
(gdb) n
882
set_quotes((argc
: nil,
looks like a promising subroutine. We can go into it by using the command
set_quotes
instead of
.
next
step
.
set_quotes
(gdb) s
set_quotes (lq=0x34c78 " QUOTE ", rq=0x34c88 " UNQUOTE ")
at input.c:530
530
if (lquote != def_lquote)
The display that shows the subroutine where
frame display. It shows a summary of the stack. We can use the
also be spelled
), to see where we are in the stack as a whole: the
bt
stack frame for each active subroutine.
(gdb) bt
#0
set_quotes (lq=0x34c78 " QUOTE ", rq=0x34c88 " UNQUOTE ")
at input.c:530
#1
0x6344 in m4_changequote (argc=3, argv=0x33c70)
at builtin.c:882
#2
0x8174 in expand_macro (sym=0x33320) at macro.c:242
#3
0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
at macro.c:71
running under gdb control; as long as control does not reach the
m4
changequote
(
) to advance execution to the next line of the current function.
n
next
= 2) ? TOKEN_DATA_TEXT(argv[1])\
goes to the next line to be executed in any subroutine, so it steps into
m4
Chapter 3. A Sample gdb Session
. gdb suspends execution of
is now suspended (and its arguments) is called a stack
backtrace
backtrace
, displaying informa-
m4
(
s
step
command (which can
command displays a
)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 3 - DEBUGGING WITH GDB and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents