summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Horsfall <wolfsage@gmail.com>2016-04-07 06:51:06 -0400
committerSteve Hay <steve.m.hay@googlemail.com>2016-04-07 17:20:17 +0100
commit32f0645d6fb4ef9e64ebbdaa14fbc6a1b1a89301 (patch)
tree1b2621502444c7554b9e58b22e93c1dc2ada3925
parent6afdf560b1e1b599cea7c0540117728a044bcd25 (diff)
downloadperl-32f0645d6fb4ef9e64ebbdaa14fbc6a1b1a89301.tar.gz
Get -Accflags=-DPERL_MEM_LOG compiling again
It had rotted a bit Well, more than one probably. Move the declarations of the functions Perl_mem_log_alloc etc from handy.h into embed.fnc where whey belong, and where Malloc_t will have already been defined. [backport of blead 6fb87544af0ff2b9b9c12038bc0fb261f56a7d88]
-rw-r--r--embed.fnc6
-rw-r--r--embed.h5
-rw-r--r--handy.h6
-rw-r--r--pod/perlhacktips.pod11
-rw-r--r--proto.h22
-rw-r--r--util.c6
6 files changed, 45 insertions, 11 deletions
diff --git a/embed.fnc b/embed.fnc
index 0147e4b1c0..b26ba18b1d 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2500,6 +2500,12 @@ sn |void |mem_log_common |enum mem_log_type mlt|const UV n|const UV typesize \
#endif
#endif
+#if defined(PERL_MEM_LOG)
+pn |Malloc_t |mem_log_alloc |const UV nconst|UV typesize|NN const char *type_name|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname
+pn |Malloc_t |mem_log_realloc |const UV n|const UV typesize|NN const char *type_name|Malloc_t oldalloc|Malloc_t newalloc|NN const char *filename|const int linenumber|NN const char *funcname
+pn |Malloc_t |mem_log_free |Malloc_t oldalloc|NN const char *filename|const int linenumber|NN const char *funcname
+#endif
+
#if defined(PERL_IN_NUMERIC_C)
#ifndef USE_QUADMATH
sn |NV|mulexp10 |NV value|I32 exponent
diff --git a/embed.h b/embed.h
index 8598ac8bf7..e09ffee89c 100644
--- a/embed.h
+++ b/embed.h
@@ -1777,6 +1777,11 @@
#define mem_log_common S_mem_log_common
# endif
# endif
+# if defined(PERL_MEM_LOG)
+#define mem_log_alloc Perl_mem_log_alloc
+#define mem_log_free Perl_mem_log_free
+#define mem_log_realloc Perl_mem_log_realloc
+# endif
# if defined(PERL_USES_PL_PIDSTATUS) && defined(PERL_IN_UTIL_C)
#define pidgone(a,b) S_pidgone(aTHX_ a,b)
# endif
diff --git a/handy.h b/handy.h
index 3e6fd52529..dfd6429071 100644
--- a/handy.h
+++ b/handy.h
@@ -1976,12 +1976,6 @@ PoisonWith(0xEF) for catching access to freed memory.
* - lots of ENV reads
*/
-PERL_EXPORT_C Malloc_t Perl_mem_log_alloc(const UV n, const UV typesize, const char *type_name, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname);
-
-PERL_EXPORT_C Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const char *type_name, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname);
-
-PERL_EXPORT_C Malloc_t Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber, const char *funcname);
-
# ifdef PERL_CORE
# ifndef PERL_MEM_LOG_NOIMPL
enum mem_log_type {
diff --git a/pod/perlhacktips.pod b/pod/perlhacktips.pod
index f7cd08d9da..29cb79e2cc 100644
--- a/pod/perlhacktips.pod
+++ b/pod/perlhacktips.pod
@@ -1436,12 +1436,13 @@ C<-DPERL_MEM_LOG> instead.
=head2 PERL_MEM_LOG
-If compiled with C<-DPERL_MEM_LOG>, both memory and SV allocations go
-through logging functions, which is handy for breakpoint setting.
+If compiled with C<-DPERL_MEM_LOG> (C<-Accflags=-DPERL_MEM_LOG>), both
+memory and SV allocations go through logging functions, which is
+handy for breakpoint setting.
-Unless C<-DPERL_MEM_LOG_NOIMPL> is also compiled, the logging functions
-read $ENV{PERL_MEM_LOG} to determine whether to log the event, and if
-so how:
+Unless C<-DPERL_MEM_LOG_NOIMPL> (C<-Accflags=-DPERL_MEM_LOG_NOIMPL>) is
+also compiled, the logging functions read $ENV{PERL_MEM_LOG} to
+determine whether to log the event, and if so how:
$ENV{PERL_MEM_LOG} =~ /m/ Log all memory ops
$ENV{PERL_MEM_LOG} =~ /s/ Log all SV ops
diff --git a/proto.h b/proto.h
index db148242b5..ab782025c5 100644
--- a/proto.h
+++ b/proto.h
@@ -8026,6 +8026,28 @@ STATIC void S_mem_log_common(enum mem_log_type mlt, const UV n, const UV typesiz
# endif
#endif
+#if defined(PERL_MEM_LOG)
+PERL_CALLCONV Malloc_t Perl_mem_log_alloc(const UV nconst, UV typesize, const char *type_name, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(5)
+ __attribute__nonnull__(7);
+#define PERL_ARGS_ASSERT_MEM_LOG_ALLOC \
+ assert(type_name); assert(filename); assert(funcname)
+
+PERL_CALLCONV Malloc_t Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber, const char *funcname)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4);
+#define PERL_ARGS_ASSERT_MEM_LOG_FREE \
+ assert(filename); assert(funcname)
+
+PERL_CALLCONV Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const char *type_name, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(6)
+ __attribute__nonnull__(8);
+#define PERL_ARGS_ASSERT_MEM_LOG_REALLOC \
+ assert(type_name); assert(filename); assert(funcname)
+
+#endif
#if defined(PERL_OP_PARENT)
PERL_CALLCONV OP* Perl_op_parent(OP *o)
__attribute__nonnull__(1);
diff --git a/util.c b/util.c
index 28ea72937d..457b013df3 100644
--- a/util.c
+++ b/util.c
@@ -4884,6 +4884,8 @@ Perl_mem_log_alloc(const UV n, const UV typesize, const char *type_name,
const char *filename, const int linenumber,
const char *funcname)
{
+ PERL_ARGS_ASSERT_MEM_LOG_ALLOC;
+
mem_log_common_if(MLT_ALLOC, n, typesize, type_name,
NULL, NULL, newalloc,
filename, linenumber, funcname);
@@ -4896,6 +4898,8 @@ Perl_mem_log_realloc(const UV n, const UV typesize, const char *type_name,
const char *filename, const int linenumber,
const char *funcname)
{
+ PERL_ARGS_ASSERT_MEM_LOG_REALLOC;
+
mem_log_common_if(MLT_REALLOC, n, typesize, type_name,
NULL, oldalloc, newalloc,
filename, linenumber, funcname);
@@ -4907,6 +4911,8 @@ Perl_mem_log_free(Malloc_t oldalloc,
const char *filename, const int linenumber,
const char *funcname)
{
+ PERL_ARGS_ASSERT_MEM_LOG_FREE;
+
mem_log_common_if(MLT_FREE, 0, 0, "", NULL, oldalloc, NULL,
filename, linenumber, funcname);
return oldalloc;