Browse Source

fix issues with gdb 8.0

GDB 8.0 is compiled and linked with g++, but the
linking of static targets (f.e. coldfire) fails,
without declaring the functions in thread_db.h
extern C.

The compilation of gdb errors out with:
thread-db.o: In function `thread_db_init()':
thread-db.c:(.text+0x5b6): undefined reference to `td_ta_new(ps_prochandle*, td_thragent**)'
thread-db.c:(.text+0x61e): undefined reference to `td_thr_get_info(td_thrhandle const*, td_thrinfo*)'
thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()'
..
Waldemar Brodkorb 6 years ago
parent
commit
111f01d432
2 changed files with 14 additions and 0 deletions
  1. 7 0
      libpthread/linuxthreads_db/thread_db.h
  2. 7 0
      libpthread/nptl_db/thread_db.h

+ 7 - 0
libpthread/linuxthreads_db/thread_db.h

@@ -27,6 +27,9 @@
 #include <sys/types.h>
 #include <sys/procfs.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Error codes of the library.  */
 typedef enum
@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
 /* Resume execution of thread TH.  */
 extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* thread_db.h */

+ 7 - 0
libpthread/nptl_db/thread_db.h

@@ -27,6 +27,9 @@
 #include <sys/types.h>
 #include <sys/procfs.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Error codes of the library.  */
 typedef enum
@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
 /* Resume execution of thread TH.  */
 extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* thread_db.h */