Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/3] Don't force interpreter sync mode in execute_gdb_command.
Date: Fri, 25 May 2012 09:56:00 -0000	[thread overview]
Message-ID: <1337939766-1579-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1337939766-1579-1-git-send-email-yao@codesourcery.com>

This patch is to fix the internal error reported in PR14135

  FAIL: gdb.python/py-finish-breakpoint.exp: check MyFinishBreakpoint hit (GDB
internal error)

This internal error is caused by GDB fetches inferior event recursively
(fetch_inferior_event -> bpstat_check_breakpoint_conditions -> gdbpy_should_stop
-> execute_gdb_command -> fetch_inferior_event), and you can see backtrace
in details in comment#2 in PR14135.  It is caused by forcing interpreter to
sync mode by this patch

  Flip the interpreter to synchronously wait for commands finishing, in command lists and similars
  http://sourceware.org/ml/gdb-patches/2011-09/msg00037.html

This patch is correct, but I think we don't have to force interpreter into sync
in execute_gdb_command.  execute_gdb_command is called from two paths,

  1. python_command.  When we type 'python gdb.execute ("foo")", it goes in path,
since interpreter_async has been set to zero in this path, we don't have to
set it again in execute_gdb_command.

  2. gdbpy_should_stop.  When we write python script to do "gdb.execute ("foo")"
in gdb.Breakpoint::Stop () method, async mode of interpreter doesn't matter.
Because the commands people can use here are restricted to not "alter execute
state of inferior", so it should be to issue second command when the
first one is not finished.

Noe that this patch doesn't fix all the fails in PR14135.

gdb:

2012-05-24  Yao Qi  <yao@codesourcery.com>

	PR 14135.
	* python/python.c (execute_gdb_command): Don't force the interpreter
	to sync mode.
---
 gdb/python/python.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 19eb7b5..2d2ed3a 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -441,9 +441,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       char *copy = xstrdup (arg);
       struct cleanup *cleanup = make_cleanup (xfree, copy);
 
-      make_cleanup_restore_integer (&interpreter_async);
-      interpreter_async = 0;
-
       prevent_dont_repeat ();
       if (to_string)
 	result = execute_command_to_string (copy, from_tty);
-- 
1.7.0.4


  reply	other threads:[~2012-05-25  9:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25  9:56 Fix PR14135 Yao Qi
2012-05-25  9:56 ` Yao Qi [this message]
2013-07-30 19:55   ` [PATCH 2/3] Don't force interpreter sync mode in execute_gdb_command Tom Tromey
2013-07-30 20:13     ` Tom Tromey
2012-05-25  9:56 ` [PATCH 3/3] Match output in async mode Yao Qi
2013-07-30 20:06   ` Tom Tromey
2013-07-31  7:45     ` Yao Qi
2012-05-25  9:56 ` [PATCH 1/3] New test case for PR12929 Yao Qi
2013-07-30 19:49   ` Tom Tromey
2013-07-30 20:11     ` Tom Tromey
2013-07-31  7:53     ` Yao Qi
2013-07-31 15:19       ` Tom Tromey
2013-08-01  6:39         ` Yao Qi
2012-07-17  2:51 ` Fix PR14135 Yao Qi

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=1337939766-1579-3-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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