Browse Source

moved syscall debugging function to a new file

master
root 5 years ago
parent
commit
2907716321
2 changed files with 1 additions and 25 deletions
  1. 1
    6
      inc/lc6_helpers.h
  2. 0
    19
      src/lc6_helpers.c

+ 1
- 6
inc/lc6_helpers.h View File

#ifndef LC6_HELPERS_H #ifndef LC6_HELPERS_H
#define LC6_HELPERS_H #define LC6_HELPERS_H


// DO NOT include the common.h here.
// because we're overriding functions
// #include "../inc/lc6_common.h"
#include "../inc/lc6_common.h"


void lc6helpers_printhex(unsigned char*, int); void lc6helpers_printhex(unsigned char*, int);
void lc6helpers_banner(unsigned char*); void lc6helpers_banner(unsigned char*);
void* lc6helpers_malloc(size_t, char *, const char*, int);
void* lc6helpers_realloc(void *ptr, size_t, char *, const char*, int);
void lc6helpers_free(void *ptr, char *, const char*, int);


#endif #endif

+ 0
- 19
src/lc6_helpers.c View File

printf("################################################\n"); printf("################################################\n");
printf("\n"); printf("\n");
} }

#ifdef LC6_DEBUG

void* lc6helpers_malloc(size_t size, char *file, const char *func, int line) {
printf("[%s:%d] %s called malloc(%lu)\n", file, line, func, size);
return malloc(size);
}

void* lc6helpers_realloc(void *ptr, size_t size, char *file, const char *func, int line) {
printf("[%s:%d] %s called realloc(%p, %lu)\n", file, line, func, ptr, size);
return realloc(ptr, size);
}

void lc6helpers_free(void *ptr, char *file, const char *func, int line) {
printf("[%s:%d] %s called free(%p)\n", file, line, func, ptr);
free(ptr);
}

#endif

Loading…
Cancel
Save