Merge pull request #822 from carlosmn/asp-pc
[mono.git] / mono / mini / trace.c
index 024ddaf20eeb4d58867fd192e6f13bba711a0659..551b2a2fdaf61777910edb599686a6abacf8cfd7 100644 (file)
@@ -31,6 +31,8 @@
 #  define fprintf(__ignore, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
 #endif
 
+#define RETURN_ADDRESS(N) (__builtin_extract_return_addr (__builtin_return_address (N)))
+
 static MonoTraceSpec trace_spec;
 
 gboolean
@@ -401,7 +403,7 @@ mono_trace_enter_method (MonoMethod *method, char *ebp)
        g_free (fname);
 
        if (!ebp) {
-               printf (") ip: %p\n", __builtin_return_address (1));
+               printf (") ip: %p\n", RETURN_ADDRESS (1));
                return;
        }       
 
@@ -411,7 +413,7 @@ mono_trace_enter_method (MonoMethod *method, char *ebp)
 
        if (method->is_inflated) {
                /* FIXME: Might be better to pass the ji itself */
-               MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), __builtin_return_address (0), NULL);
+               MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), RETURN_ADDRESS (0), NULL);
                if (ji) {
                        gsctx = mono_jit_info_get_generic_sharing_context (ji);
                        if (gsctx && (gsctx->var_is_vt || gsctx->mvar_is_vt)) {
@@ -569,7 +571,7 @@ mono_trace_leave_method (MonoMethod *method, ...)
 
        if (method->is_inflated) {
                /* FIXME: Might be better to pass the ji itself */
-               MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), __builtin_return_address (0), NULL);
+               MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), RETURN_ADDRESS (0), NULL);
                if (ji) {
                        gsctx = mono_jit_info_get_generic_sharing_context (ji);
                        if (gsctx && (gsctx->var_is_vt || gsctx->mvar_is_vt)) {
@@ -661,7 +663,7 @@ handle_enum:
        case MONO_TYPE_R4:
        case MONO_TYPE_R8: {
                double f = va_arg (ap, double);
-               printf ("FP=%f\n", f);
+               printf ("FP=%f", f);
                break;
        }
        case MONO_TYPE_VALUETYPE: 
@@ -682,7 +684,7 @@ handle_enum:
                printf ("(unknown return type %x)", mono_method_signature (method)->ret->type);
        }
 
-       //printf (" ip: %p\n", __builtin_return_address (1));
+       //printf (" ip: %p\n", RETURN_ADDRESS (1));
        printf ("\n");
        fflush (stdout);
 }