From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>,
Luis Machado <luisgpm@linux.vnet.ibm.com>
Subject: Re: [PATCH] Handle absence of DT_DEBUG while debugging ld.so
Date: Tue, 29 Jul 2008 12:55:00 -0000 [thread overview]
Message-ID: <200807291354.49009.pedro@codesourcery.com> (raw)
In-Reply-To: <20080729121244.GA2175@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]
A Tuesday 29 July 2008 13:12:44, Daniel Jacobowitz wrote:
> On Mon, Jul 28, 2008 at 11:57:15PM -0300, Luis Machado wrote:
> > Yes, this specific address seems broken somehow. This is the first
> > _r_debug entry GDB gets:
>
> Looks like the section offsets are not set yet.
>
> > And this is the next _r_debug minimal symbol entry GDB gets:
>
> What do you mean by "next"? What commands did you use to get this
> output?
>
> Also, with GDB 6.8 I can "continue" after this error. With HEAD:
>
> Continuing.
> Cannot execute this command while the selected thread is running.
>
> Hey, Pedro? Cleanup trouble?
Sort of. When handling internal events we don't adjust the running
state of the thread, only the executing property. This is so the
user/frontend doesn't see a bunch of not interesting
running/stopped notifications, like say thread hopping, going through
the shell doing execs, etc.
In this case, we were still not finished with create inferior dances,
and were inside a post_create_inferior.
Note that post_create_inferior requires a !is_executing inferior, on
entry, and, it is allowed (and it does) to internally start/stop the
inferior (solib handlers do this, see *_create_inferior_hook).
If an error is thrown out of the deep bowls of post_create_inferior,
we should just propagate GDB's knowledge of the executing state to
the user/frontend running state. This restores the old behaviour.
I now get:
(gdb) r
Starting program: /lib/ld-2.7.so
Cannot access memory at address 0x21ec88
(gdb) info threads
* 1 process 30943 0x00007ffff7fe2a60 in ?? ()
(gdb) c
Continuing.
Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
You have invoked `ld.so', the helper program for shared library executables.
...
Program exited with code 0177.
OK?
--
Pedro Alves
[-- Attachment #2: fix_running_state.diff --]
[-- Type: text/x-diff, Size: 1852 bytes --]
2008-07-29 Pedro Alves <pedro@codesourcery.com>
* infcmd.c (post_create_inferior): Rename to ...
(post_create_inferior_1): ... this and make static.
(fix_running_state): New.
(post_create_inferior): New.
---
gdb/infcmd.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c 2008-07-29 13:40:22.000000000 +0100
+++ src/gdb/infcmd.c 2008-07-29 13:44:02.000000000 +0100
@@ -408,8 +408,8 @@ tty_command (char *file, int from_tty)
means (running, attaching, connecting, et cetera). The target
should be stopped. */
-void
-post_create_inferior (struct target_ops *target, int from_tty)
+static void
+post_create_inferior_1 (struct target_ops *target, int from_tty)
{
/* Be sure we own the terminal in case write operations are performed. */
target_terminal_ours ();
@@ -445,6 +445,28 @@ post_create_inferior (struct target_ops
observer_notify_inferior_created (target, from_tty);
}
+/* If an error happened, propagate GDB's knowledge of the executing
+ state to the frontend/user running state. */
+
+static void
+fix_running_state (void *arg)
+{
+ if (is_exited (inferior_ptid))
+ return;
+ set_running (inferior_ptid,
+ is_executing (inferior_ptid));
+}
+
+/* See post_create_inferior_1 for description. */
+
+void
+post_create_inferior (struct target_ops *target, int from_tty)
+{
+ struct cleanup *old_chain = make_cleanup (fix_running_state, NULL);
+ post_create_inferior_1 (target, from_tty);
+ discard_cleanups (old_chain);
+}
+
/* Kill the inferior if already running. This function is designed
to be called when we are about to start the execution of the program
from the beginning. Ask the user to confirm that he wants to restart
prev parent reply other threads:[~2008-07-29 12:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 23:55 Luis Machado
2008-07-29 2:27 ` Daniel Jacobowitz
2008-07-29 2:57 ` Luis Machado
2008-07-29 3:03 ` Luis Machado
2008-07-29 12:13 ` Daniel Jacobowitz
2008-07-29 12:46 ` Luis Machado
2008-08-12 18:16 ` Luis Machado
2008-09-05 18:31 ` Luis Machado
2008-07-29 12:55 ` Pedro Alves [this message]
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=200807291354.49009.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=luisgpm@linux.vnet.ibm.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