Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
1999-11-03  Ulrich Drepper  <drepper@cygnus.com>

	* Versions.def: Add version for libthread_db.
  • Loading branch information
Ulrich Drepper committed Nov 5, 1999
1 parent ab86fbb commit 9532eb6
Show file tree
Hide file tree
Showing 22 changed files with 263 additions and 48 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1999-11-03 Ulrich Drepper <drepper@cygnus.com>

* Versions.def: Add version for libthread_db.

1999-11-02 Andreas Jaeger <aj@suse.de>

* manual/header.texi (Library Summary): The command @indexfonts
Expand Down
3 changes: 3 additions & 0 deletions Versions.def
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ ld.so {
GLIBC_2.1 GLIBC_2.0
GLIBC_2.1.1 GLIBC_2.1
}
libthread_db {
GLIBC_2.1.3
}
25 changes: 25 additions & 0 deletions linuxthreads_db/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
1999-11-03 Ulrich Drepper <drepper@cygnus.com>

* thread_dbP.h (ta_ok): New function.
* td_ta_new.c: Add new handle to list.
* td_ta_delete.c: Remove handle from list.
* td_ta_clear_event.c: Use ta_ok to check for correct ta parameter.
* td_ta_enable_stats.c: Likewise.
* td_ta_event_addr.c: Likewise.
* td_ta_event_getmsg.c: Likewise.
* td_ta_get_nthreads.c: Likewise.
* td_ta_get_ph.c: Likewise.
* td_ta_get_stats.c: Likewise.
* td_ta_map_id2thr.c: Likewise.
* td_ta_map_lwp2thr.c: Likewise.
* td_ta_reset_stats.c: Likewise.
* td_ta_set_event.c: Likewise.
* td_ta_setconcurrency.c: Likewise.
* td_ta_thr_iter.c: Likewise.

* td_ta_tsd_iter.c: Optimize memory retrieving.

* Versions: New file.

* td_thr_get_info.c (td_thr_get_info): Initialize ti_traceme.

1999-11-02 Ulrich Drepper <drepper@cygnus.com>

