td_ta_event_addr.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Get event address.
  2. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #include "thread_dbP.h"
  18. td_err_e
  19. td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
  20. {
  21. td_err_e res = TD_NOEVENT;
  22. int idx = -1;
  23. LOG ("td_ta_event_addr");
  24. /* Test whether the TA parameter is ok. */
  25. if (! ta_ok (ta))
  26. return TD_BADTA;
  27. switch (event)
  28. {
  29. case TD_CREATE:
  30. idx = LINUXTHREADS_CREATE_EVENT;
  31. break;
  32. case TD_DEATH:
  33. idx = LINUXTHREADS_DEATH_EVENT;
  34. break;
  35. case TD_REAP:
  36. idx = LINUXTHREADS_REAP_EVENT;
  37. break;
  38. default:
  39. /* Event cannot be handled. */
  40. break;
  41. }
  42. /* Now get the address. */
  43. if (idx != -1)
  44. {
  45. psaddr_t taddr;
  46. if (td_lookup (ta->ph, idx, &taddr) == PS_OK)
  47. {
  48. /* Success, we got the address. */
  49. addr->type = NOTIFY_BPT;
  50. addr->u.bptaddr = taddr;
  51. res = TD_OK;
  52. }
  53. else
  54. res = TD_ERR;
  55. }
  56. return res;
  57. }