Back to index

glibc  2.9
proc_service.h
Go to the documentation of this file.
00001 /* Callback interface for libthread_db, functions users must define.
00002    Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* The definitions in this file must correspond to those in the debugger.  */
00021 #include <sys/procfs.h>
00022 
00023 /* Functions in this interface return one of these status codes.  */
00024 typedef enum
00025 {
00026   PS_OK,             /* Generic "call succeeded".  */
00027   PS_ERR,            /* Generic error. */
00028   PS_BADPID,         /* Bad process handle.  */
00029   PS_BADLID,         /* Bad LWP identifier.  */
00030   PS_BADADDR,        /* Bad address.  */
00031   PS_NOSYM,          /* Could not find given symbol.  */
00032   PS_NOFREGS         /* FPU register set not available for given LWP.  */
00033 } ps_err_e;
00034 
00035 
00036 /* This type is opaque in this interface.
00037    It's defined by the user of libthread_db.  */
00038 struct ps_prochandle;
00039 
00040 
00041 /* Read or write process memory at the given address.  */
00042 extern ps_err_e ps_pdread (struct ps_prochandle *,
00043                         psaddr_t, void *, size_t);
00044 extern ps_err_e ps_pdwrite (struct ps_prochandle *,
00045                          psaddr_t, const void *, size_t);
00046 extern ps_err_e ps_ptread (struct ps_prochandle *,
00047                         psaddr_t, void *, size_t);
00048 extern ps_err_e ps_ptwrite (struct ps_prochandle *,
00049                          psaddr_t, const void *, size_t);
00050 
00051 
00052 /* Get and set the given LWP's general or FPU register set.  */
00053 extern ps_err_e ps_lgetregs (struct ps_prochandle *,
00054                           lwpid_t, prgregset_t);
00055 extern ps_err_e ps_lsetregs (struct ps_prochandle *,
00056                           lwpid_t, const prgregset_t);
00057 extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
00058                             lwpid_t, prfpregset_t *);
00059 extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
00060                             lwpid_t, const prfpregset_t *);
00061 
00062 /* Return the PID of the process.  */
00063 extern pid_t ps_getpid (struct ps_prochandle *);
00064 
00065 /* Fetch the special per-thread address associated with the given LWP.
00066    This call is only used on a few platforms (most use a normal register).
00067    The meaning of the `int' parameter is machine-dependent.  */
00068 extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
00069                                 lwpid_t, int, psaddr_t *);
00070 
00071 
00072 /* Look up the named symbol in the named DSO in the symbol tables
00073    associated with the process being debugged, filling in *SYM_ADDR
00074    with the corresponding run-time address.  */
00075 extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
00076                                const char *object_name,
00077                                const char *sym_name,
00078                                psaddr_t *sym_addr);
00079 
00080 
00081 /* Stop or continue the entire process.  */
00082 extern ps_err_e ps_pstop (const struct ps_prochandle *);
00083 extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
00084 
00085 /* Stop or continue the given LWP alone.  */
00086 extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
00087 extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);