Skip to content
Snippets Groups Projects
Commit c3ff3096 authored by Yuri Victorovich's avatar Yuri Victorovich
Browse files

devel/google-perftools: Add LD_32_PRELOAD to the valgrind detection code

Suggested by:	Paul Floyd <pjfloyd@wanadoo.fr>
parent 0bae2dd0
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
PORTNAME= google-perftools PORTNAME= google-perftools
DISTVERSIONPREFIX= gperftools- DISTVERSIONPREFIX= gperftools-
DISTVERSION= 2.9.1 DISTVERSION= 2.9.1
PORTREVISION= 2 PORTREVISION= 3
CATEGORIES= devel CATEGORIES= devel
MASTER_SITES= https://github.com/gperftools/gperftools/releases/download/gperftools-${PORTVERSION}/ MASTER_SITES= https://github.com/gperftools/gperftools/releases/download/gperftools-${PORTVERSION}/
DISTNAME= gperftools-${PORTVERSION} DISTNAME= gperftools-${PORTVERSION}
......
...@@ -3,13 +3,15 @@ ...@@ -3,13 +3,15 @@
--- src/base/dynamic_annotations.c.orig 2021-02-15 06:44:21 UTC --- src/base/dynamic_annotations.c.orig 2021-02-15 06:44:21 UTC
+++ src/base/dynamic_annotations.c +++ src/base/dynamic_annotations.c
@@ -43,6 +43,19 @@ @@ -43,6 +43,21 @@
#include "base/dynamic_annotations.h" #include "base/dynamic_annotations.h"
#include "getenv_safe.h" // for TCMallocGetenvSafe #include "getenv_safe.h" // for TCMallocGetenvSafe
+static int running_on_valgrind_preload = -1; +static int running_on_valgrind_preload = -1;
+void __attribute__ ((constructor)) premain() { +void __attribute__ ((constructor)) premain() {
+ char *LD_PRELOAD = getenv("LD_PRELOAD"); + char *LD_PRELOAD = getenv("LD_PRELOAD");
+ if (LD_PRELOAD == NULL)
+ LD_PRELOAD = getenv("LD_32_PRELOAD");
+ running_on_valgrind_preload = LD_PRELOAD != NULL && + running_on_valgrind_preload = LD_PRELOAD != NULL &&
+ ( + (
+ strstr(LD_PRELOAD, "/valgrind/") != NULL + strstr(LD_PRELOAD, "/valgrind/") != NULL
...@@ -23,7 +25,7 @@ ...@@ -23,7 +25,7 @@
static int GetRunningOnValgrind(void) { static int GetRunningOnValgrind(void) {
#ifdef RUNNING_ON_VALGRIND #ifdef RUNNING_ON_VALGRIND
if (RUNNING_ON_VALGRIND) return 1; if (RUNNING_ON_VALGRIND) return 1;
@@ -51,6 +64,11 @@ static int GetRunningOnValgrind(void) { @@ -51,6 +66,11 @@ static int GetRunningOnValgrind(void) {
if (running_on_valgrind_str) { if (running_on_valgrind_str) {
return strcmp(running_on_valgrind_str, "0") != 0; return strcmp(running_on_valgrind_str, "0") != 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment