public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false
@ 2013-02-23 13:26 marc.khouzam at ericsson dot com
  2013-02-23 13:42 ` [Bug breakpoints/15179] " marc.khouzam at ericsson dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-23 13:26 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 15179
           Summary: Dprintf interrupts execution when condition is false
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: marc.khouzam@ericsson.com
    Classification: Unclassified


I am allowed to set a condition on a dprintf.  I think that is a good thing. 
However, since dprintf is implemented through breakpoint commands, 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.

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
@ 2013-02-23 13:42 ` marc.khouzam at ericsson dot com
  2013-02-24 13:34 ` marc.khouzam at ericsson dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-23 13:42 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-02-23 13:42:09 UTC ---
This bug affects dprintf-style "gdb" and "call" but not "agent"; the "agent"
style has a different problem for conditions which is detailed in bug 15180.

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
  2013-02-23 13:42 ` [Bug breakpoints/15179] " marc.khouzam at ericsson dot com
@ 2013-02-24 13:34 ` marc.khouzam at ericsson dot com
  2013-02-27 13:54 ` qiyao at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-24 13:34 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
  2013-02-23 13:42 ` [Bug breakpoints/15179] " marc.khouzam at ericsson dot com
  2013-02-24 13:34 ` marc.khouzam at ericsson dot com
@ 2013-02-27 13:54 ` qiyao at gcc dot gnu.org
  2013-02-27 19:06 ` marc.khouzam at ericsson dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: qiyao at gcc dot gnu.org @ 2013-02-27 13:54 UTC (permalink / raw)
  To: gdb-prs

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

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu.org

