Article View: gnu.misc.discuss
Article #73365Gnu GDB questions/probs
From: Terrence M. Brannon
Date: Thu, 26 Sep 1991 13:59
Date: Thu, 26 Sep 1991 13:59
89 lines
2566 bytes
2566 bytes
3 questions:
1) How can I set a watchpoint in this program so that it stops when (i==4)
2) How come it freezes and says single-stepping until function exit and
never stops?
3) what is the syntax for the break ... if <expr> so that it breaks
on expression?
Here is the code:
main (argc, argv)
int argc;
char *argv[];
{
void (*func) ();
int i;
printf ("Hello world from %s\n", argv[0]);
for (i=0; i < 10; i++) /* line 13*/
printf("%d\n ", i);
printf("\n");
}
And here is the transcript:
Current directory is /home/PL118a/tb06/thesis/dld-3.2.3/test/simple/
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
There is absolutely no warranty for GDB; type "info warranty" for details.
GDB 4.1, Copyright 1991 Free Software Foundation, Inc...
(gdb) r
Starting program: /home/PL118a/tb06/thesis/dld-3.2.3/test/simple/simple
Hello world from /home/PL118a/tb06/thesis/dld-3.2.3/test/simple/simple
0
1
2
3
4
5
6
7
8
9
Program exited with code 01.
(gdb) break main
Breakpoint 1 at 0x22b8: file simple.c, line 10.
(gdb) r
Starting program: /home/PL118a/tb06/thesis/dld-3.2.3/test/simple/simple
Breakpoint 1, main (argc=1, argv=0xf7fffe1c) at simple.c:10
(gdb) n
Hello world from /home/PL118a/tb06/thesis/dld-3.2.3/test/simple/simple
(gdb) display i
1: i = 0
(gdb) n
1: i = 0
(gdb) n
0
1: i = 0
(gdb) watch (i==4)
Watchpoint 2: i == 4
(gdb) info watch
Enb Expression
#2 y i == 4
(gdb) n
1: i = 1
(gdb) n
1: i = 1
(gdb) n
Watchpoint 2 disabled because the program has left the block in
which its expression is valid.
1
1: i = 1
(gdb) n
1: i = 2
(gdb) n
1: i = 2
(gdb) n
0x2328 in printf ()
(gdb) n
Current function has no line number information.
Single stepping until function exit.
2
n
n
n
n
Technical Details
Message-ID:
<1991Sep26.135951.26060@cco.caltech.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!mips!ptimtc!nntp-server.caltech.edu!brannonShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,552caa6d49412ce7,start X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 1991-09-27 06:12:11 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!mips!ptimtc!nntp-server.caltech.edu!brannon From: brannon@cs.caltech.edu (Terrence M. Brannon) Newsgroups: gnu.misc.discuss Subject: Gnu GDB questions/probs Keywords: gnu, debug, c, gdb Message-ID: <1991Sep26.135951.26060@cco.caltech.edu> Date: 26 Sep 91 13:59:51 GMT Sender: news@cco.caltech.edu Organization: California Institute of Technology Lines: 89 Nntp-Posting-Host: stun4a.cs.caltech.edu