This is the mail archive of the gdb-prs@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]

[Bug breakpoints/15179] Dprintf interrupts execution when conditionis false


http://sourceware.org/bugzilla/show_bug.cgi?id=15179

--- Comment #2 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-02-24 13:34:07 UTC ---
(In reply to comment #0)
> if the
> condition is evaluated to false, those commands are not executed; this means
> that the printout of the dprintf is ignored as it should, but so is the
> "continue" which is not correct.

I realized my explanation was wrong.  When a breakpoint's condition is false,
the breakpoint should not interrupt the inferior at all.  It has nothing to do
with its commands.

For dprintf, it does interrupt the code.  I tried with a normal breakpoint with
the same commands as a dprintf and the problem does not happen.

Here is a session showing the problem:


> gdb.7.6 ~/loopfirst
GNU gdb (GDB) 7.5.50.20130223-cvs
(gdb) l
1       #include <unistd.h>
2       #include <stdio.h>
3
4       int main() {
5           for (int i=0;i<20;i++) {
6               printf("hello");
7               printf("friend\n");
8               printf("home\n");
9               sleep(1);
10          }
(gdb) dprintf 8,"welcome\n"
Dprintf 1 at 0x804855f: file loopfirst.cc, line 8.
(gdb) cond 1 i>5
(gdb) info b
Num     Type           Disp Enb Address    What
1       dprintf        keep y   0x0804855f in main() at loopfirst.cc:8
        stop only if i>5
        printf "welcome\n"
        continue
(gdb) r
Starting program: /home/lmckhou/loopfirst 
warning: Cannot call inferior functions, you have broken Linux kernel i386 NX
(non-executable pages) support!
hellofriend
(gdb) bt
#0  main () at loopfirst.cc:8
(gdb) p i
$1 = 0

# Why did the inferior stop?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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