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 2/3] Don't force interpreter sync mode in execute_gdb_command.


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


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