diff options
author | Pedro Alves <palves@redhat.com> | 2015-02-09 14:59:09 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-02-27 17:28:11 +0000 |
commit | 749bab0110ddc56835bfe70765675577e3dea05a (patch) | |
tree | b33ffdff1ecf9880effae6d13699de5b2243c957 /gdb | |
parent | 3c14e5a39bb4fddd911ba49483c44a12294ae6ef (diff) | |
download | gdb-749bab0110ddc56835bfe70765675577e3dea05a.zip gdb-749bab0110ddc56835bfe70765675577e3dea05a.tar.gz gdb-749bab0110ddc56835bfe70765675577e3dea05a.tar.bz2 |
proc-service, extern "C"
libthread_db.so calls symbols in the client (GDB), through the
proc-service interface. These routines must have extern "C" linkage
so their symbol names are not mangled when GDB is built as a C++
program. On the GDBserver side, we were missing fallback declarations for
all these symbols.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
[!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
[!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
(ps_lsetfpregs, ps_getpid)
(ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
(ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
(ps_lsetxregs, ps_plog): Declare.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/gdb_proc_service.h | 11 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/gdbserver/gdb_proc_service.h | 79 | ||||
-rw-r--r-- | gdb/gdbserver/proc-service.c | 4 |
5 files changed, 107 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3709441..06df138 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2015-02-27 Pedro Alves <palves@redhat.com> + * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP. + +2015-02-27 Pedro Alves <palves@redhat.com> + * common/agent.h (IPA_SYM_EXPORTED_NAME): New. (IPA_SYM): Use it. * common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros. diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h index 2c633b3..e736991 100644 --- a/gdb/gdb_proc_service.h +++ b/gdb/gdb_proc_service.h @@ -22,8 +22,15 @@ #include <sys/types.h> #ifdef HAVE_PROC_SERVICE_H + +/* glibc's proc_service.h doesn't wrap itself with extern "C". Need + to do it ourselves. */ +EXTERN_C_PUSH + #include <proc_service.h> +EXTERN_C_POP + #else /* HAVE_PROC_SERVICE_H */ /* The following fallback definitions have been imported and adjusted @@ -55,6 +62,8 @@ #include "gregset.h" +EXTERN_C_PUSH + /* Functions in this interface return one of these status codes. */ typedef enum { @@ -150,6 +159,8 @@ extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, /* Log a message (sends to gdb_stderr). */ extern void ps_plog (const char *fmt, ...); +EXTERN_C_POP + #endif /* HAVE_PROC_SERVICE_H */ /* Fix-up some broken systems. */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 384314a..7ba137b 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,16 @@ 2015-02-27 Pedro Alves <palves@redhat.com> + * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP. + [!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare. + [!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread) + ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs) + (ps_lsetfpregs, ps_getpid) + (ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue) + (ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs) + (ps_lsetxregs, ps_plog): Declare. + +2015-02-27 Pedro Alves <palves@redhat.com> + * linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use IP_AGENT_EXPORT_FUNC. * linux-i386-ipa.c (gdb_agent_get_raw_reg): Use diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h index 1f3e277..2dcfa5b 100644 --- a/gdb/gdbserver/gdb_proc_service.h +++ b/gdb/gdbserver/gdb_proc_service.h @@ -22,7 +22,15 @@ #include <sys/types.h> #ifdef HAVE_PROC_SERVICE_H + +/* glibc's proc_service.h doesn't wrap itself with extern "C". Need + to do it ourselves. */ +EXTERN_C_PUSH + #include <proc_service.h> + +EXTERN_C_POP + #else #ifdef HAVE_SYS_PROCFS_H @@ -38,6 +46,8 @@ # endif #endif +EXTERN_C_PUSH + typedef enum { PS_OK, /* Success. */ @@ -61,6 +71,75 @@ typedef void *psaddr_t; typedef elf_gregset_t prgregset_t; #endif +/* This type is opaque in this interface. It's defined by the user of + libthread_db. GDB's version is defined below. */ +struct ps_prochandle; + + +/* Read or write process memory at the given address. */ +extern ps_err_e ps_pdread (struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_pdwrite (struct ps_prochandle *, + psaddr_t, const void *, size_t); +extern ps_err_e ps_ptread (struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_ptwrite (struct ps_prochandle *, + psaddr_t, const void *, size_t); + + +/* Get and set the given LWP's general or FPU register set. */ +extern ps_err_e ps_lgetregs (struct ps_prochandle *, + lwpid_t, prgregset_t); +extern ps_err_e ps_lsetregs (struct ps_prochandle *, + lwpid_t, const prgregset_t); +extern ps_err_e ps_lgetfpregs (struct ps_prochandle *, + lwpid_t, prfpregset_t *); +extern ps_err_e ps_lsetfpregs (struct ps_prochandle *, + lwpid_t, const prfpregset_t *); + +/* Return the PID of the process. */ +extern pid_t ps_getpid (struct ps_prochandle *); + +/* Fetch the special per-thread address associated with the given LWP. + This call is only used on a few platforms (most use a normal register). + The meaning of the `int' parameter is machine-dependent. */ +extern ps_err_e ps_get_thread_area (const struct ps_prochandle *, + lwpid_t, int, psaddr_t *); + + +/* Look up the named symbol in the named DSO in the symbol tables + associated with the process being debugged, filling in *SYM_ADDR + with the corresponding run-time address. */ +extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *, + const char *object_name, + const char *sym_name, + psaddr_t *sym_addr); + + +/* Stop or continue the entire process. */ +extern ps_err_e ps_pstop (struct ps_prochandle *); +extern ps_err_e ps_pcontinue (struct ps_prochandle *); + +/* Stop or continue the given LWP alone. */ +extern ps_err_e ps_lstop (struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t); + +/* The following are only defined in/called by Solaris. */ + +/* Get size of extra register set. */ +extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph, + lwpid_t lwpid, int *xregsize); +/* Get extra register set. */ +extern ps_err_e ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid, + caddr_t xregset); +extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, + caddr_t xregset); + +/* Log a message (sends to gdb_stderr). */ +extern void ps_plog (const char *fmt, ...); + +EXTERN_C_POP + #endif /* HAVE_PROC_SERVICE_H */ /* Structure that identifies the target process. */ diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c index b181ae5..f36e3fb 100644 --- a/gdb/gdbserver/proc-service.c +++ b/gdb/gdbserver/proc-service.c @@ -135,7 +135,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset) process PH and store them in FPREGSET. */ ps_err_e -ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset) +ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prfpregset_t *fpregset) { /* Unneeded. */ return PS_ERR; @@ -145,7 +145,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset) process PH from FPREGSET. */ ps_err_e -ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset) +ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prfpregset_t *fpregset) { /* Unneeded. */ return PS_ERR; |