yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 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 | |
| 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 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, write to the Free |
| 17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 18 | 02111-1307 USA. */ |
| 19 | |
| 20 | /* The definitions in this file must correspond to those in the debugger. */ |
| 21 | #include <sys/procfs.h> |
| 22 | |
| 23 | /* Functions in this interface return one of these status codes. */ |
| 24 | typedef enum |
| 25 | { |
| 26 | PS_OK, /* Generic "call succeeded". */ |
| 27 | PS_ERR, /* Generic error. */ |
| 28 | PS_BADPID, /* Bad process handle. */ |
| 29 | PS_BADLID, /* Bad LWP identifier. */ |
| 30 | PS_BADADDR, /* Bad address. */ |
| 31 | PS_NOSYM, /* Could not find given symbol. */ |
| 32 | PS_NOFREGS /* FPU register set not available for given LWP. */ |
| 33 | } ps_err_e; |
| 34 | |
| 35 | |
| 36 | /* This type is opaque in this interface. |
| 37 | It's defined by the user of libthread_db. */ |
| 38 | struct ps_prochandle; |
| 39 | |
| 40 | |
| 41 | /* Read or write process memory at the given address. */ |
| 42 | extern ps_err_e ps_pdread (struct ps_prochandle *, |
| 43 | psaddr_t, void *, size_t); |
| 44 | extern ps_err_e ps_pdwrite (struct ps_prochandle *, |
| 45 | psaddr_t, const void *, size_t); |
| 46 | extern ps_err_e ps_ptread (struct ps_prochandle *, |
| 47 | psaddr_t, void *, size_t); |
| 48 | extern ps_err_e ps_ptwrite (struct ps_prochandle *, |
| 49 | psaddr_t, const void *, size_t); |
| 50 | |
| 51 | |
| 52 | /* Get and set the given LWP's general or FPU register set. */ |
| 53 | extern ps_err_e ps_lgetregs (struct ps_prochandle *, |
| 54 | lwpid_t, prgregset_t); |
| 55 | extern ps_err_e ps_lsetregs (struct ps_prochandle *, |
| 56 | lwpid_t, const prgregset_t); |
| 57 | extern ps_err_e ps_lgetfpregs (struct ps_prochandle *, |
| 58 | lwpid_t, prfpregset_t *); |
| 59 | extern ps_err_e ps_lsetfpregs (struct ps_prochandle *, |
| 60 | lwpid_t, const prfpregset_t *); |
| 61 | |
| 62 | /* Return the PID of the process. */ |
| 63 | extern pid_t ps_getpid (struct ps_prochandle *); |
| 64 | |
| 65 | /* Fetch the special per-thread address associated with the given LWP. |
| 66 | This call is only used on a few platforms (most use a normal register). |
| 67 | The meaning of the `int' parameter is machine-dependent. */ |
| 68 | extern ps_err_e ps_get_thread_area (const struct ps_prochandle *, |
| 69 | lwpid_t, int, psaddr_t *); |
| 70 | |
| 71 | |
| 72 | /* Look up the named symbol in the named DSO in the symbol tables |
| 73 | associated with the process being debugged, filling in *SYM_ADDR |
| 74 | with the corresponding run-time address. */ |
| 75 | extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *, |
| 76 | const char *object_name, |
| 77 | const char *sym_name, |
| 78 | psaddr_t *sym_addr); |
| 79 | |
| 80 | |
| 81 | /* Stop or continue the entire process. */ |
| 82 | extern ps_err_e ps_pstop (const struct ps_prochandle *); |
| 83 | extern ps_err_e ps_pcontinue (const struct ps_prochandle *); |
| 84 | |
| 85 | /* Stop or continue the given LWP alone. */ |
| 86 | extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t); |
| 87 | extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t); |