From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: linux native async mode support
Date: Fri, 28 Mar 2008 16:07:00 -0000 [thread overview]
Message-ID: <200803281606.59284.pedro@codesourcery.com> (raw)
In-Reply-To: <alpine.SOC.1.00.0803281440090.6238@piorun>
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
A Friday 28 March 2008 14:47:54, Maciej W. Rozycki wrote:
> On Fri, 21 Mar 2008, Pedro Alves wrote:
> > This is what I checked in after another round of testing
> > on x86_64-unknown-linux-gnu.
>
> Hmm, I have narrowed it down to be the reason of breakage when the
> current head of the tree is built for the mipsisa32-sde-elf target. The
> symptom is when you run GBD interactively (no arguments) and enter any
> line for processing (a lone new-line character is enough), then the
> program crashes with SIGSEGV (an infinite recursion, it would seem).
Yes, it's infinite recursion. Thanks for spotting that, and sorry for
giving you trouble.
The problem comes from the way we cope to the fact that
target_can_async_p is called in several places before the
runnable target is pushed on the stack. This particular case was
happening in execute_command.
Currently, if no target is yet pushed, we default
to look for the default run target, and check if that can async.
On a cross-configured gdb, without a native debugger, there's no
default run target, so find_default_run_target calls error. As if
this wasn't a problematic enough, throw_exception ends up calling
target_can_async_p, which leads to infinite recursion. I know
that Vladimir has a two patches that remove these two problematic
target_can_async_p calls (one that removes the
command_list_handler_continuation, the other that removes the
target_can_async_p call from throw_exception), but that still
leaves a lot of call in infcmd.c, that I'm not sure we'll be able
to remove.
The attached fixes the problem for me. We're not really
interested in calling error in this case.
--
Pedro Alves
[-- Attachment #2: fix_inf_recursion.diff --]
[-- Type: text/x-diff, Size: 2383 bytes --]
2008-03-28 Pedro Alves <pedro@codesourcery.com>
* target.c (find_default_run_target): All a NULL `do_mesg'
parameter. If it is NULL, don't call error.
(find_default_can_async_p, find_default_is_async_p): Pass NULL as
`do_mesg'parameter to find_default_run_target. If no target was
found, return 0.
---
gdb/target.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c 2008-03-28 15:16:23.000000000 +0000
+++ src/gdb/target.c 2008-03-28 15:50:54.000000000 +0000
@@ -1782,7 +1782,8 @@ The \"%s\" target does not support \"run
execute a run or attach command without any other data. This is
used to locate the default process stratum.
- Result is always valid (error() is called for errors). */
+ If DO_MESG is not NULL, the result is always valid (error() is
+ called for errors); else, return NULL on error. */
static struct target_ops *
find_default_run_target (char *do_mesg)
@@ -1804,7 +1805,12 @@ find_default_run_target (char *do_mesg)
}
if (count != 1)
- error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ {
+ if (do_mesg)
+ error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ else
+ return NULL;
+ }
return runable;
}
@@ -1835,8 +1841,12 @@ find_default_can_async_p (void)
{
struct target_ops *t;
- t = find_default_run_target ("async");
- if (t->to_can_async_p)
+ /* This may be called before the target is pushed on the stack;
+ look for the default process stratum. If there's none, gdb isn't
+ configured with a native debugger, and target remote isn't
+ connected yet. */
+ t = find_default_run_target (NULL);
+ if (t && t->to_can_async_p)
return (t->to_can_async_p) ();
return 0;
}
@@ -1846,8 +1856,12 @@ find_default_is_async_p (void)
{
struct target_ops *t;
- t = find_default_run_target ("async");
- if (t->to_is_async_p)
+ /* This may be called before the target is pushed on the stack;
+ look for the default process stratum. If there's none, gdb isn't
+ configured with a native debugger, and target remote isn't
+ connected yet. */
+ t = find_default_run_target (NULL);
+ if (t && t->to_is_async_p)
return (t->to_is_async_p) ();
return 0;
}
next prev parent reply other threads:[~2008-03-28 16:07 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-14 8:11 Pedro Alves
2008-03-14 21:17 ` Daniel Jacobowitz
2008-03-17 16:05 ` Pedro Alves
2008-03-17 22:05 ` Daniel Jacobowitz
2008-03-18 23:27 ` Pedro Alves
2008-03-18 23:58 ` Daniel Jacobowitz
2008-03-21 15:55 ` Daniel Jacobowitz
2008-03-21 17:19 ` Pedro Alves
2008-03-28 14:48 ` Maciej W. Rozycki
2008-03-28 16:07 ` Pedro Alves [this message]
2008-03-28 16:13 ` Daniel Jacobowitz
2008-03-28 16:40 ` Pedro Alves
2008-03-18 0:06 ` Nick Roberts
2008-03-18 23:28 ` Pedro Alves
2008-03-19 3:59 ` Nick Roberts
2008-03-19 16:25 ` Luis Machado
2008-03-19 23:19 ` Pedro Alves
2008-03-19 23:26 ` Pedro Alves
2008-03-20 1:58 ` Nick Roberts
2008-03-21 15:47 ` Daniel Jacobowitz
2008-03-21 15:49 ` Daniel Jacobowitz
2008-03-21 23:02 ` Nick Roberts
2008-03-22 1:25 ` Daniel Jacobowitz
2008-03-22 22:06 ` Nick Roberts
2008-04-01 14:00 ` Daniel Jacobowitz
2008-04-01 15:17 ` Vladimir Prus
2008-04-01 20:09 ` Nick Roberts
2008-04-04 12:34 ` Vladimir Prus
2008-04-05 17:20 ` Nick Roberts
2008-04-05 22:07 ` Vladimir Prus
2008-04-07 0:06 ` Nick Roberts
2008-04-07 2:33 ` Nick Roberts
2008-03-18 2:47 ` Nick Roberts
2008-03-14 23:10 ` Nick Roberts
2008-03-15 1:58 ` Pedro Alves
2008-03-15 3:11 ` Daniel Jacobowitz
2008-03-17 23:41 ` Nick Roberts
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=200803281606.59284.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=macro@linux-mips.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