This is the mail archive of the gdb@sourceware.org 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: Pending breakpoints on lines that don't exist


> From: Joel Brobecker [brobecker@adacore.com]
> Sent: January 3, 2012 10:51 PM
> To: Marc Khouzam
> Cc: 'gdb@sourceware.org'
> Subject: Re: Pending breakpoints on lines that don't exist
> 
> I can imagine that it is a bit of a pain to see pending breakpoints
> being created for human-entry errors. I tend to make this type of
> error regularly, for instance. But it apparently it is only an issue
> if you use the "console" interpreter, since "-break-insert" flat out
> refuses the breakpoint for me:
> 
>     (gdb)
>     -break-insert foo.c:100
>     ^error,msg="No line 100 in file \"foo.c\"."

Just a clarification FYI. In Eclipse, we always use -break-insert -f which
requests pending breakpoints:
(gdb) 
-break-insert -f loopfirst.cc:100
&"No line 100 in file \"loopfirst.cc\".\n"
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="loopfirst.cc:100",times="0",original-location="loopfirst.cc:100"}

> ... whereas "break" asks me whether I want to insert a breakpoint:
> 
>     (gdb) b foo.c:100
>     No line 100 in file "foo.c".
>     Make breakpoint pending on future shared library load? (y or [n]) n
>     (gdb) b bar.c:100
>     No source file named bar.c.
>     Make breakpoint pending on future shared library load? (y or [n]) n

To have a consistent behavior between UI and console, we always set:
"-gdb-set breakpoint pending on".
So, for the gdb console in eclipse, the pending breakpoint also gets
set in the case of invalid lines or files.  Although GDB indicates this
clearly:

b foo.c:100
No source file named foo.c.
Breakpoint 7 (foo.c:100) pending.
b 10000
No line 10000 in the current file.
Breakpoint 9 (10000) pending.
 
Note that all this is fine, I just wanted to make sure it was planned.
 
Thanks for explaining things.
 
Marc


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