* td_ta_thr_iter.c (td_ta_thr_iter): Optimize a bit. Read all
Expand Down
15 changes: 15 additions & 0 deletions linuxthreads_db/Versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
libthread_db {
GLIBC_2.1.3 {
# t*
td_init; td_log; td_ta_clear_event; td_ta_delete; td_ta_enable_stats;
td_ta_event_addr; td_ta_event_getmsg; td_ta_get_nthreads; td_ta_get_ph;
td_ta_get_stats; td_ta_map_id2thr; td_ta_map_lwp2thr; td_ta_new;
td_ta_reset_stats; td_ta_set_event; td_ta_setconcurrency;
td_ta_thr_iter; td_ta_tsd_iter; td_thr_clear_event; td_thr_dbresume;
td_thr_dbsuspend; td_thr_event_enable; td_thr_event_getmsg;
td_thr_get_info; td_thr_getfpregs; td_thr_getgregs; td_thr_getxregs;
td_thr_getxregsize; td_thr_set_event; td_thr_setfpregs; td_thr_setgregs;
td_thr_setprio; td_thr_setsigpending; td_thr_setxregs; td_thr_sigsetmask;
td_thr_tsd; td_thr_validate;
}
}
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_clear_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ td_ta_clear_event (ta, event)

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Write the new value into the thread data structure. */
if (ps_pdread (ta->ph, ta->pthread_threads_eventsp,
&old_event, sizeof (td_thrhandle_t)) != PS_OK)
Expand Down
23 changes: 23 additions & 0 deletions linuxthreads_db/td_ta_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ td_ta_delete (td_thragent_t *ta)
{
LOG (__FUNCTION__);

/* Safety check. */
if (ta == NULL || __td_agent_list == NULL)
return TD_BADTA;

/* Remove the handle from the list. */
if (ta == __td_agent_list->ta)
/* It's the first element of the list. */
__td_agent_list = __td_agent_list->next;
else
{
/* We have to search for it. */
struct agent_list *runp = __td_agent_list;

while (runp->next != NULL && runp->next->ta != ta)
runp = runp->next;

if (runp->next == NULL)
/* It's not a valid decriptor since it is not in the list. */
return TD_BADTA;

runp->next = runp->next->next;
}

/* The handle was allocated in `td_ta_new'. */
free (ta);

Expand Down
5 changes: 5 additions & 0 deletions linuxthreads_db/td_ta_enable_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ td_ta_enable_stats (const td_thragent_t *ta, int enable)
{
/* XXX We have to figure out what has to be done. */
LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

return TD_OK;
}
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_event_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

switch (event)
{
case TD_CREATE:
Expand Down
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_event_getmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ td_ta_event_getmsg (const td_thragent_t *ta, td_event_msg_t *msg)

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Get the pointer to the thread descriptor with the last event. */
if (ps_pdread (ta->ph, ta->pthread_last_event,
&addr, sizeof (void *)) != PS_OK)
Expand Down
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_get_nthreads.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ td_ta_get_nthreads (const td_thragent_t *ta, int *np)

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Access the variable `__pthread_handles_num'. */
if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, "__pthread_handles_num",
&addr) != PS_OK)
Expand Down
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_get_ph.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ td_ta_get_ph (const td_thragent_t *ta, struct ps_prochandle **ph)
{
LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

*ph = ta->ph;

return TD_OK;
Expand Down
5 changes: 5 additions & 0 deletions linuxthreads_db/td_ta_get_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ td_ta_get_stats (const td_thragent_t *ta, td_ta_stats_t *statsp)
{
/* XXX We have to figure out what has to be done. */
LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

return TD_OK;
}
22 changes: 19 additions & 3 deletions linuxthreads_db/td_ta_map_id2thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,37 @@
td_err_e
td_ta_map_id2thr (const td_thragent_t *ta, pthread_t pt, td_thrhandle_t *th)
{
struct pthread_handle_struct *handles = ta->handles;
struct pthread_handle_struct phc;
int pthread_threads_max = ta->pthread_threads_max;
struct _pthread_descr_struct pds;
int pthread_threads_max;

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Make the following expression a bit smaller. */
pthread_threads_max = ta->pthread_threads_max;

/* We can compute the entry in the handle array we want. */
if (ps_pdread (ta->ph, handles + pt % pthread_threads_max, &phc,
if (ps_pdread (ta->ph, ta->handles + pt % pthread_threads_max, &phc,
sizeof (struct pthread_handle_struct)) != PS_OK)
return TD_ERR; /* XXX Other error value? */

/* Test whether this entry is in use. */
if (phc.h_descr == NULL)
return TD_BADTH;

/* Next test: get the descriptor to see whether this is not an old
thread handle. */
if (ps_pdread (ta->ph, phc.h_descr, &pds,
sizeof (struct _pthread_descr_struct)) != PS_OK)
return TD_ERR; /* XXX Other error value? */

if (pds.p_tid != pt)
return TD_BADTH;

/* Create the `td_thrhandle_t' object. */
th->th_ta_p = (td_thragent_t *) ta;
th->th_unique = phc.h_descr;
Expand Down
69 changes: 44 additions & 25 deletions linuxthreads_db/td_ta_map_lwp2thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,57 @@
td_err_e
td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
{
struct pthread_handle_struct *handles = ta->handles;
int pthread_threads_max = ta->pthread_threads_max;
size_t sizeof_descr = ta->sizeof_descr;
struct pthread_handle_struct phc[pthread_threads_max];
size_t cnt;
#ifdef ALL_THREADS_STOPPED
int num;
#else
# define num 1
#endif

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Read all the descriptors. */
if (ps_pdread (ta->ph, ta->handles, phc,
sizeof (struct pthread_handle_struct) * pthread_threads_max)
!= PS_OK)
return TD_ERR; /* XXX Other error value? */

#ifdef ALL_THREADS_STOPPED
/* Read the number of currently active threads. */
if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) != PS_OK)
return TD_ERR; /* XXX Other error value? */
#endif

/* Get the entries one after the other and find out whether the ID
matches. */
for (cnt = 0; cnt < pthread_threads_max; ++cnt, ++handles)
{
struct pthread_handle_struct phc;
struct _pthread_descr_struct pds;

if (ps_pdread (ta->ph, handles, &phc,
sizeof (struct pthread_handle_struct)) != PS_OK)
return TD_ERR; /* XXX Other error value? */

if (phc.h_descr != NULL)
{
if (ps_pdread (ta->ph, phc.h_descr, &pds,
sizeof (struct _pthread_descr_struct)) != PS_OK)
return TD_ERR; /* XXX Other error value? */

if (pds.p_pid == lwpid)
{
/* Found it. Now fill in the `td_thrhandle_t' object. */
th->th_ta_p = (td_thragent_t *) ta;
th->th_unique = phc.h_descr;

return TD_OK;
}
}
for (cnt = 0; cnt < pthread_threads_max && num > 0; ++cnt)
if (phc[cnt].h_descr != NULL)
{
struct _pthread_descr_struct pds;

#ifdef ALL_THREADS_STOPPED
/* First count this active thread. */
--num;
#endif

if (ps_pdread (ta->ph, phc[cnt].h_descr, &pds, sizeof_descr) != PS_OK)
return TD_ERR; /* XXX Other error value? */

if (pds.p_pid == lwpid)
{
/* Found it. Now fill in the `td_thrhandle_t' object. */
th->th_ta_p = (td_thragent_t *) ta;
th->th_unique = phc[cnt].h_descr;

return TD_OK;
}
}

return TD_NOLWP;
Expand Down
20 changes: 20 additions & 0 deletions linuxthreads_db/td_ta_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@
#include "thread_dbP.h"


/* Datatype for the list of known thread agents. Normally there will
be exactly one so we don't spend much though on making it fast. */
struct agent_list *__td_agent_list;


td_err_e
td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
{
psaddr_t addr;
struct agent_list *elemp;

LOG (__FUNCTION__);

Expand Down Expand Up @@ -130,5 +136,19 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
goto free_return;
}

/* Now add the new agent descriptor to the list. */
elemp = (struct agent_list *) malloc (sizeof (struct agent_list));
if (elemp == NULL)
{
/* Argh, now that everything else worked... */
free (*ta);
return TD_MALLOC;
}

/* We don't care for thread-safety here. */
elemp->ta = *ta;
elemp->next = __td_agent_list;
__td_agent_list = elemp;

return TD_OK;
}
5 changes: 5 additions & 0 deletions linuxthreads_db/td_ta_reset_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ td_ta_reset_stats (const td_thragent_t *ta)
{
/* XXX We have to figure out what has to be done. */
LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

return TD_OK;
}
4 changes: 4 additions & 0 deletions linuxthreads_db/td_ta_set_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ td_ta_set_event (ta, event)

LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

/* Write the new value into the thread data structure. */
if (ps_pdread (ta->ph, ta->pthread_threads_eventsp,
&old_event, sizeof (td_thrhandle_t)) != PS_OK)
Expand Down
5 changes: 5 additions & 0 deletions linuxthreads_db/td_ta_setconcurrency.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ td_ta_setconcurrency (const td_thragent_t *ta, int level)
{
/* This is something LinuxThreads does not support. */
LOG (__FUNCTION__);

/* Test whether the TA parameter is ok. */
if (! ta_ok (ta))
return TD_BADTA;

return TD_NOCAPAB;
}
Loading

0 comments on commit 9532eb6

Please sign in to comment.