New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get -DPERL_MEM_LOG working again #15259
Comments
From @wolfsageCreated by wolfsage@gmail.comCompiling with -Accflags=-DPERL_MEM_LOG isn't currently functioning. Attached is a patch to make that work again (and make test passes!) (See also http://www.nntp.perl.org/group/perl.perl5.porters/2016/04/msg235541.html) Perl Info
|
From @wolfsage0001-Get-Accflags-DPERL_MEM_LOG-compiling-again-it-had-ro.patchFrom 4f3d984bf29b90e4e942aeacfd8e847839a99303 Mon Sep 17 00:00:00 2001
From: Matthew Horsfall <wolfsage@gmail.com>
Date: Fri, 1 Apr 2016 12:44:49 -0400
Subject: [PATCH] Get -Accflags=-DPERL_MEM_LOG compiling again; it had rotted a
bit.
...well, more than one probably.
---
embed.fnc | 6 ++++++
embed.h | 5 +++++
handy.h | 6 ------
pod/perlhacktips.pod | 11 ++++++-----
proto.h | 11 +++++++++++
util.c | 6 ++++++
6 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/embed.fnc b/embed.fnc
index ec5921a..7f60ae1 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2563,6 +2563,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 ab76937..c24eb31 100644
--- a/embed.h
+++ b/embed.h
@@ -1814,6 +1814,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 a0a7cde..932a874 100644
--- a/handy.h
+++ b/handy.h
@@ -2049,12 +2049,6 @@ PoisonWith(0xEF) for catching access to freed memory.
* - lots of ENV reads
*/
-PERL_CALLCONV 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_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);
-
-PERL_CALLCONV 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 42b63d9..1dd715a 100644
--- a/pod/perlhacktips.pod
+++ b/pod/perlhacktips.pod
@@ -1451,12 +1451,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 c43c4fc..4beb21b 100644
--- a/proto.h
+++ b/proto.h
@@ -5473,6 +5473,17 @@ STATIC void S_mem_log_common(enum mem_log_type mlt, const UV n, const UV typesiz
assert(type_name); assert(filename); assert(funcname)
# 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);
+#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);
+#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);
+#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);
#define PERL_ARGS_ASSERT_OP_PARENT \
diff --git a/util.c b/util.c
index 9ad40c1..89c44e7 100644
--- a/util.c
+++ b/util.c
@@ -5018,6 +5018,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);
@@ -5030,6 +5032,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);
@@ -5041,6 +5045,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;
--
2.1.4
|
From @jkeenanOn Fri Apr 01 09:58:56 2016, alh wrote:
Tried patch on Linux x86_64 on blead. 'make test' does PASS when configured with -Accflags=-DPERL_MEM_LOG and without.
That link does not (yet) work for me. :-( -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Fri, Apr 01, 2016 at 04:13:27PM -0700, James E Keenan via RT wrote:
The RT linkifier includes the closing ) in the link, try removing it. Tony |
From @iabynOn Fri, Apr 01, 2016 at 09:58:57AM -0700, Matthew Horsfall wrote:
Thanks, applied as v5.23.9-48-g6fb8754. Although we're in code freeze, your patch only affects code built under I took the liberty of touching up the commit message a bit: making the -- |
@iabyn - Status changed from 'open' to 'pending release' |
From @wolfsageOn Tue, Apr 5, 2016 at 7:19 AM, Dave Mitchell <davem@iabyn.com> wrote:
Awesome, thanks! -- Matthew Horsfall (alh) |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127819 (status was 'resolved')
Searchable as RT127819$
The text was updated successfully, but these errors were encountered: