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

[patch] MI ignores conditions for pending breakpoints


Hi,

I got a bug report that conditions were ignored for pending breakpoints.
It turns out to only happen for MI and I added a example session at the end
of this mail.

The below patch fixes this by storing the condition string for pending bp.
The extra_string should receive the same treatment, but I'll send that in
a separate patch.

No regressions on Ubuntu 32bit (actually, I got better results, but I think
it has to do with intermittent failures).

Is this ok for HEAD and 7_5?

Thanks

Marc

2012-07-20  Marc Khouzam  <marc.khouzam@ericsson.com>

	* breakpoint.c (create_breakpoint): Store condition for pending
	breakpoints.

### Eclipse Workspace Patch 1.0
#P src
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.694
diff -u -r1.694 breakpoint.c
--- gdb/breakpoint.c    19 Jul 2012 15:38:16 -0000      1.694
+++ gdb/breakpoint.c    21 Jul 2012 02:30:14 -0000
@@ -9557,7 +9557,18 @@
       init_raw_breakpoint_without_location (b, gdbarch, type_wanted, ops);
 
       b->addr_string = copy_arg;
-      b->cond_string = NULL;
+      if (parse_condition_and_thread)
+       b->cond_string = NULL;
+      else
+       {
+         /* Create a private copy of condition string.  */
+         if (cond_string)
+           {
+             cond_string = xstrdup (cond_string);
+             make_cleanup (xfree, cond_string);
+           }
+         b->cond_string = cond_string;
+       }
       b->extra_string = NULL;
       b->ignore_count = ignore_count;
       b->disposition = tempflag ? disp_del : disp_donttouch;


Broken session:
--------------
> gdb myapp.exe
GNU gdb (GDB) 7.5.50.20120720-cvs
(gdb) interpreter-exec mi "-break-insert -f -c 1==2 /home/lmckhou/runtime-TestDSF/myLinuxDll/src/mydll.c:3"
&"No source file named /home/lmckhou/runtime-TestDSF/myLinuxDll/src/mydll.c.\n"
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/lmckhou/runtime-TestDSF/myLinuxDll/src/mydll.c:3",times="0",original-location="/home/lmckhou/runtime-TestDSF/myLinuxDll/src/mydll.c:3"}
(gdb) info b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  /home/lmckhou/runtime-TestDSF/myLinuxDll/src/mydll.c:3

=> Note that there is no condition shown with the breakpoint above

(gdb) r
Starting program: /home/lmckhou/runtime-TestDSF/myapp/Debug/myapp.exe 
warning: Cannot call inferior functions, you have broken Linux kernel i386 NX (non-executable pages) support!
Breakpoint 1, foo () at ../src/mydll.c:3
3               int j = 0;

=> Breakpoint hits although condition was 1==2


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