[PATCH] PR mi/2077 "set edit off" breaks MI
Nick Roberts
nickrob@snap.net.nz
Mon Nov 20 22:25:00 GMT 2006
> We've branched; you have a patch ready; let's get it going! I'd be
> glad to see this merged. I'm afraid I really haven't looked at what
> you have so far; could you post a current patch that I can experiment
> with?
I'm attaching it below. To run testsuite with asynchronous event loop put the
line:
set GDBFLAGS "--async"
at the bottom of site.exp.
I've taken nearly all the MI changes out but running MI is still one good way
of checking asynchronous behaviour:
synchronous:
n
&"n\n"
~"70\t int n1 = 7, n2 = 8, n3 = 9;\n"
^done
(gdb)
asynchronous:
n
&"n\n"
^running
^done
(gdb)
*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x080485bb",func="main",args=[],file="myprog.c",fullname="/home/nickrob/myprog.c",line="70"}
(gdb)
I've created a new testfile (below) for this kind of thing.
> I'll try to look at it during this week.
Thanks. It's probably still a bit rough but if you can tell me what to do I'll
clean it up/make it more general.
> > I'll ask RMS, I've always been told that the committer's name should not be
> > the one to go in the changelog.
>
> True, but you've updated the patch and in general done more work on it;
That's true. I've tried to put my changes at the top of the changelog and
pure Apple at the bottom prefixed with "copied verbatim" i.e idiot fashion
where I probably don't really know what is going on.
--
Nick http://www.inet.net.nz/~nickrob
2006-11-21 Nick Roberts <nickrob@snap.net.nz>
* defs.h (async_signal_hook): Declare.
(event_loop_p): New extern.
(deprecated_command_loop_hook): Make argument type void*.
* main.c (captured_main, print_gdb_help): Add and describe --async
option conditional on macro ASYNC.
(event_loop_p): New global variable.
* event-loop.c (async_signal_hook): New function pointer.
(gdb_wait_for_event): Use it.
* linux-nat.c: Include inf-loop.h. Include poll.h conditionally.
(gdb_post_startup): New extern.
(gdb_status, gdb_file_event): New variables.
(async_mask, old_mask, async_action, old_action): New variables.
(linux_nat_attach, linux_nat_detach): Condition on
target_can_async_p.
(linux_nat_resume): Add async file handler if necessary.
(linux_nat_fetch_event): New function.
(linux_nat_wait): Use it when asynchronous.
(async_sigchld_handler, linux_nat_signal_hook): New functions.
(_initialize_linux_nat): Set up signal handling and pipe for
asynchronous behaviour.
* infrun.c: Include event-top.h.
(sync_execution): Set sync_execution to 1 initially.
(proceed): Set target_executing to 0 if synchronous.
(handle_inferior_event): Print process switching for MI(?).
Don't call context_switch (ecs) or flush_cached_frames ().
Use local variable was_sync_execution.
* inf-ptrace.c: Include inf-loop.h, event-loop.h and event-top.h.
(standard_is_async_p, standard_can_async_p)
(initialize_sigint_signal_handler): New externs.
(async_client_context, async_terminal_ours_p): New variables.
(async_file_handler, inf_ptrace_async): New functions.
(inf_ptrace_him): Use gdb_post_startup as a flag.
(inf_ptrace_mourn_inferior): Don't call waitpid if asynchronous.
(inf_ptrace_attach): Set gdb_post_startup. Call wait_for_inferior
if asynchronous.
(async_terminal_inferior): New function.
(inf_ptrace_target): Add methods if asynchronous.
* exec.c (standard_async, standard_is_async_p, standard_can_async_p):
New functions.
(init_exec_ops): Initialise above methods if GDB is invoked
with --async.
* infcmd.c (jump_command): Call async_disable_stdin if necessary
before decode_line_spec_1.
(attach_command): Make attach work asynchronously.
(copied verbatim)
* event-top.h (cli_command_loop): Make argument type void*.
(copied verbatim)
* event-top.c (cli_command_loop): Make argument void*.
(display_gdb_prompt, async_enable_stdin)
(async_disable_stdin, handle_sigint, async_request_quit)
(gdb_setup_readline, _initialize_event_loop):
Changes for asynchronous operation.
(copied verbatim)
* interps.c (interp_set): Make type struct interp *.
Don't do_all_continuations or call clear_interpreter_hooks.
(current_interp_command_loop): Call command_loop with NULL argument.
(interp_set_quiet): Don't make static.
(copied verbatim)
* interps.h (interp_set, interp_set_quiet): New externs.
(copied verbatim)
* inf-loop.c (inferior_event_handler, complete_execution):
Changes for asynchronous operation.
(copied verbatim)
* cli/cli-interp.c (cli_interpreter_resume): Set sync_execution.
(safe_execute_command): Don't make it static.
(_initialize_cli_interp): Add cli_command_loop to interp_procs
structure.
(copied verbatim)
* wrapper.h (safe_execute_command): Declare here.
(copied verbatim)
* remote.c (cleanup_sigint_signal_handler)
(initialize_sigint_signal_handler): Don't make static.
(copied verbatim)
* top.c (deprecated_command_loop_hook): Make argument type void*.
(copied verbatim)
* mi/mi-interp.c (mi1_command_loop, mi2_command_loop)
(mi3_command_loop): Make argument type void*.
* config/i386/nm-linux.h: Add ASYNC macro definition.
* Makefile.in (inf-ptrace.o, infrun.o, linux-nat.o)
(cli-interp.o): Add new header dependencies.
ChangeLog | 102 +++++++++++++++++++++++++++
Makefile.in | 9 !!
cli/cli-interp.c | 11 -!
config/i386/nm-linux.h | 3
defs.h | 6 +
event-loop.c | 15 ++++
event-top.c | 93 ++++++++++++++!!!!!!!!!!!
event-top.h | 2
exec.c | 26 ++++++-
inf-loop.c | 46 ++++++!!!!!!
inf-ptrace.c | 101 ++++++++++++++++++++++++++!
infcmd.c | 25 ++--!!
infrun.c | 34 ++++---!
interps.c | 40 +++!!!!!!!
interps.h | 3
linux-nat.c | 181 +++++++++++++++++++++++++++++!!!!!!!!!!!!!!!!!!!
main.c | 15 ++++
mi/mi-interp.c | 12 !!!
remote.c | 8 !!
top.c | 2
wrapper.h | 2
21 files changed, 490 insertions(+), 25 deletions(-), 221 modifications(!)
# Copyright 1999, 2000, 2001, 2002, 2004 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Test asynchronous Machine Interface (MI) operations
#
load_lib mi-support.exp
set saved_gdbflags $GDBFLAGS
set GDBFLAGS "-nw --async"
set MIFLAGS "-i=mi"
#set verbose 3
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "basics"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
untested mi-async.exp
return -1
}
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
# mi_gdb_test cannot be used for asynchronous commands because there are
# two prompts involved and this can lead to a race condition.
proc linux_async_tests {} {
global mi_gdb_prompt
global hex
set line_main_head [gdb_get_line_number "main ("]
set line_main_body [expr $line_main_head + 2]
set line_main_next [expr $line_main_head + 3]
send_gdb "start\n"
gdb_expect {
-re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
gdb_expect {
-re "\\*stopped,thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
pass "Asynchronous response after start command"
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after start command (2)"
}
timeout {
fail "Asynchronous response after start command (timeout 2)"
}
}
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after start command (1)"
}
timeout {fail "Asynchronous response after start command (timeout 1)"}
}
send_gdb "next\n"
gdb_expect {
-re "\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
gdb_expect {
-re "\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_next\"\}\r\n$mi_gdb_prompt$" {
pass "Asynchronous response after next command"
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after next command (2)"
}
timeout {
fail "Asynchronous response after next command (timeout 2)"
}
}
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after next command (1)"
}
timeout {fail "Asynchronous response after next command (timeout 1)"}
}
send_gdb "start\n"
gdb_expect {
-re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
gdb_expect {
-re "\\*stopped,thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
pass "Asynchronous response after (re) start"
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after (re) start (2)"
}
timeout {
fail "Asynchronous response after (re) start (timeout 2)"
}
}
}
-re ".*$mi_gdb_prompt$" {
fail "Asynchronous response after (re) start (1)"
}
timeout {fail "Asynchronous response after (re) start (timeout 1)"}
}
}
#if [istarget "i386-*-linux-gnu"] then {
linux_async_tests
#}
mi_gdb_exit
set GDBFLAGS $saved_gdbflags
return 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: async5.diff.gz
Type: application/octet-stream
Size: 14324 bytes
Desc: async without threads, handle SIGCHLD in gdb_wait_for_event.
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061120/c969a5ed/attachment.obj>
More information about the Gdb-patches
mailing list