From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: [RFA] detect inferior exit in call_function_by_hand
Date: Wed, 12 Nov 2008 08:33:00 -0000 [thread overview]
Message-ID: <200811112312.19409.pedro@codesourcery.com> (raw)
In-Reply-To: <20081111225021.015C61C79A1@localhost>
On Tuesday 11 November 2008 22:50:20, Doug Evans wrote:
> I found this while playing with the archer exception-rewind branch.
> The message currently printed when the inferior exits during
> call_function_by_hand is misleading.
> [On the branch one currently gets a segv,
> stopped_by_random_signal/stop_stack_dummy do not fully describe
> all the possible states of the inferior.]
Looks OK to me, apart from the tiny issues below.
>
> + if (! target_has_execution)
> + {
> + /* If we try to restore the inferior status (via the cleanup),
> + we'll crash as the inferior is no longer running. */
> + discard_cleanups (inf_status_cleanup);
> + discard_inferior_status (inf_status);
> + /* FIXME: Insert a bunch of wrap_here; name can be very long if it's
> + a C++ name with arguments and stuff. */
Remove this copy&pasted FIXME note, it doesn't make sense for
this case (you're not printing a function name).
> + error (_("\
> +The program being debugged exited while in a function called from GDB."));
> + }
> +
> if (stopped_by_random_signal || !stop_stack_dummy)
> {
> /* Find the name of the function we're about to complain about. */
> +
> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
> + untested callfuncs.exp
^^^^ ECOPYPASTE (callexit.exp)
> + return -1
> +# Set the current language to C. This counts as a test. If it
> +# fails, then we skip the other tests.
> +
I don't know why all the infcalls tests do this --- they
all seem to do it. Do you/anyone know(s) why?
> +proc set_lang_c {} {
> + global gdb_prompt
> +
> + send_gdb "set language c\n"
> + gdb_expect {
> + -re ".*$gdb_prompt $" {}
> + timeout { fail "set language c (timeout)" ; return 0; }
> + }
> +
> + send_gdb "show language\n"
> + gdb_expect {
> + -re ".* source language is \"c\".*$gdb_prompt $" {
> + pass "set language to \"c\""
> + return 1
> + }
> + -re ".*$gdb_prompt $" {
> + fail "setting language to \"c\""
> + return 0
> + }
> + timeout {
> + fail "can't show language (timeout)"
> + return 0
> + }
> + }
> +}
> +
> +# Start with a fresh gdb.
> +
> +gdb_exit
> +gdb_start
> +gdb_reinitialize_dir $srcdir/$subdir
> +gdb_load ${binfile}
> +
> +if { ![set_lang_c] } {
> + gdb_suppress_tests;
> +} else {
> + if { ![runto_main] } {
> + gdb_suppress_tests;
> + }
> +}
> +
--
Pedro Alves
next prev parent reply other threads:[~2008-11-11 23:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 8:32 Doug Evans
2008-11-12 8:33 ` Pedro Alves [this message]
2008-11-14 11:43 ` Joel Brobecker
2008-11-14 13:51 ` Doug Evans
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=200811112312.19409.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=dje@google.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