From: Hui Zhu <teawater@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>,
Marc Khouzam <marc.khouzam@ericsson.com>,
Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] Fix PR 15693 - Extra *running event when call-style dprintf hits
Date: Wed, 31 Jul 2013 08:15:00 -0000 [thread overview]
Message-ID: <CANFwon3vYcDDYsw99JtggMVD=kmHyyz9Jqby=Kikq03PdWzU0w@mail.gmail.com> (raw)
In-Reply-To: <87ehahnp93.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
On Tue, Jul 30, 2013 at 3:24 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:
>
> Hui> 2013-07-08 Hui Zhu <hui@codesourcery.com>
> Hui> PR gdb/15693
> Hui> infcall.c (run_inferior_call): Save value of call_thread->state
> Hui> and set it back.
>
> I didn't see a response to this.
> I think this needs a test case.
>
> Tom
Hi Tom,
I make a test for it.
Thanks,
Hui
2013-07-31 Hui Zhu <hui@codesourcery.com>
PR gdb/15693
* infcall.c (run_inferior_call): Save value of call_thread->state
and set it back.
2013-07-31 Hui Zhu <hui@codesourcery.com>
PR gdb/15693
* gdb.mi/mi-infcall.exp, gdb.mi/mi-infcall.c: New files.
[-- Attachment #2: fix-15693.txt --]
[-- Type: text/plain, Size: 618 bytes --]
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -385,6 +385,7 @@ run_inferior_call (struct thread_info *c
{
volatile struct gdb_exception e;
int saved_in_infcall = call_thread->control.in_infcall;
+ int saved_state = call_thread->state;
ptid_t call_thread_ptid = call_thread->ptid;
call_thread->control.in_infcall = 1;
@@ -428,7 +429,10 @@ run_inferior_call (struct thread_info *c
}
if (call_thread != NULL)
- call_thread->control.in_infcall = saved_in_infcall;
+ {
+ call_thread->control.in_infcall = saved_in_infcall;
+ call_thread->state = saved_state;
+ }
return e;
}
[-- Attachment #3: fix-15693-test.txt --]
[-- Type: text/plain, Size: 2498 bytes --]
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-infcall.c
@@ -0,0 +1,33 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+return_false (void)
+{
+ return 0;
+}
+
+int
+main ()
+{
+ int a = 0;
+
+ while (a < 3)
+ a++; /* set breakpoint here */
+
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-infcall.exp
@@ -0,0 +1,51 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
+standard_testfile
+
+if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
+ untested "failed to compile $testfile"
+ return -1
+}
+
+mi_run_to_main
+
+mi_delete_breakpoints
+
+set bp_location [gdb_get_line_number "set breakpoint here"]
+
+mi_gdb_test "-break-insert -c return_false() $bp_location" ".*" "mi insert breakpoint"
+
+set msg "check infcall"
+mi_send_resuming_command "exec-continue" "$msg continue"
+gdb_expect {
+ -re "running,thread-id=\"1\".*running,thread-id=\"1\".*running,thread-id=\"1\"" {
+ fail $msg
+ }
+ -re ".*" {
+ pass $msg
+ }
+ timeout {
+ fail $msg
+ }
+}
next prev parent reply other threads:[~2013-07-31 8:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 8:19 Hui Zhu
2013-07-29 19:24 ` Tom Tromey
2013-07-31 8:15 ` Hui Zhu [this message]
2014-05-16 0:56 ` [PATCH] PR15693 - Fix spurious *running events, thread state, dprintf-style call Pedro Alves
2014-05-16 8:28 ` Hui Zhu
2014-05-29 11:45 ` [pushed] " Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANFwon3vYcDDYsw99JtggMVD=kmHyyz9Jqby=Kikq03PdWzU0w@mail.gmail.com' \
--to=teawater@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=marc.khouzam@ericsson.com \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).