Re: [patch] fix for PR2424

Aleksandar Ristovski
2008-03-09T00:12:53Z

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

Vladimir Prus wrote:
> FWIW, you don't say what function in mi-support.exp is changed,
> and it would be better if your patch was generated with -u (unified diff,
> 3 lines of context) -- the current one has no context at all, so I
> can only guess which function that is.

Please find attached new diffs.

>
> Speaking of the problem itself -- in PR2424 you say:
>
> When inferior stops at temporary breakpoint, message is:
> *stopped,thread-id="0",.......
> without mentioning "reason=breakpoint-hit"
> This causes issues for multithreaded programs.
>
> What issues does it cause for MT programs?

When inferior hits a temporary breakpoint, due to breakpoint removal the reason
for stop is "lost in translation". This leaves user guessing what the reason for
stop was. This is applicable to both single and multi threaded inferiors, but
gets more annoying when multiple threads exist since then client program (in my
case IDE - CDT) can not figure out which thread caused the stop in addition to
not knowing the reason (I am not working on CDT but I was explained that missing
"reason" is to blame, and after the patch I proposed I was told things now work
as expected).

@Nick: I think the breakpoint should be reported. The fact that it is temporary
doesn't make it much different than a regular breakpoint... but maybe I'm
missing something.

[-- Attachment #2: PR2424test.diff --]
[-- Type: text/plain, Size: 896 bytes --]

Index: gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.51
diff -u -p -r1.51 mi-support.exp
--- gdb/testsuite/lib/mi-support.exp 29 Jan 2008 19:36:58 -0000 1.51
+++ gdb/testsuite/lib/mi-support.exp 9 Mar 2008 00:03:39 -0000
@@ -890,7 +890,7 @@ proc mi_runto_helper {func run_or_contin
}

gdb_expect {
- -re ".*000\\*stopped,thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
+ -re ".*000\\*stopped,reason=.*thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
pass "$test"
return 0
}

[-- Attachment #3: PR2424infrun.c.diff --]
[-- Type: text/plain, Size: 1007 bytes --]

Index: gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.266
diff -u -p -r1.266 infrun.c
--- gdb/infrun.c 29 Jan 2008 22:47:19 -0000 1.266
+++ gdb/infrun.c 9 Mar 2008 00:04:36 -0000
@@ -3151,11 +3151,6 @@ Further execution is probably impossible
}
}

- /* Delete the breakpoint we stopped at, if it wants to be deleted.
- Delete any breakpoint that is to be deleted at the next stop. */
-
- breakpoint_auto_delete (stop_bpstat);
-
/* If an auto-display called a function and that got a signal,
delete that auto-display to avoid an infinite recursion. */

@@ -3292,6 +3287,9 @@ Further execution is probably impossible
}

done:
+ /* Delete the breakpoint we stopped at, if it wants to be deleted.
+ Delete any breakpoint that is to be deleted at the next stop. */
+ breakpoint_auto_delete (stop_bpstat);
annotate_stopped ();
observer_notify_normal_stop (stop_bpstat);
}