Skip to content
Snippets Groups Projects
Commit 78eeee6a authored by whh8b's avatar whh8b
Browse files

Add initial cookbook callbacks.

parent af98ec72
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ canaries/debug_canary_callbacks.c -text ...@@ -9,6 +9,8 @@ canaries/debug_canary_callbacks.c -text
/configure_for_cgc -text /configure_for_cgc -text
/configure_for_cinderella -text /configure_for_cinderella -text
/configure_for_rss -text /configure_for_rss -text
cookbook/Makefile.in -text
cookbook/instructionCountCallback.c -text
example/Makefile.in -text example/Makefile.in -text
example/callback.c -text example/callback.c -text
hookdynamic/Makefile.in -text hookdynamic/Makefile.in -text
......
CC=@CC@
CFLAGS=@CFLAGS@
LIB=@LIB@
AR=@AR@
AS=@AS@
ASFLAGS=@ASFLAGS@
OBJS=instructionCountCallback.o
.SUFFIXES: .o .s .c
.c.o:
$(CC) $(CFLAGS) $(INCLUDE) -D__$(ARCH) -c $<
.s.o:
$(AS) $(ASFLAGS) $<
all: $(OBJS)
$(AR) -r $(LIB) $(OBJS)
clean:
rm *.o
#include <stdint.h>
#ifdef DEBUG
#include "malloc.h"
#include "itox.h"
#include "strlen.h"
#include "null.h"
#endif
#define DEBUG_ADD
static unsigned long long instructioncounter= 0LL;
#ifdef DEBUG
#define print_str_debug callbacks_print_str
#define print_int_debug callbacks_print_int
#define print_unsigned_long_long_debug callbacks_print_unsigned_long_long
#else
#define print_str_debug(a)
#define print_int_debug(a)
#define assert(a)
#endif
#ifdef DEBUG
#define write_fd 2
void callbacks_print_unsigned_long_long(unsigned long long x)
{
char buf[100];
itox(x,buf);
write(write_fd,buf,strlen(buf));
}
void callbacks_print_str(char *s)
{
write(write_fd,s,strlen(s));
}
#endif
void count_instruction()
{
instructioncounter++;
print_str_debug("instructioncounter:");
print_unsigned_long_long_debug(instructioncounter);
print_str_debug("\n");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment