From: Tom Hughes Date: Fri, 4 Sep 2009 13:03:41 +0000 (+0000) Subject: Support AT_EXECFN in the ELF auxv, filling it in with the path of X-Git-Tag: svn/VALGRIND_3_6_0~513 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=100741663f54c8b20d41ae0d32739989c279ebf3;p=thirdparty%2Fvalgrind.git Support AT_EXECFN in the ELF auxv, filling it in with the path of the client executable valgrind is starting. Based on a patch from John Reiser. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10885 --- diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index ec77cd2836..7cd836e3bc 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -258,6 +258,10 @@ static HChar** setup_client_env ( HChar** origenv, const HChar* toolname) #define AT_RANDOM 25 #endif /* AT_RANDOM */ +#ifndef AT_EXECFN +#define AT_EXECFN 31 +#endif /* AT_EXECFN */ + #ifndef AT_SYSINFO #define AT_SYSINFO 32 #endif /* AT_SYSINFO */ @@ -439,6 +443,8 @@ Addr setup_client_stack( void* init_sp, stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1; else if (cauxv->a_type == AT_RANDOM) stringsize += 16; + else if (cauxv->a_type == AT_EXECFN) + stringsize += VG_(strlen)(VG_(args_the_exename)) + 1; auxsize += sizeof(*cauxv); } @@ -709,6 +715,11 @@ Addr setup_client_stack( void* init_sp, strtab += 16; break; + case AT_EXECFN: + /* points to the executable filename */ + auxv->u.a_ptr = copy_str(&strtab, VG_(args_the_exename)); + break; + default: /* stomp out anything we don't know about */ VG_(debugLog)(2, "initimg",