This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: basic gdb usage question

> From: Matt Funk <>
> Date: Mon, 25 Jun 2007 17:08:34 -0600
> I am just starting to use gdb and so have a lot to learn. 


> So i want to set the breakpoint in file A at line M under condition X.
> However, another condition that needs to be met before breaking is in file B 
> with condition Y.
> condition X: the value of a local variable is (say) 2.
> condition Y: the value of a variable is (say) 3.
> Is this possible to set multiple conditions for one breakpoint?

A condition could be complex: var1 == 2 && var2 == 3.  Would that do
the job?

> I thought 
> about setting two breakpoints but that would not do what i need it to do.

Why not?  You could set the second breakpoint from the commands
defined for the first breakpoint.  Would this do what you want?

> Along the same lines, is it then possible to create a condition that 
> references a variable outside the local scope?

AFAIK, only if it has global scope in its file.  You can use the

Btw, I'd be eager to know which ones of the answers above cannot be
found in the user's manual.  That will help us improve the docs.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]