Back to index

glibc  2.9
td_ta_new.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <version.h>
#include "thread_dbP.h"

Go to the source code of this file.


 LIST_HEAD (__td_agent_list)
td_err_e td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)

Function Documentation

td_err_e td_ta_new ( struct ps_prochandle *  ps,
td_thragent_t **  ta 

Definition at line 35 of file td_ta_new.c.

  psaddr_t versaddr;
  char versbuf[sizeof (VERSION)];

  LOG ("td_ta_new");

  /* Check whether the versions match.  */
  if (td_lookup (ps, SYM_nptl_version, &versaddr) != PS_OK)
    return TD_NOLIBTHREAD;
  if (ps_pdread (ps, versaddr, versbuf, sizeof (versbuf)) != PS_OK)
    return TD_ERR;

  if (memcmp (versbuf, VERSION, sizeof VERSION) != 0)
    /* Not the right version.  */
    return TD_VERSION;

  /* Fill in the appropriate information.  */
  *ta = (td_thragent_t *) calloc (1, sizeof (td_thragent_t));
  if (*ta == NULL)
    return TD_MALLOC;

  /* Store the proc handle which we will pass to the callback functions
     back into the debugger.  */
  (*ta)->ph = ps;

  /* Now add the new agent descriptor to the list.  */
  list_add (&(*ta)->list, &__td_agent_list);

  return TD_OK;

Here is the call graph for this function: