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 gdb/22056] New: Breakpoint conditions takes precedence over ignore counts, contrary to documentation


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

            Bug ID: 22056
           Summary: Breakpoint conditions takes precedence over ignore
                    counts, contrary to documentation
           Product: gdb
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: goeran at uddeborg dot se
  Target Milestone: ---

Created attachment 10382
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10382&action=edit
Test case

In the documentation node gdb → Stopping → Breakpoints → Condition it says:

     If a breakpoint has a positive ignore count and a condition, the
     condition is not checked.  Once the ignore count reaches zero, GDB
     resumes checking the condition.

That does not seem to reflect the actual behaviour.  GDB does not seem to
decrement the ignore count unless the condition is met.

To illustrate, download the attached test case c.c, and then do

    mimmi$$ cc -g c.c -o c
    mimmi$$ gdb c
    GNU gdb (GDB) Fedora 8.0-24.fc26
    Copyright (C) 2017 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-redhat-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from c...done.
    (gdb) b f if x<100
    Breakpoint 1 at 0x40048e: file c.c, line 5.
    (gdb) r
    Starting program: /home/göran/c 
    Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.25-7.fc26.x86_64

    Breakpoint 1, f (x=1) at c.c:5
    5     i += x;
    (gdb) continue 3
    Will ignore next 2 crossings of breakpoint 1.  Continuing.

    Breakpoint 1, f (x=4) at c.c:5
    5     i += x;


Behaviour:
When doing "continue 3", I would expect the calls of "f(100)" on lines 11 and
12 to be ignored.  The condition is false, but the documentation says that
should not be checked as long as there is an ignore count.  Then the condition
makes the execution pass the third call of "f(100)" too, and execution should
stop when reaching the call of "f(2)" on line 14.

But as can be seen, the execution isn't stopped until the call of "f(4)" on
line 16.  That makes me believe the ignore count is only decremented when the
condition is met, that is for the calls of "f(2)" and "f(3)".

It isn't obvious to me if the implementation or the documentation is "correct".
 I guess changing the documentation to agree with the implementation would
cause the least surprises out ther.


Environment:
Fedora Linux
gdb-8.0-24.fc26.x86_64

(Side note: I believe I reported this to the mailing list a long time ago.  I
guess that report was lost.)

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