This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix gdb.mi internal_error on killing inferior
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Wed, 20 May 2009 21:43:17 +0100
- Subject: Re: [patch] Fix gdb.mi internal_error on killing inferior
- References: <20090520202749.GA17984@host0.dyn.jankratochvil.net>
On Wednesday 20 May 2009 21:27:49, Jan Kratochvil wrote:
> Hi,
>
> currently GDB crashes on killing multithreaded inferior. Just it will happen
> only on quitting GDB because dejagnu already closed the communication with
> GDB.
>
> With the included testcase without the fix it will print:
>
> (gdb) ^M
> PASS: gdb.mi/mi-console.exp: finished step over hello
> 998-target-attach^M
> ~"A program is being debugged already. Kill it? (y or n) "y^M
> ^M
> &"Recursive internal problem.\n"^M
> ERROR: Error testminating GDB.
> testcase ../.././gdb/testsuite/gdb.mi/mi-console.exp completed in 1 seconds
>
Weird, I don't see this happening. Why is it that we reach terminal_ours
with null_ptid? And I think that if this legitimate, we should still
restore our process group, terminal settings and signal handlers.
>
>
> Thanks,
> Jan
>
>
> gdb/
> 2009-05-20 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * inflow.c (terminal_ours_1): Return if INFERIOR_PTID is NULL_PTID.
>
> Gdb/testsuite/
> 2009-05-20 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * lib/mi-support.exp (mi_uncatched_gdb_exit): Explicitly terminate the
> inferior.
>
> --- gdb/inflow.c 19 May 2009 10:08:19 -0000 1.50
> +++ gdb/inflow.c 20 May 2009 20:00:30 -0000
> @@ -361,6 +361,9 @@ terminal_ours_1 (int output_only)
> if (terminal_is_ours)
> return;
>
> + if (ptid_equal (inferior_ptid, null_ptid))
> + return;
> +
> /* Checking inferior->run_terminal is necessary so that
> if GDB is running in the background, it won't block trying
> to do the ioctl()'s below. Checking gdb_has_a_terminal
> --- gdb/testsuite/lib/mi-support.exp 2 Apr 2009 15:43:10 -0000 1.83
> +++ gdb/testsuite/lib/mi-support.exp 20 May 2009 20:00:31 -0000
> @@ -61,6 +61,28 @@ proc mi_uncatched_gdb_exit {} {
>
> verbose "Quitting $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS"
>
> + # Test successful termination of the inferior. It is an optional check,
> + # inferior would get also terminated by -gdb-exit or remote_close below.
> +
> + if { [board_info host exists fileid] } {
> + send_gdb "998-target-attach\n";
> + gdb_expect 10 {
> + -re "y or n" {
> + send_gdb "y\n";
> + exp_continue;
> + }
> + -re "Undefined command.*$gdb_prompt $" {
> + send_gdb "quit\n"
> + exp_continue;
> + }
> + -re "998\\^error,msg=\"Argument required \\(process-id to attach\\).\".*$gdb_prompt \r\n$" {
> + }
> + default {
> + perror "Error terminating the inferior."
> + }
> + }
> + }
> +
> if { [is_remote host] && [board_info host exists fileid] } {
> send_gdb "999-gdb-exit\n";
> gdb_expect 10 {
>
--
Pedro Alves