From: mquinson Date: Wed, 23 Jan 2008 14:26:13 +0000 (+0000) Subject: give up on cross-compiling backtrace code from gcc: inline assembly code cannot be... X-Git-Tag: v3.3~644 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/08aaedd334e95fc144248a31cf6411ecf1b08052?hp=af4b3676dc5b56c898a4e7c477666864019b5b69;ds=sidebyside give up on cross-compiling backtrace code from gcc: inline assembly code cannot be written in a way that both compilers like (so stick to MSVC syntax, and disable the feature when using gcc either in cross or natively with mingw32) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5221 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/backtrace_dummy.c b/src/xbt/backtrace_dummy.c index 8efe7297d9..095c1d1613 100644 --- a/src/xbt/backtrace_dummy.c +++ b/src/xbt/backtrace_dummy.c @@ -8,7 +8,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/ex.h" -#include "xbt/ex_private.h" +#include "xbt_modinter.h" /* Module creation/destruction */ void xbt_backtrace_init(void) { } diff --git a/src/xbt/backtrace_windows.c b/src/xbt/backtrace_windows.c index 6ff8b59e95..3845ae3def 100644 --- a/src/xbt/backtrace_windows.c +++ b/src/xbt/backtrace_windows.c @@ -200,13 +200,13 @@ int backtrace(void **buffer, int size) /* ebp points on stack base */ /* esp points on stack pointer, ie on last stacked element (current element) */ -// asm ("call $ + 5"); FIXME: this does not works when cross-compiling. Is this really mandatory? - asm ("pop %eax"); - asm ("mov context.Eip, %eax"); - asm ("mov %eax, %esp"); - asm ("mov context.Esp, %eax"); - asm ("mov context.Ebp, %ebp"); - + _asm call $ + 5 + _asm pop %eax + _asm mov context.Eip, %eax + _asm mov %eax, %esp + _asm mov context.Esp, %eax + _asm mov context.Ebp, %ebp + if ((NULL == hlp_dbg_instance) || (size <= 0) || (NULL == buffer)) { errno = EINVAL; return 0; diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 365c922147..4eeaba0f6a 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -29,7 +29,7 @@ # define HAVE_BACKTRACE 1 /* Hello linux box */ #endif -#if defined(WIN32) && defined(_M_IX86) +#if defined(WIN32) && defined(_M_IX86) && !defined(__GNUC__) # define HAVE_BACKTRACE 1 /* Hello x86 windows box */ #endif @@ -94,7 +94,7 @@ void xbt_backtrace_display_current(void) { #if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE) # include "backtrace_linux.c" -#elif (defined(WIN32) && defined (_M_IX86)) +#elif (defined(WIN32) && defined (_M_IX86)) && !defined(__GNUC__) # include "backtrace_windows.c" #else # include "backtrace_dummy.c"