summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-25 12:23:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-25 14:26:43 +0200
commit217122387f6e0ef657b8ba85eae082b448901cec (patch)
tree2ded7e93eff86920ee7f772ff7e2f2466571cde2
parent2c9052802ea411dffbf5906c4914611fcbfbc6a5 (diff)
dont turn on malloc debugging for gdb itself
fix the command such that, when we insert the malloc debugging env vars, we only do it for the executable itself, not for gdb, or some gdb operations will be very very slow. Before this fix, if I did a make Cppunit... CPPUNITRACE=... ran the program, then ran it again, the second time would take 5 min to get going. Now the second time it runs in seconds. Change-Id: Id08c3a82679164588b88af65a6a7b5f7dd19ff05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101318 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--solenv/gbuild/CppunitTest.mk10
-rw-r--r--solenv/gbuild/platform/macosx.mk2
-rw-r--r--solenv/gbuild/platform/unxgcc.mk2
3 files changed, 9 insertions, 5 deletions
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 4a33ac581366..a2243dad3e31 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -25,10 +25,15 @@ gb_CppunitTest_PYTHONDEPS ?= $(call gb_Library_get_target,pyuno_wrapper) $(if $(
ifeq ($(strip $(gb_CppunitTest_GDBTRACE)),)
ifneq ($(strip $(CPPUNITTRACE)),)
ifneq ($(filter gdb,$(CPPUNITTRACE)),)
-gb_CppunitTest_GDBTRACE := $(subst gdb,gdb -ex "set environment $(subst =, ,$(gb_CppunitTest_CPPTESTPRECOMMAND))",$(CPPUNITTRACE))
+# sneak (a) setting the LD_LIBRARY_PATH, and (b) setting malloc debug flags, into the "gdb --args" command line
+gb_CppunitTest_GDBTRACE := $(subst gdb,\
+ gdb -ex "set environment $(subst =, ,$(gb_CppunitTest_CPPTESTPRECOMMAND))" $(gb_CppunitTest_malloc_check),\
+ $(CPPUNITTRACE))
else ifneq ($(filter lldb,$(CPPUNITTRACE)),)
gb_CppunitTest_PREGDBTRACE := lo_dyldpathfile=$(call var2file,$(shell $(gb_MKTEMP)),500,settings set target.env-vars $(gb_CppunitTest_CPPTESTPRECOMMAND))
-gb_CppunitTest_GDBTRACE := $(subst lldb,lldb -s $$lo_dyldpathfile,$(CPPUNITTRACE))
+gb_CppunitTest_GDBTRACE := $(subst lldb,\
+ lldb -s $$lo_dyldpathfile $(gb_CppunitTest_malloc_check),\
+ $(CPPUNITTRACE))
gb_CppunitTest_POSTGDBTRACE := rm $$lo_dyldpathfile
else
gb_CppunitTest_GDBTRACE := $(CPPUNITTRACE)
@@ -127,7 +132,6 @@ else
$(if $(filter gdb,$(gb_CppunitTest_GDBTRACE)),,$(gb_CppunitTest_CPPTESTPRECOMMAND)) \
$(if $(G_SLICE),G_SLICE=$(G_SLICE)) \
$(if $(GLIBCXX_FORCE_NEW),GLIBCXX_FORCE_NEW=$(GLIBCXX_FORCE_NEW)) \
- $(gb_CppunitTest_malloc_check) \
$(if $(strip $(PYTHON_URE)),\
PYTHONDONTWRITEBYTECODE=1) \
$(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_RR) \
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 431f8e4b45fc..863fc4370103 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -261,7 +261,7 @@ gb_CppunitTest_CPPTESTPRECOMMAND := \
$(call gb_Helper_extend_ld_path,$(gb_Library_DLLDIR):$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
gb_CppunitTest_get_filename = libtest_$(1).dylib
gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename)
-gb_CppunitTest_malloc_check := MallocScribble=1 MallocPreScribble=1
+gb_CppunitTest_malloc_check := -Q 'env MallocScribble=1' -Q 'env MallocPreScribble=1'
define gb_CppunitTest_CppunitTest_platform
$(call gb_LinkTarget_get_target,$(2)) : RPATH :=
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index ac6252636fd8..7ef9d0b4015e 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -288,7 +288,7 @@ gb_CppunitTest_CPPTESTPRECOMMAND := \
$(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
gb_CppunitTest_get_filename = libtest_$(1).so
gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename)
-gb_CppunitTest_malloc_check := MALLOC_CHECK_=2 MALLOC_PERTURB_=153
+gb_CppunitTest_malloc_check := -ex 'set environment MALLOC_CHECK_=2; set environment MALLOC_PERTURB_=153'
define gb_CppunitTest_CppunitTest_platform
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE))