-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scan tool doesn't crash any more (probably wrong though)
- Loading branch information
Showing
14 changed files
with
307 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <stdarg.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include "debug.h" | ||
|
||
unsigned int fsl_debug_depth = 0; | ||
|
||
static void fsl_debug_indent(void); | ||
|
||
void fsl_debug_enter(const char *func_name) | ||
{ | ||
fsl_debug_indent(); | ||
printf("%s: entering\n", func_name); | ||
fsl_debug_indent(); | ||
printf("{\n"); | ||
fsl_debug_depth++; | ||
} | ||
|
||
void fsl_debug_leave(const char *func_name) | ||
{ | ||
fsl_debug_indent(); | ||
printf("%s: leaving\n", func_name); | ||
fsl_debug_depth--; | ||
fsl_debug_indent(); | ||
printf("}\n"); | ||
} | ||
|
||
void fsl_debug_write(const char* fmt, ...) | ||
{ | ||
va_list vl; | ||
|
||
va_start(vl, fmt); | ||
fsl_debug_vwrite(fmt, vl); | ||
va_end(vl); | ||
} | ||
|
||
static void fsl_debug_indent(void) | ||
{ | ||
unsigned int i; | ||
for (i = 0; i < fsl_debug_depth; i++) | ||
printf(" "); | ||
} | ||
|
||
void fsl_debug_vwrite(const char* fmt, va_list vl) | ||
{ | ||
fsl_debug_indent(); | ||
vprintf(fmt, vl); | ||
printf("\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef FSL_RT_DEBUG_H | ||
#define FSL_RT_DEBUG_H | ||
|
||
#include <stdarg.h> | ||
|
||
extern unsigned int fsl_debug_depth; | ||
|
||
#define DEBUG_ENTER() fsl_debug_enter(__FUNCTION__) | ||
#define DEBUG_LEAVE() fsl_debug_leave(__FUNCTION__) | ||
#define DEBUG_WRITE fsl_debug_write | ||
|
||
#ifdef DEBUG_TOOL | ||
#define DEBUG_TOOL_ENTER() fsl_debug_enter(__FUNCTION__) | ||
#define DEBUG_TOOL_LEAVE() fsl_debug_leave(__FUNCTION__) | ||
#define DEBUG_TOOL_WRITE fsl_debug_write | ||
#else | ||
#define DEBUG_TOOL_ENTER() do {} while (0) | ||
#define DEBUG_TOOL_LEAVE() do {} while (0) | ||
#define DEBUG_TOOL_WRITE | ||
#endif | ||
|
||
#ifdef DEBUG_TYPEINFO | ||
#define DEBUG_TYPEINFO_ENTER() fsl_debug_enter(__FUNCTION__) | ||
#define DEBUG_TYPEINFO_LEAVE() fsl_debug_leave(__FUNCTION__) | ||
#define DEBUG_TYPEINFO_WRITE fsl_debug_write | ||
#else | ||
#define DEBUG_TYPEINFO_ENTER() do {} while (0) | ||
#define DEBUG_TYPEINFO_LEAVE() do {} while (0) | ||
#define DEBUG_TYPEINFO_WRITE | ||
#endif | ||
|
||
#ifdef DEBUG_VIRT | ||
#define DEBUG_VIRT_ENTER() fsl_debug_enter(__FUNCTION__) | ||
#define DEBUG_VIRT_LEAVE() fsl_debug_leave(__FUNCTION__) | ||
#define DEBUG_VIRT_WRITE fsl_debug_write | ||
#else | ||
#define DEBUG_VIRT_ENTER() do {} while (0) | ||
#define DEBUG_VIRT_LEAVE() do {} while (0) | ||
#define DEBUG_VIRT_WRITE | ||
#endif | ||
|
||
|
||
|
||
void fsl_debug_enter(const char *func_name); | ||
void fsl_debug_leave(const char *func_name); | ||
void fsl_debug_write(const char* fmt, ...); | ||
void fsl_debug_vwrite(const char* fmt, va_list vl); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef DYN_H | ||
#define DYN_H | ||
|
||
#define DYN_INVALID_TYPE (~((uint64_t)0)) | ||
#define env_get_dyn_clo(x) (&(fsl_env->fctx_dyn_closures[(x)])) | ||
|
||
#define FSL_DYN_SAVE(x) struct fsl_rt_closure* x; \ | ||
x = fsl_dyn_copy(fsl_env->fctx_dyn_closures) | ||
#define FSL_DYN_LOAD(x) fsl_dyn_free( \ | ||
fsl_rt_dyn_swap( \ | ||
fsl_dyn_copy(x))) | ||
|
||
#define FSL_DYN_RESTORE(x) do { \ | ||
\ | ||
fsl_dyn_free(fsl_rt_dyn_swap(x)); \ | ||
x = NULL; \ | ||
} while (0) | ||
|
||
struct fsl_rt_closure* fsl_rt_dyn_swap(struct fsl_rt_closure* dyns); | ||
void fsl_dyn_dump(void); | ||
struct fsl_rt_closure* fsl_dyn_alloc(void); | ||
void fsl_dyn_free(struct fsl_rt_closure*); | ||
struct fsl_rt_closure* fsl_dyn_copy(const struct fsl_rt_closure* src); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.