Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give up on cross-compiling backtrace code from gcc: inline assembly code cannot be...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 23 Jan 2008 14:26:13 +0000 (14:26 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 23 Jan 2008 14:26:13 +0000 (14:26 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5221 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/backtrace_dummy.c
src/xbt/backtrace_windows.c
src/xbt/ex.c

index 8efe729..095c1d1 100644 (file)
@@ -8,7 +8,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
  * 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) { }
 
 /* Module creation/destruction */
 void xbt_backtrace_init(void) { }
index 6ff8b59..3845ae3 100644 (file)
@@ -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) */
 
   /* 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;
   if ((NULL == hlp_dbg_instance) || (size <= 0) || (NULL == buffer)) {
     errno = EINVAL;
     return 0;
index 365c922..4eeaba0 100644 (file)
@@ -29,7 +29,7 @@
 # define HAVE_BACKTRACE 1 /* Hello linux box */
 #endif
 
 # 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 
    
 # 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"
 
 #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"
 # include "backtrace_windows.c"
 #else
 # include "backtrace_dummy.c"