mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 20:49:43 +00:00
* linux-thread-db.c: Include "linux-nat.h".
(check_for_thread_db): New function, split out from thread_db_new_objfile. Remove dead check for active thread_db on inapplicable targets. (thread_db_new_objfile): Call check_for_thread_db. * Makefile.in (linux-thread-db.o): Update. * linux-nat.c (child_post_attach): Call check_for_thread_db. (linux_child_post_startup_inferior): Likewise. (lin_lwp_attach_lwp): Call target_post_attach instead of child_post_attach. * linux-nat.h (check_for_thread_db): New prototype.
This commit is contained in:
parent
6d820c5c12
commit
0ec9a092fd
@ -1,3 +1,17 @@
|
|||||||
|
2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* linux-thread-db.c: Include "linux-nat.h".
|
||||||
|
(check_for_thread_db): New function, split out from
|
||||||
|
thread_db_new_objfile. Remove dead check for active
|
||||||
|
thread_db on inapplicable targets.
|
||||||
|
(thread_db_new_objfile): Call check_for_thread_db.
|
||||||
|
* Makefile.in (linux-thread-db.o): Update.
|
||||||
|
* linux-nat.c (child_post_attach): Call check_for_thread_db.
|
||||||
|
(linux_child_post_startup_inferior): Likewise.
|
||||||
|
(lin_lwp_attach_lwp): Call target_post_attach instead of
|
||||||
|
child_post_attach.
|
||||||
|
* linux-nat.h (check_for_thread_db): New prototype.
|
||||||
|
|
||||||
2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
|
2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* remote.c (struct remote_state): Add BUF and BUF_SIZE.
|
* remote.c (struct remote_state): Add BUF and BUF_SIZE.
|
||||||
|
@ -2200,7 +2200,7 @@ linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \
|
|||||||
linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
|
linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
|
||||||
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
|
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
|
||||||
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
|
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
|
||||||
$(regcache_h) $(solib_svr4_h) $(gdbcore_h)
|
$(regcache_h) $(solib_svr4_h) $(gdbcore_h) $(linux_nat_h)
|
||||||
lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
|
lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
|
||||||
$(gdbcore_h) $(regcache_h)
|
$(gdbcore_h) $(regcache_h)
|
||||||
m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
|
m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
|
||||||
|
@ -334,12 +334,14 @@ void
|
|||||||
child_post_attach (int pid)
|
child_post_attach (int pid)
|
||||||
{
|
{
|
||||||
linux_enable_event_reporting (pid_to_ptid (pid));
|
linux_enable_event_reporting (pid_to_ptid (pid));
|
||||||
|
check_for_thread_db ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
linux_child_post_startup_inferior (ptid_t ptid)
|
linux_child_post_startup_inferior (ptid_t ptid)
|
||||||
{
|
{
|
||||||
linux_enable_event_reporting (ptid);
|
linux_enable_event_reporting (ptid);
|
||||||
|
check_for_thread_db ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -963,7 +965,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
|
|||||||
gdb_assert (pid == GET_LWP (ptid)
|
gdb_assert (pid == GET_LWP (ptid)
|
||||||
&& WIFSTOPPED (status) && WSTOPSIG (status));
|
&& WIFSTOPPED (status) && WSTOPSIG (status));
|
||||||
|
|
||||||
child_post_attach (pid);
|
target_post_attach (pid);
|
||||||
|
|
||||||
lp->stopped = 1;
|
lp->stopped = 1;
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ struct lwp_info
|
|||||||
struct lwp_info *next;
|
struct lwp_info *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Attempt to initialize libthread_db. */
|
||||||
|
void check_for_thread_db (void);
|
||||||
|
|
||||||
/* Find process PID's pending signal set from /proc/pid/status. */
|
/* Find process PID's pending signal set from /proc/pid/status. */
|
||||||
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
|
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "solib-svr4.h"
|
#include "solib-svr4.h"
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
|
#include "linux-nat.h"
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LIBC_VERSION_H
|
#ifdef HAVE_GNU_LIBC_VERSION_H
|
||||||
#include <gnu/libc-version.h>
|
#include <gnu/libc-version.h>
|
||||||
@ -626,59 +627,49 @@ check_thread_signals (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/* Check whether thread_db is usable. This function is called when
|
||||||
thread_db_new_objfile (struct objfile *objfile)
|
an inferior is created (or otherwise acquired, e.g. attached to)
|
||||||
|
and when new shared libraries are loaded into a running process. */
|
||||||
|
|
||||||
|
void
|
||||||
|
check_for_thread_db (void)
|
||||||
{
|
{
|
||||||
td_err_e err;
|
td_err_e err;
|
||||||
|
static int already_loaded;
|
||||||
|
|
||||||
/* First time through, report that libthread_db was successfuly
|
/* First time through, report that libthread_db was successfuly
|
||||||
loaded. Can't print this in in thread_db_load as, at that stage,
|
loaded. Can't print this in in thread_db_load as, at that stage,
|
||||||
the interpreter and it's console haven't started. The real
|
the interpreter and it's console haven't started. */
|
||||||
problem here is that libthread_db is loaded too early - it should
|
|
||||||
only be loaded when there is a program to debug. */
|
if (!already_loaded)
|
||||||
{
|
|
||||||
static int dejavu;
|
|
||||||
if (!dejavu)
|
|
||||||
{
|
{
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
const char *library = NULL;
|
const char *library = NULL;
|
||||||
/* Try dladdr. */
|
|
||||||
if (dladdr ((*td_ta_new_p), &info) != 0)
|
if (dladdr ((*td_ta_new_p), &info) != 0)
|
||||||
library = info.dli_fname;
|
library = info.dli_fname;
|
||||||
|
|
||||||
/* Try dlinfo? */
|
/* Try dlinfo? */
|
||||||
|
|
||||||
if (library == NULL)
|
if (library == NULL)
|
||||||
/* Paranoid - don't let a NULL path slip through. */
|
/* Paranoid - don't let a NULL path slip through. */
|
||||||
library = LIBTHREAD_DB_SO;
|
library = LIBTHREAD_DB_SO;
|
||||||
|
|
||||||
printf_unfiltered (_("Using host libthread_db library \"%s\".\n"),
|
printf_unfiltered (_("Using host libthread_db library \"%s\".\n"),
|
||||||
library);
|
library);
|
||||||
dejavu = 1;
|
already_loaded = 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't attempt to use thread_db on targets which can not run
|
|
||||||
(core files). */
|
|
||||||
if (objfile == NULL || !target_has_execution)
|
|
||||||
{
|
|
||||||
/* All symbols have been discarded. If the thread_db target is
|
|
||||||
active, deactivate it now. */
|
|
||||||
if (using_thread_db)
|
|
||||||
{
|
|
||||||
gdb_assert (proc_handle.pid == 0);
|
|
||||||
unpush_target (&thread_db_ops);
|
|
||||||
using_thread_db = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto quit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (using_thread_db)
|
if (using_thread_db)
|
||||||
/* Nothing to do. The thread library was already detected and the
|
/* Nothing to do. The thread library was already detected and the
|
||||||
target vector was already activated. */
|
target vector was already activated. */
|
||||||
goto quit;
|
return;
|
||||||
|
|
||||||
/* Initialize the structure that identifies the child process. Note
|
/* Don't attempt to use thread_db on targets which can not run
|
||||||
that at this point there is no guarantee that we actually have a
|
(executables not running yet, core files) for now. */
|
||||||
child process. */
|
if (!target_has_execution)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Initialize the structure that identifies the child process. */
|
||||||
proc_handle.pid = GET_PID (inferior_ptid);
|
proc_handle.pid = GET_PID (inferior_ptid);
|
||||||
|
|
||||||
/* Now attempt to open a connection to the thread library. */
|
/* Now attempt to open a connection to the thread library. */
|
||||||
@ -705,8 +696,14 @@ thread_db_new_objfile (struct objfile *objfile)
|
|||||||
thread_db_err_str (err));
|
thread_db_err_str (err));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
thread_db_new_objfile (struct objfile *objfile)
|
||||||
|
{
|
||||||
|
if (objfile != NULL)
|
||||||
|
check_for_thread_db ();
|
||||||
|
|
||||||
quit:
|
|
||||||
if (target_new_objfile_chain)
|
if (target_new_objfile_chain)
|
||||||
target_new_objfile_chain (objfile);
|
target_new_objfile_chain (objfile);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user