diff options
author | Stefan Siegl <stesie@brokenpipe.de> | 2005-04-02 15:13:34 +0000 |
---|---|---|
committer | Stefan Siegl <stesie@brokenpipe.de> | 2005-04-02 15:13:34 +0000 |
commit | 5a42abf08ee64d05e4888bae1e20d06a65cfdb2d (patch) | |
tree | a09f57a64ec75c1f7da7f13c3445401ecae19a75 | |
parent | 83b803bf1cf04eb0c82ae6645b33799634ef14bb (diff) |
trace malloc/free/strdup calls
-rw-r--r-- | fuse_i.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -164,4 +164,30 @@ extern FILE *debug_port; #define FUNC_EPILOGUE(ret) \ FUNC_EPILOGUE_(ret, (void)0) + + +/* malloc debugging */ +#if 1 +static char *_strdup(const char *s, const char *f, int l) { +void *ptr = strdup(s); +DEBUG("strdup", "ptr=%8p [%s:%d]\n", ptr, f, l); +return ptr; +} +#undef strdup +#define strdup(s) _strdup(s, __FILE__, __LINE__) + +static void *_malloc(size_t sz, const char *f, int l) { +void *ptr = malloc(sz); +DEBUG("malloc", "ptr=%8p [%s:%d]\n", ptr, f, l); +return ptr; +} +#define malloc(s) _malloc(s, __FILE__, __LINE__) + +static void _free(void *ptr, const char *f, int l) { +DEBUG(" free", "ptr=%8p [%s:%d]\n", ptr, f, l); +free(ptr); +} +#define free(s) _free(s, __FILE__, __LINE__) +#endif + #endif /* FUSE_INTERNAL_H */ |