proc_service.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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, see
  14. <http://www.gnu.org/licenses/>. */
  15. /* The definitions in this file must correspond to those in the debugger. */
  16. #include <sys/procfs.h>
  17. /* Functions in this interface return one of these status codes. */
  18. typedef enum
  19. {
  20. PS_OK, /* Generic "call succeeded". */
  21. PS_ERR, /* Generic error. */
  22. PS_BADPID, /* Bad process handle. */
  23. PS_BADLID, /* Bad LWP identifier. */
  24. PS_BADADDR, /* Bad address. */
  25. PS_NOSYM, /* Could not find given symbol. */
  26. PS_NOFREGS /* FPU register set not available for given LWP. */
  27. } ps_err_e;
  28. /* This type is opaque in this interface.
  29. It's defined by the user of libthread_db. */
  30. struct ps_prochandle;
  31. /* Read or write process memory at the given address. */
  32. extern ps_err_e ps_pdread (struct ps_prochandle *,
  33. psaddr_t, void *, size_t);
  34. extern ps_err_e ps_pdwrite (struct ps_prochandle *,
  35. psaddr_t, const void *, size_t);
  36. extern ps_err_e ps_ptread (struct ps_prochandle *,
  37. psaddr_t, void *, size_t);
  38. extern ps_err_e ps_ptwrite (struct ps_prochandle *,
  39. psaddr_t, const void *, size_t);
  40. /* Get and set the given LWP's general or FPU register set. */
  41. extern ps_err_e ps_lgetregs (struct ps_prochandle *,
  42. lwpid_t, prgregset_t);
  43. extern ps_err_e ps_lsetregs (struct ps_prochandle *,
  44. lwpid_t, const prgregset_t);
  45. extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
  46. lwpid_t, prfpregset_t *);
  47. extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
  48. lwpid_t, const prfpregset_t *);
  49. /* Return the PID of the process. */
  50. extern pid_t ps_getpid (struct ps_prochandle *);
  51. /* Fetch the special per-thread address associated with the given LWP.
  52. This call is only used on a few platforms (most use a normal register).
  53. The meaning of the `int' parameter is machine-dependent. */
  54. extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
  55. lwpid_t, int, psaddr_t *);
  56. /* Look up the named symbol in the named DSO in the symbol tables
  57. associated with the process being debugged, filling in *SYM_ADDR
  58. with the corresponding run-time address. */
  59. extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
  60. const char *object_name,
  61. const char *sym_name,
  62. psaddr_t *sym_addr);
  63. /* Stop or continue the entire process. */
  64. extern ps_err_e ps_pstop (const struct ps_prochandle *);
  65. extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
  66. /* Stop or continue the given LWP alone. */
  67. extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
  68. extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);