]> granicus.if.org Git - gc/commitdiff
Fix GC_caller_func_offset and GC_DBG_RA names
authorIvan Maidanski <ivmai@mail.ru>
Sun, 21 Jul 2013 14:27:07 +0000 (18:27 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 21 Jul 2013 14:43:07 +0000 (18:43 +0400)
* dbg_mlc.c (GC_caller_func_offset): Test FREEBSD macro instead of
__FreeBSD__ (since the former is always defined in gcconfig.h included
from this file indirectly).
* dyn_load.c (ElfW): Likewise.
* dbg_mlc.c (GC_caller_func): Fix name to GC_caller_func_offset.
* dbg_mlc.c (GC_debug_realloc): Invoke GC_caller_func_offset if
GC_ADD_CALLER (same as in GC_debug_malloc and commit 2cdf7ec).
* include/private/gc_priv.h (RA): Fix name to GC_DBG_RA.
* include/private/gcconfig.h (X86_64): Test __x86_64__ in addition to
__amd64__ for FreeBSD (proposed in commit b54833a).

dbg_mlc.c
dyn_load.c
include/private/gc_priv.h
include/private/gcconfig.h

index 18b50907a84e13babe43856b6126da6c3d62bc0e..c643a02bbe8aef36343df3ae3c402b3caf9d5646 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -455,7 +455,7 @@ GC_API void GC_CALL GC_debug_register_displacement(size_t offset)
     GC_register_displacement((word)sizeof(oh) + offset);
 }
 
-#if defined(__FreeBSD__)
+#ifdef FREEBSD
 #include <dlfcn.h>
 static void GC_caller_func_offset(ad, symp, offp)
 const GC_word ad;
@@ -469,7 +469,7 @@ int *offp;
     }
 }
 #else
-#define GC_caller_func(ad, symp, offp)
+#   define GC_caller_func_offset(ad, symp, offp) (void)0
 #endif
 
 GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
@@ -854,6 +854,14 @@ GC_API void * GC_CALL GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS)
     void * base;
     void * result;
     hdr * hhdr;
+
+#ifdef GC_ADD_CALLER
+    if (s == NULL) {
+      GC_caller_func_offset(ra, &s, &i);
+      if (s == NULL)
+        s = "unknown";
+    }
+#endif
     if (p == 0)
       return(GC_debug_malloc(lb, OPT_RA s, i));
 
index a76e7b84880409ae58079af953183a02cb7c9d91..84fdee89afdab7ea3e6b3b602a8dca514def17c4 100644 (file)
@@ -105,7 +105,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
 /* Newer versions of GNU/Linux define this macro.  We
  * define it similarly for any ELF systems that don't.  */
 #  ifndef ElfW
-#    if defined(FREEBSD) || defined(__FreeBSD__)
+#    if defined(FREEBSD)
 #      if __ELF_WORD_SIZE == 32
 #        define ElfW(type) Elf32_##type
 #      else
index 669918c6e4469b3be8afe2357aafb69745fc4cfe..49e68d2142db5c16d1e2305201ae745bec22c0af 100644 (file)
@@ -1715,11 +1715,10 @@ GC_INNER ptr_t GC_allocobj(size_t sz, int kind);
                                 /* head.  Sz is in granules.            */
 
 #ifdef GC_ADD_CALLER
-# define GC_DBG_RA GC_RETURN_ADDR,
 # ifdef GC_RETURN_ADDR_PARENT
-#  define RA GC_RETURN_ADDR_PARENT,
+#  define GC_DBG_RA GC_RETURN_ADDR_PARENT,
 # else
-#  define RA GC_RETURN_ADDR,
+#  define GC_DBG_RA GC_RETURN_ADDR,
 # endif
 #else
 # define GC_DBG_RA /* empty */
index 31f1023beff70b3a743d6be9003f72a16ce27910..c04e0972a87214a380679ae60480c934840ca2cc 100644 (file)
@@ -72,9 +72,9 @@
 # endif
 # if defined(__arm) || defined(__arm__) || defined(__thumb__)
 #    define ARM32
-#    if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
-        && !defined(DARWIN) && !defined(_WIN32) && !defined(__CEGCC__) \
-        && !defined(FREEBSD)
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \
+        && !defined(OPENBSD) && !defined(DARWIN) \
+        && !defined(_WIN32) && !defined(__CEGCC__)
 #      define NOSYS
 #      define mach_type_known
 #    endif
 #   define I386
 #   define mach_type_known
 # endif
-# if defined(FREEBSD) && defined(__amd64__)
+# if defined(FREEBSD) && (defined(__amd64__) || defined(__x86_64__))
 #   define X86_64
 #   define mach_type_known
 # endif
 #     define OS_TYPE "MSWINCE"
 #     define DATAEND /* not needed */
 #   endif
-/* To the future maintainer of this diff: this is the "ifdef ARM32" section */
 #   ifdef FREEBSD
+    /* FreeBSD/arm */
 #   define ALIGNMENT 4
 #       define OS_TYPE "FREEBSD"
 #       ifdef __ELF__