This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: basic gdb usage question
- From: Matt Funk <matze999 at gmx dot net>
- To: "Michael Snyder" <Michael dot Snyder at access-company dot com>, gdb at sourceware dot org
- Date: Mon, 25 Jun 2007 17:36:21 -0600
- Subject: Re: basic gdb usage question
- References: <467D4AE3.7020505@eagercon.com> <200706251708.34817.matze999@gmx.net> <655C3D4066B7954481633935A40BB36F041415@ussunex02.svl.access-company.com>
- Reply-to: matze999 at gmx dot net
thanks for the reply first of all,
well, with respect to the local scope this is what i thought i tried. In
particular this is what i did:
break myfile_1.cpp:700 if (myfile_1.cpp:mylocalvar_1==1 &&
myfile_2.cpp:myothervar==2)
but gdb gave me:
"Junk at end of arguments."
So i figure something is wrong with my syntax.
Is there anything wrong with the above?
mat
On Monday 25 June 2007 17:22, Michael Snyder wrote:
> The condition on a breakpoint can be anything that could be expressed as a
> C expression, eg:
>
> (gdb) break <file A>:<line M> if (X && Y)
>
> You're right, two breakpoints would not meet that requirement.
> However, you CAN have arbitrarily many breakpoints at the same
> location, and their conditions will all be evaluated, so if you
> had an "or" instead of an "and" (if you wanted to stop if X or Y),
> you could use multiple breakpoints:
>
> break foo.c:17 if (X)
> break foo.c:17 if (Y)
>
> X and Y don't have to be in the local scope, so long as they are
> in "visible scope". gdb's concept of visible scope is a bit more
> permissive than C -- a static variable from another source file
> can be used so long as it is unambiguous. If it is ambiguous, it
> can be specified as "foo.c:var".