]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Refactor: make try_get_interp extern and multi-plaftorm
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 21 Sep 2025 15:08:35 +0000 (17:08 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 21 Sep 2025 15:08:35 +0000 (17:08 +0200)
commitc1f6e5e64aedc82b415bea515d731061d0d6e76f
tree9a64e5e08051a1c402ae1e1c44f795b6c7c1faa8
parent1039274db9695bd41a119fe32c465d0845700820
Refactor: make try_get_interp extern and multi-plaftorm

Previously it was static and defined for Darwin, FreeBSD and Linux.
Now it is global VG_(args_the_exename)  and has a length check.

Also fixed a nasty bug related to VG_(args_the_exename).

Initially this is set to point to the name of the client command
in Valgrinds own arguments. Later when checking for scripts or binaries
VG_(load_script) may get called recursively. If it gets called more than
once it sets VG_(args_the_exename) to point to the new name.
But that is on the stack. Later, if the stack grows too much the
name will get overwritten. I was seeing that with my first versions
of this code in the recursive tests in none/tests/scripts.

Now I'm allocating VG_(args_the_exename) on the heap.
coregrind/m_commandline.c
coregrind/m_initimg/initimg-darwin.c
coregrind/m_initimg/initimg-freebsd.c
coregrind/m_initimg/initimg-linux.c
coregrind/m_pathscan.c
coregrind/m_ume/script.c
coregrind/pub_core_pathscan.h