From 74a24d77fd9c08ad9a6b3b6c0f434c7314dae639 Mon Sep 17 00:00:00 2001 From: grischka Date: Thu, 11 Aug 2011 16:55:30 +0200 Subject: libtcc: minor adjustments - use {B} to substitute tcc_lih_path (instead of \b) - expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS which fixes duplicate CONFIG_SYSROOT. - put default CONFIG_SYSROOT ("") into tcc.h - remove hack from commit db6fcce78f4d8ea25036dd6643e9fa83d8e52e5a because $(tccdir)/include is already in sysincludes - configure: error out for unrecognized options. - win32/build-tcc.bat: put libtcc into base dir where it will find lib/include automatically, and build libtcc_test example. --- tccrun.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'tccrun.c') diff --git a/tccrun.c b/tccrun.c index 9cb7588..80d1834 100644 --- a/tccrun.c +++ b/tccrun.c @@ -20,6 +20,12 @@ #include "tcc.h" +#ifdef CONFIG_TCC_BACKTRACE +ST_DATA int rt_num_callers = 6; +ST_DATA const char **rt_bound_error_msg; +ST_DATA void *rt_prog_main; +#endif + #ifdef _WIN32 #define ucontext_t CONTEXT #endif @@ -38,7 +44,7 @@ static void win64_add_function_table(TCCState *s1); /* Do all relocations (needed before using tcc_get_symbol()) Returns -1 on error. */ -int tcc_relocate(TCCState *s1) +LIBTCCAPI int tcc_relocate(TCCState *s1) { int ret; #ifdef HAVE_SELINUX @@ -73,7 +79,7 @@ int tcc_relocate(TCCState *s1) } /* launch the compiled program with the given arguments */ -int tcc_run(TCCState *s1, int argc, char **argv) +LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) { int (*prog_main)(int, char **); int ret; @@ -213,6 +219,11 @@ static void set_pages_executable(void *ptr, unsigned long length) /* ------------------------------------------------------------- */ #ifdef CONFIG_TCC_BACKTRACE +PUB_FUNC void tcc_set_num_callers(int n) +{ + rt_num_callers = n; +} + /* print the position in the source file of PC value 'pc' by reading the stabs debug information */ static uplong rt_printline(uplong wanted_pc, const char *msg) @@ -369,7 +380,7 @@ static void rt_error(ucontext_t *uc, const char *fmt, ...) va_end(ap); fprintf(stderr, "\n"); - for(i=0;i