proc_service.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Callback interface for libthread_db, functions users must define.
  2. Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* The definitions in this file must correspond to those in the debugger. */
  17. #include <sys/procfs.h>
  18. /* Functions in this interface return one of these status codes. */
  19. typedef enum
  20. {
  21. PS_OK, /* Generic "call succeeded". */
  22. PS_ERR, /* Generic error. */
  23. PS_BADPID, /* Bad process handle. */
  24. PS_BADLID, /* Bad LWP identifier. */
  25. PS_BADADDR, /* Bad address. */
  26. PS_NOSYM, /* Could not find given symbol. */
  27. PS_NOFREGS /* FPU register set not available for given LWP. */
  28. } ps_err_e;
  29. /* This type is opaque in this interface.
  30. It's defined by the user of libthread_db. */
  31. struct ps_prochandle;
  32. /* Read or write process memory at the given address. */
  33. extern ps_err_e ps_pdread (struct ps_prochandle *,
  34. psaddr_t, void *, size_t);
  35. extern ps_err_e ps_pdwrite (struct ps_prochandle *,
  36. psaddr_t, const void *, size_t);
  37. extern ps_err_e ps_ptread (struct ps_prochandle *,
  38. psaddr_t, void *, size_t);
  39. extern ps_err_e ps_ptwrite (struct ps_prochandle *,
  40. psaddr_t, const void *, size_t);
  41. /* Get and set the given LWP's general or FPU register set. */
  42. extern ps_err_e ps_lgetregs (struct ps_prochandle *,
  43. lwpid_t, prgregset_t);
  44. extern ps_err_e ps_lsetregs (struct ps_prochandle *,
  45. lwpid_t, const prgregset_t);
  46. extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
  47. lwpid_t, prfpregset_t *);
  48. extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
  49. lwpid_t, const prfpregset_t *);
  50. /* Return the PID of the process. */
  51. extern pid_t ps_getpid (struct ps_prochandle *);
  52. /* Fetch the special per-thread address associated with the given LWP.
  53. This call is only used on a few platforms (most use a normal register).
  54. The meaning of the `int' parameter is machine-dependent. */
  55. extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
  56. lwpid_t, int, psaddr_t *);
  57. /* Look up the named symbol in the named DSO in the symbol tables
  58. associated with the process being debugged, filling in *SYM_ADDR
  59. with the corresponding run-time address. */
  60. extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
  61. const char *object_name,
  62. const char *sym_name,
  63. psaddr_t *sym_addr);
  64. /* Stop or continue the entire process. */
  65. extern ps_err_e ps_pstop (const struct ps_prochandle *);
  66. extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
  67. /* Stop or continue the given LWP alone. */
  68. extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
  69. extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);