diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-03-16 17:19:23 -0700 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-03-19 18:03:58 -0700 |
commit | de8e70596896cc9f85498a9981196ebc4465172e (patch) | |
tree | 2bac4cf6bb0fd153bc943a18fc0f4deef1e921a2 /gprofng/libcollector/heaptrace.c | |
parent | 2f5dea45584c09f23702f887b1ecbe16cf16ba05 (diff) | |
download | gdb-de8e70596896cc9f85498a9981196ebc4465172e.zip gdb-de8e70596896cc9f85498a9981196ebc4465172e.tar.gz gdb-de8e70596896cc9f85498a9981196ebc4465172e.tar.bz2 |
gprofng: Use prototype to call libc functions
libcollector may not link against libC.
We use dlsym() to get a function from libc.
In some files, pointers to these functions do not have prototypes.
I also moved the shared definitions to libcollector/collect.h.
gprofng/ChangeLog
2023-03-15 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
libcollector/collector.c: Add prototypes.
libcollector/dispatcher.c: Likewise.
libcollector/heaptrace.c: Likewise.
libcollector/iotrace.c: Likewise.
libcollector/linetrace.c: Likewise.
libcollector/mmaptrace.c: Likewise.
libcollector/synctrace.c: Likewise.
libcollector/collector.h: Add CALL_REAL(), NULL_PTR(), and DBG_LT.
Diffstat (limited to 'gprofng/libcollector/heaptrace.c')
-rw-r--r-- | gprofng/libcollector/heaptrace.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/gprofng/libcollector/heaptrace.c b/gprofng/libcollector/heaptrace.c index 387d2a1..b51ab33 100644 --- a/gprofng/libcollector/heaptrace.c +++ b/gprofng/libcollector/heaptrace.c @@ -26,18 +26,11 @@ #include <dlfcn.h> #include "gp-defs.h" -#include "collector_module.h" +#include "collector.h" #include "gp-experiment.h" #include "data_pckts.h" #include "tsd.h" -/* TprintfT(<level>,...) definitions. Adjust per module as needed */ -#define DBG_LT0 0 // for high-level configuration, unexpected errors/warnings -#define DBG_LT1 1 // for configuration details, warnings -#define DBG_LT2 2 -#define DBG_LT3 3 -#define DBG_LT4 4 - /* define the packets to be written out */ typedef struct Heap_packet { /* Malloc/free tracing packet */ @@ -73,18 +66,8 @@ static unsigned heap_key = COLLECTOR_TSD_INVALID_KEY; #define CHCK_REENTRANCE(x) ( !heap_mode || ((x) = collector_interface->getKey( heap_key )) == NULL || (*(x) != 0) ) #define PUSH_REENTRANCE(x) ((*(x))++) #define POP_REENTRANCE(x) ((*(x))--) -#define CALL_REAL(x) (__real_##x) -#define NULL_PTR(x) (__real_##x == NULL) #define gethrtime collector_interface->getHiResTime -#ifdef DEBUG -#define Tprintf(...) if (collector_interface) collector_interface->writeDebugInfo( 0, __VA_ARGS__ ) -#define TprintfT(...) if (collector_interface) collector_interface->writeDebugInfo( 1, __VA_ARGS__ ) -#else -#define Tprintf(...) -#define TprintfT(...) -#endif - static void *(*__real_malloc)(size_t) = NULL; static void (*__real_free)(void *); static void *(*__real_realloc)(void *, size_t); |