From: "H . J . Lu" <hjl@lucon.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [hjl@lucon.org: Re: Does gdb 5.2 work with statically linked thread application under Linux?]
Date: Wed, 13 Mar 2002 09:54:00 -0000 [thread overview]
Message-ID: <20020313095415.B9484@lucon.org> (raw)
In-Reply-To: <20020313125034.B14483@nevyn.them.org>; from drow@mvista.com on Wed, Mar 13, 2002 at 12:50:34PM -0500
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
On Wed, Mar 13, 2002 at 12:50:34PM -0500, Daniel Jacobowitz wrote:
> Does anyone have a comment on this patch? It fixes thread_db for
> statically linked binaries (which I broke), and I think it's
> legitimate.
>
I am enclosing an upated patch here. Any targets should be able to
use target_corefile_hook if necessary.
H.J.
---
[-- Attachment #2: gdb-static.patch --]
[-- Type: text/plain, Size: 3110 bytes --]
2002-03-07 H.J. Lu (hjl@gnu.org)
* target.h (target_corefile_hook): New prototype.
* target.c (target_corefile_hook): New.
* corelow.c (core_open): Call target_corefile_hook if needed.
* thread-db.c (target_corefile_chain): New.
(thread_db_corefile): New.
(thread_db_new_objfile): Don't check target_has_execution.
(_initialize_thread_db): Save target_corefile_hook in
target_corefile_chain.
Set target_corefile_hook to thread_db_corefile.
--- gdb/corelow.c.static Wed Mar 6 22:30:49 2002
+++ gdb/corelow.c Thu Mar 7 15:01:41 2002
@@ -303,6 +303,9 @@ core_open (char *filename, int from_tty)
filename, bfd_errmsg (bfd_get_error ()));
}
+ if (target_corefile_hook)
+ target_corefile_hook ();
+
/* Looks semi-reasonable. Toss the old core file and work on the new. */
discard_cleanups (old_chain); /* Don't free filename any more */
--- gdb/target.c.static Wed Mar 6 22:31:31 2002
+++ gdb/target.c Thu Mar 7 14:54:50 2002
@@ -38,6 +38,8 @@
extern int errno;
+void (*target_corefile_hook) (void);
+
static void target_info (char *, int);
static void cleanup_target (struct target_ops *);
--- gdb/target.h.static Wed Mar 6 22:31:31 2002
+++ gdb/target.h Thu Mar 7 14:54:38 2002
@@ -985,6 +985,8 @@ extern char *normal_pid_to_str (ptid_t p
extern void (*target_new_objfile_hook) (struct objfile *);
+extern void (*target_corefile_hook) (void);
+
#ifndef target_pid_or_tid_to_str
#define target_pid_or_tid_to_str(ID) \
target_pid_to_str (ID)
--- gdb/thread-db.c.static Wed Mar 6 22:31:31 2002
+++ gdb/thread-db.c Thu Mar 7 15:20:17 2002
@@ -54,6 +54,9 @@ static struct target_ops *target_beneath
/* Pointer to the next function on the objfile event chain. */
static void (*target_new_objfile_chain) (struct objfile *objfile);
+/* Pointer to the next function on the corefile event chain. */
+static void (*target_corefile_chain) (void);
+
/* Non-zero if we're using this module's target vector. */
static int using_thread_db;
@@ -479,13 +482,28 @@ disable_thread_signals (void)
}
static void
+thread_db_corefile (void)
+{
+ if (using_thread_db)
+ {
+ /* If the thread_db target is active, deactivate it now. */
+ gdb_assert (proc_handle.pid == 0);
+ unpush_target (&thread_db_ops);
+ using_thread_db = 0;
+ }
+
+ keep_thread_db = 0;
+
+ if (target_corefile_chain)
+ target_corefile_chain ();
+}
+
+static void
thread_db_new_objfile (struct objfile *objfile)
{
td_err_e err;
- /* Don't attempt to use thread_db on targets which can not run
- (core files). */
- if (objfile == NULL || !target_has_execution)
+ if (objfile == NULL)
{
/* All symbols have been discarded. If the thread_db target is
active, deactivate it now. */
@@ -1040,5 +1058,7 @@ _initialize_thread_db (void)
/* Add ourselves to objfile event chain. */
target_new_objfile_chain = target_new_objfile_hook;
target_new_objfile_hook = thread_db_new_objfile;
+ target_corefile_chain = target_corefile_hook;
+ target_corefile_hook = thread_db_corefile;
}
}
next prev parent reply other threads:[~2002-03-13 17:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-13 9:50 Daniel Jacobowitz
2002-03-13 9:54 ` H . J . Lu [this message]
2002-03-15 18:51 ` Andrew Cagney
2002-03-15 19:20 ` Daniel Jacobowitz
2002-03-15 19:56 ` Andrew Cagney
2002-03-15 20:16 ` Daniel Jacobowitz
2002-03-15 20:48 ` Andrew Cagney
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=20020313095415.B9484@lucon.org \
--to=hjl@lucon.org \
--cc=gdb-patches@sources.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