--- Comment #3 from Yao Qi <qiyao at gcc dot gnu.org> 2013-02-27 13:54:16 UTC ---
> (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?

I can't reproduce this problem on my Fedora 16 box and Lucid machine.

I think the inferior stops because of this message "warning: Cannot call
inferior functions, you have broken Linux kernel i386 NX (non-executable pages)
support!".   What is your linux kernel?  It should be related to Bug 15187.

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (2 preceding siblings ...)
  2013-02-27 13:54 ` qiyao at gcc dot gnu.org
@ 2013-02-27 19:06 ` marc.khouzam at ericsson dot com
  2013-03-21  9:00 ` teawater at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-27 19:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-02-27 19:06:41 UTC ---
(In reply to comment #3)

> I can't reproduce this problem on my Fedora 16 box and Lucid machine.
> 
> I think the inferior stops because of this message "warning: Cannot call
> inferior functions, you have broken Linux kernel i386 NX (non-executable pages)
> support!".   What is your linux kernel?  It should be related to Bug 15187.

I can reproduce on a Ubuntu 64bit where there is not "warning: Cannot call
inferior functions...".  I can also reproduce it on an old SLED machine that
does not have that warning (although I used GDB 7.5 on the SLED machine).

Maybe you can try running gdb -nx to make sure you don't have extra settings
that might affect this?

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (3 preceding siblings ...)
  2013-02-27 19:06 ` marc.khouzam at ericsson dot com
@ 2013-03-21  9:00 ` teawater at gmail dot com
  2013-03-21 17:05 ` marc.khouzam at ericsson dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: teawater at gmail dot com @ 2013-03-21  9:00 UTC (permalink / raw)
  To: gdb-prs

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

teawater <teawater at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |teawater at gmail dot com

--- Comment #5 from teawater <teawater at gmail dot com> 2013-03-21 09:00:18 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> 
> > I can't reproduce this problem on my Fedora 16 box and Lucid machine.
> > 
> > I think the inferior stops because of this message "warning: Cannot call
> > inferior functions, you have broken Linux kernel i386 NX (non-executable pages)
> > support!".   What is your linux kernel?  It should be related to Bug 15187.
> 
> I can reproduce on a Ubuntu 64bit where there is not "warning: Cannot call
> inferior functions...".  I can also reproduce it on an old SLED machine that
> does not have that warning (although I used GDB 7.5 on the SLED machine).
> 
> Maybe you can try running gdb -nx to make sure you don't have extra settings
> that might affect this?

I use a ubuntu 11.10 64bit.  I cannot reproduce this issue too.

gdb -nx ./a.out
GNU gdb (GDB) 7.6.50.20130321-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/teawater/tmp/a.out...done.
(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 0x4005b1: file 2.c, line 8.
(gdb) r
Starting program: /home/teawater/tmp/a.out 
hellofriend
welcome
home
hellofriend
welcome
home
hellofriend
welcome
home
hellofriend
welcome
home

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (4 preceding siblings ...)
  2013-03-21  9:00 ` teawater at gmail dot com
@ 2013-03-21 17:05 ` marc.khouzam at ericsson dot com
  2013-03-22  3:03 ` teawater at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-03-21 17:05 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-03-21 17:05:38 UTC ---
(In reply to comment #5)
> (gdb) dprintf 8,"welcome\n"
> Dprintf 1 at 0x4005b1: file 2.c, line 8.
> (gdb) r

You didn't set a condition :)

(In reply to comment #2)
> (gdb) dprintf 8,"welcome\n"
> Dprintf 1 at 0x804855f: file loopfirst.cc, line 8.
>
> (gdb) cond 1 i>5    <----------- Don't forget this
>
> (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

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (5 preceding siblings ...)
  2013-03-21 17:05 ` marc.khouzam at ericsson dot com
@ 2013-03-22  3:03 ` teawater at gmail dot com
  2013-03-22  3:06 ` teawater at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: teawater at gmail dot com @ 2013-03-22  3:03 UTC (permalink / raw)
  To: gdb-prs

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

teawater <teawater at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at sourceware    |teawater at gmail dot com
                   |dot org                     |

--- Comment #7 from teawater <teawater at gmail dot com> 2013-03-22 03:03:47 UTC ---
Oops.  Sorry for that.

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (6 preceding siblings ...)
  2013-03-22  3:03 ` teawater at gmail dot com
@ 2013-03-22  3:06 ` teawater at gmail dot com
  2013-03-26  7:00 ` teawater at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: teawater at gmail dot com @ 2013-03-22  3:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from teawater <teawater at gmail dot com> 2013-03-22 03:06:06 UTC ---
I reproduced this issue in my part.  I will take a look on this issue.

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (7 preceding siblings ...)
  2013-03-22  3:06 ` teawater at gmail dot com
@ 2013-03-26  7:00 ` teawater at gmail dot com
  2013-03-27 22:49 ` marc.khouzam at ericsson dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: teawater at gmail dot com @ 2013-03-26  7:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from teawater <teawater at gmail dot com> 2013-03-26 07:00:11 UTC ---
Hi Marc,

Could you try the patch in
http://sourceware.org/ml/gdb-patches/2013-02/msg00736.html
After I patch this patch, this issue is fixed in my part.

Thanks,
Hui

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (8 preceding siblings ...)
  2013-03-26  7:00 ` teawater at gmail dot com
@ 2013-03-27 22:49 ` marc.khouzam at ericsson dot com
  2013-06-28 13:57 ` marc.khouzam at ericsson dot com
  2014-01-10 16:22 ` marc.khouzam at ericsson dot com
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-03-27 22:49 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #10 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-03-27 22:49:34 UTC ---
(In reply to comment #9)
> Hi Marc,
> 
> Could you try the patch in
> http://sourceware.org/ml/gdb-patches/2013-02/msg00736.html
> After I patch this patch, this issue is fixed in my part.
> 
> Thanks,
> Hui

Yes, that fixes the issue for the "gdb" and "call" style:
http://sourceware.org/ml/gdb-patches/2013-03/msg00067.html

-- 
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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (9 preceding siblings ...)
  2013-03-27 22:49 ` marc.khouzam at ericsson dot com
@ 2013-06-28 13:57 ` marc.khouzam at ericsson dot com
  2014-01-10 16:22 ` marc.khouzam at ericsson dot com
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-06-28 13:57 UTC (permalink / raw)
  To: gdb-prs

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

Marc Khouzam <marc.khouzam at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.6

--- Comment #11 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
Fixed by bug 15075.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug breakpoints/15179] Dprintf interrupts execution when condition is false
  2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
                   ` (10 preceding siblings ...)
  2013-06-28 13:57 ` marc.khouzam at ericsson dot com
@ 2014-01-10 16:22 ` marc.khouzam at ericsson dot com
  11 siblings, 0 replies; 13+ messages in thread
From: marc.khouzam at ericsson dot com @ 2014-01-10 16:22 UTC (permalink / raw)
  To: gdb-prs

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

Marc Khouzam <marc.khouzam at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED

--- Comment #12 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
Looks good

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-01-10 16:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-23 13:26 [Bug breakpoints/15179] New: Dprintf interrupts execution when condition is false marc.khouzam at ericsson dot com
2013-02-23 13:42 ` [Bug breakpoints/15179] " marc.khouzam at ericsson dot com
2013-02-24 13:34 ` marc.khouzam at ericsson dot com
2013-02-27 13:54 ` qiyao at gcc dot gnu.org
2013-02-27 19:06 ` marc.khouzam at ericsson dot com
2013-03-21  9:00 ` teawater at gmail dot com
2013-03-21 17:05 ` marc.khouzam at ericsson dot com
2013-03-22  3:03 ` teawater at gmail dot com
2013-03-22  3:06 ` teawater at gmail dot com
2013-03-26  7:00 ` teawater at gmail dot com
2013-03-27 22:49 ` marc.khouzam at ericsson dot com
2013-06-28 13:57 ` marc.khouzam at ericsson dot com
2014-01-10 16:22 ` marc.khouzam at ericsson dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).