From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch] Fix gdb.mi internal_error on killing inferior
Date: Wed, 20 May 2009 20:43:00 -0000 [thread overview]
Message-ID: <200905202143.17772.pedro@codesourcery.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2009-05-20 20:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 20:28 Jan Kratochvil
2009-05-20 20:43 ` Pedro Alves [this message]
2009-05-20 21:36 ` Jan Kratochvil
2009-05-21 0:41 ` Pedro Alves
2009-05-21 8:44 ` Jan Kratochvil
2009-05-21 16:03 ` 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=200905202143.17772.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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