Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
3452-Fix-cerl-valgrind-when-run-as-sub-node.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3452-Fix-cerl-valgrind-when-run-as-sub-node.patch of Package erlang
From 25caf1c294bb5a63805837b030452d6aad950a0f Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Tue, 8 Oct 2024 17:50:20 +0200 Subject: [PATCH 2/2] Fix cerl -valgrind when run as sub node The trick with job control to get pid did not work from inside the beam. Symptom: .../bin/cerl: 390: set: can't access tty; job control turned off", .../bin/cerl: 393: fg: job (null) not created under job control" Use new env variable ERL_SYM_MAP_FILE instead to communicate name of symbol file. --- erts/emulator/beam/jit/beam_jit_metadata.cpp | 7 ++++++- erts/emulator/beam/sys.h | 2 +- erts/emulator/sys/unix/sys_env.c | 2 +- erts/emulator/sys/win32/sys_env.c | 2 +- erts/etc/unix/cerl.src | 11 ++++------- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/erts/emulator/beam/jit/beam_jit_metadata.cpp b/erts/emulator/beam/jit/beam_jit_metadata.cpp index d9fd53db73..6af9726620 100644 --- a/erts/emulator/beam/jit/beam_jit_metadata.cpp +++ b/erts/emulator/beam/jit/beam_jit_metadata.cpp @@ -467,7 +467,12 @@ class JitPerfMap { public: bool init() { char name[MAXPATHLEN]; - snprintf(name, sizeof(name), "/tmp/perf-%i.map", getpid()); + size_t namesz = sizeof(name); + + if (erts_sys_explicit_host_getenv("ERL_SYM_MAP_FILE", name, &namesz) != + 1) { + snprintf(name, sizeof(name), "/tmp/perf-%i.map", getpid()); + } file = fopen(name, "w"); if (!file) { int saved_errno = errno; diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h index f90b9bfe66..da81abfe1a 100644 --- a/erts/emulator/beam/sys.h +++ b/erts/emulator/beam/sys.h @@ -863,7 +863,7 @@ int erts_sys_explicit_8bit_putenv(char *key, char *value); /* This is identical to erts_sys_explicit_8bit_getenv but falls down to the * host OS implementation instead of erts_osenv. */ -int erts_sys_explicit_host_getenv(char *key, char *value, size_t *size); +int erts_sys_explicit_host_getenv(const char *key, char *value, size_t *size); const erts_osenv_t *erts_sys_rlock_global_osenv(void); void erts_sys_runlock_global_osenv(void); diff --git a/erts/emulator/sys/unix/sys_env.c b/erts/emulator/sys/unix/sys_env.c index eb98e7b635..47acd8f205 100644 --- a/erts/emulator/sys/unix/sys_env.c +++ b/erts/emulator/sys/unix/sys_env.c @@ -87,7 +87,7 @@ int erts_sys_explicit_8bit_getenv(char *key, char *value, size_t *size) { return result; } -int erts_sys_explicit_host_getenv(char *key, char *value, size_t *size) { +int erts_sys_explicit_host_getenv(const char *key, char *value, size_t *size) { char *orig_value; size_t length; diff --git a/erts/emulator/sys/win32/sys_env.c b/erts/emulator/sys/win32/sys_env.c index 4c4b89adab..ea8ad1449d 100644 --- a/erts/emulator/sys/win32/sys_env.c +++ b/erts/emulator/sys/win32/sys_env.c @@ -58,7 +58,7 @@ void erts_sys_rwunlock_global_osenv() { erts_rwmtx_rwunlock(&sysenv_rwmtx); } -int erts_sys_explicit_host_getenv(char *key, char *value, size_t *size) { +int erts_sys_explicit_host_getenv(const char *key, char *value, size_t *size) { size_t new_size = GetEnvironmentVariableA(key, value, (DWORD)*size); if(new_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src index 05deeea3e3..bf64654a2c 100644 --- a/erts/etc/unix/cerl.src +++ b/erts/etc/unix/cerl.src @@ -387,14 +387,11 @@ if [ "x$GDB" = "x" ]; then if [ $EMU_NAME = "beam.valgrind.smp" ] && [ "x${VALGRIND_LOG_DIR}" != "x" ]; then # Always enable `perf` support as we use the same symbol map emu_xargs="$emu_xargs -JPperf true " - set -m - $taskset1 valgrind $valgrind_xml $valgrind_log $vgflags $BINDIR/$EMU_NAME $sched_arg $emu_xargs "$@" & - VG_PID=$! - fg + export ERL_SYM_MAP_FILE="/tmp/cerl.valgrind.$$.map" + $taskset1 valgrind $valgrind_xml $valgrind_log $vgflags $BINDIR/$EMU_NAME $sched_arg $emu_xargs "$@" VG_EXIT=$? - set +m - if [ -f /tmp/perf-$VG_PID.map ]; then - $ERL_TOP/scripts/valgrind_beamasm_update.escript $valgrind_log_file /tmp/perf-$VG_PID.map + if [ -f $ERL_SYM_MAP_FILE ]; then + $ERL_TOP/scripts/valgrind_beamasm_update.escript $valgrind_log_file $ERL_SYM_MAP_FILE fi exit $VG_EXIT else -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor