Pending breakpoints & ignore

Jim Ingham jingham@apple.com
Wed May 5 18:27:00 GMT 2004


Andrew,

Yeah, I am happy to do the ignore count, I will leave it to more daring 
folks to do the thread one...  How 'bout:

ChangeLog:

2004-04-27  Jim Ingham  <jingham@apple.com>
         * breakpoint.c (create_breakpoints): Copy the ignore count and 
thread id
         over from the pended breakpoint to the actual breakpoint.

testsuite/ChangeLog:

2004-04-27  Jim Ingham  <jingham@apple.com>

         * gdb.base/pending.exp: Make sure pending breakpoints
         preserve the ignore count.


Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.170
diff -p -r1.170 breakpoint.c
*** breakpoint.c        2 May 2004 00:21:41 -0000       1.170
--- breakpoint.c        5 May 2004 18:24:41 -0000
*************** create_breakpoints (struct symtabs_and_l
*** 4948,4953 ****
--- 4948,4957 ----
                be copied too.  */
             if (pending_bp->commands)
               b->commands = copy_command_lines (pending_bp->commands);
+
+           /* We have to copy over the ignore_count and thread as 
well.  */
+           b->ignore_count = pending_bp->ignore_count;
+           b->thread = pending_bp->thread;
           }
         mention (b);
         }
Index: testsuite/gdb.base/pending.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pending.exp,v
retrieving revision 1.3
diff -p -r1.3 pending.exp
*** testsuite/gdb.base/pending.exp      23 Feb 2004 19:27:46 -0000      
1.3
--- testsuite/gdb.base/pending.exp      5 May 2004 18:18:30 -0000
*************** gdb_test "info break" \
*** 207,212 ****
--- 207,237 ----
   \[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:26 if x > 
3.*" \
   "multiple pending breakpoints"

+
+ #
+ # Try a pending break for a line in a source file with ignore count:
+ #
+
+ gdb_test_multiple "break pendshr.c:27" "Set pending breakpoint 3" {
+      -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
+           gdb_test "y" "Breakpoint.*pendshr.c:27.*pending." \
+               "Set pending breakpoint 3"
+      }
+ }
+
+ gdb_test {ignore $bpnum 2} "Will ignore next 2 crossings of 
breakpoint .*" \
+     "set ignore count on pending breakpoint 3"
+
+ gdb_test "info break" \
+     "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ \[0-9\]+\[\t \]+breakpoint     keep n.*PENDING.*pendfunc1.*
+ \[\t \]+stop only if k == 1.*
+ \[\t \]+print k.*
+ \[0-9\]+\[\t \]+breakpoint     keep y.* in main at 
.*$srcfile:$mainline.*
+ \[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:26 if x > 
3.*
+ \[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:27.*ignore 
next 2 hits.*" \
+ "multiple pending breakpoints 2"
+
   #
   # Run to main which should resolve a pending breakpoint
   #
*************** gdb_test "continue" \
*** 239,244 ****
--- 264,282 ----
   \[$\]1 = 1." \
   "continue to resolved breakpoint 1"

+ #
+ # Disable the other two breakpoints, and continue to the one with
+ # the ignore count.  Make sure you hit it the third time, x should
+ # be 3 then.
+ #
+
+ gdb_test "disable 7" "" "Disable other breakpoints"
+ gdb_test "disable 5" "" "Disable other breakpoints"
+
+ gdb_test "continue" \
+       {.*Breakpoint.*pendfunc1.*\(x=3\) at.*pendshr.c:27.*printf.*;} \
+ "continue to resolved breakpoint 3"
+
   delete_breakpoints

   gdb_breakpoint "main"

This patch will cause a bunch of failures in the unpatched gdb, because 
you will hit the breakpoint you should have ignored right away, and the 
rest of the tests will go south from there...  But this is the simplest 
way to write the test.

Is this okay to check in?

Jim

On May 5, 2004, at 7:54 AM, Andrew Cagney wrote:

>> (gdb) break SomeNotLoadedFunction
>> (gdb) ignore $bpnum 5
>> but it doesn't right now.
>> Like:
>> 2004-04-15  Jim Ingham  <jingham@apple.com>
>>         * breakpoint.c (create_breakpoints): Copy the ignore count 
>> and thread id
>>         over from the pended breakpoint to the actual breakpoint.
>
> Yes, oops.  Can you add an addition to pending.exp - at least to test 
> the ignore count?
>
> Andrew
>
>
>
--
Jim Ingham                                   jingham@apple.com
Developer Tools
Apple Computer



More information about the Gdb-patches mailing list