瀏覽代碼

moved syscall debugging function to a new file

master
root 5 年之前
父節點
當前提交
2907716321
共有 2 個檔案被更改,包括 1 行新增25 行删除
  1. 1
    6
      inc/lc6_helpers.h
  2. 0
    19
      src/lc6_helpers.c

+ 1
- 6
inc/lc6_helpers.h 查看文件

@@ -1,14 +1,9 @@
#ifndef 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_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

+ 0
- 19
src/lc6_helpers.c 查看文件

@@ -20,22 +20,3 @@ void lc6helpers_banner(unsigned char *str) {
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…
取消
儲存