Changeset 089a0d7 for libcfa/src/interpose_thread.cfa
- Timestamp:
- Mar 14, 2023, 11:12:35 AM (9 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 15596d7
- Parents:
- a0a949c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/interpose_thread.cfa
ra0a949c r089a0d7 14 14 // 15 15 16 #include <stdarg.h> // va_start, va_end 17 #include <stdio.h> 18 #include <string.h> // strlen 16 #ifdef __i386__ // 32-bit architecture 17 #undef _GNU_SOURCE 18 #endif // __i386__ 19 19 20 #include <signal.h> 20 21 #include <pthread.h> 22 #include <signal.h> 21 23 extern "C" { 22 24 #include <dlfcn.h> // dlopen, dlsym 23 #include <execinfo.h> // backtrace, messages24 25 } 25 26 26 #include "bits/debug.hfa"27 27 #include "bits/defs.hfa" 28 #include <assert.h>29 28 30 29 //============================================================================================= … … 40 39 ) libcfa_public { 41 40 void * library; 41 42 42 #if defined( RTLD_NEXT ) 43 43 library = RTLD_NEXT; 44 44 #else 45 45 // missing RTLD_NEXT => must hard-code library name, assuming libstdc++ 46 library = dlopen( "libthread_db.so", RTLD_LAZY ); 47 if ( ! library ) { 48 const char * error = dlerror(); 49 if ( error ) { 50 abort( "interpose_symbol : failed to open libpthread, %s\n", error ); 51 } 46 library = dlopen( "libpthread.so", RTLD_LAZY ); 47 if ( ! library ) { // == nullptr 48 abort( "interpose_symbol : failed to open libpthread, %s\n", dlerror() ); 52 49 } // if 53 50 #endif // RTLD_NEXT 54 51 55 return do_interpose_symbol( library, symbol, version);52 return do_interpose_symbol( library, symbol, version ); 56 53 } 57 54 … … 81 78 #pragma GCC diagnostic push 82 79 #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" 83 INTERPOSE( pthread_create 84 INTERPOSE( pthread_join 85 INTERPOSE( pthread_self 86 INTERPOSE( pthread_attr_init 87 INTERPOSE( pthread_attr_destroy 88 INTERPOSE( pthread_attr_setstack 89 INTERPOSE( pthread_attr_getstacksize 90 INTERPOSE( pthread_sigmask 91 INTERPOSE( pthread_sigqueue 92 INTERPOSE( pthread_once 80 INTERPOSE( pthread_create, version ); 81 INTERPOSE( pthread_join, version ); 82 INTERPOSE( pthread_self, version ); 83 INTERPOSE( pthread_attr_init, version ); 84 INTERPOSE( pthread_attr_destroy, version ); 85 INTERPOSE( pthread_attr_setstack, version ); 86 INTERPOSE( pthread_attr_getstacksize, version ); 87 INTERPOSE( pthread_sigmask, version ); 88 INTERPOSE( pthread_sigqueue, version ); 89 INTERPOSE( pthread_once, version ); 93 90 #pragma GCC diagnostic pop 94 91 }
Note: See TracChangeset
for help on using the changeset viewer.