summaryrefslogtreecommitdiff
path: root/dbg_mlc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2006-03-10 06:24:07 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:36 +0200
commit65c2804e5bea35c0e3158c063644994d9239a8ab (patch)
tree894ec2e3323aa9ac0113b72ea0c13d6f886f1dad /dbg_mlc.c
parent541151996c2ec4b2168538796f3516a31279b806 (diff)
2006-03-09 Hans Boehm <Hans.Boehm@hp.com>
Merge various gc6.7 changes (see doc/README.changes for contributors): * configure.ac, pthread_stop_world.c, pthread_support.c, threadlibs.c, include/gc_config_macros.h, include/gc_pthread_redirects.h, include/leak_detector.h, include/private/gcconfig.h, include/private/thread_local_alloc.h: Add NetBSD threads support. * dbg_mlc.c, malloc.c, include/gc.h: add GC_debug_str_dup, GC_str_dup. * os_dep.c (GC_init_win32), dyn_load.c (win32 GC_register_dynamic_libraries): accept MEM_PRIVATE for Windows 98 etc. * doc/gcinterface.html: Add warnings about thread locals and in-flight exceptions. * tests/tests.am: Add EXE extensions. * Makefile.in, configure: rebuild
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r--dbg_mlc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 881fa7f..bffa933 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -14,6 +14,8 @@
* modified is included with the above copyright notice.
*/
+#include <errno.h>
+#include <string.h>
#include "private/dbg_mlc.h"
void GC_default_print_heap_obj_proc();
@@ -636,6 +638,19 @@ void * GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
+char *GC_debug_strdup(const char *str, GC_EXTRA_PARAMS)
+{
+ char *copy;
+ if (str == NULL) return NULL;
+ copy = GC_debug_malloc_atomic(strlen(str) + 1, OPT_RA s, i);
+ if (copy == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ strcpy(copy, str);
+ return copy;
+}
+
void * GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);