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
This commit is contained in:
Tom Hughes
2009-09-04 13:03:41 +00:00
parent 48bf971cca
commit 100741663f

View File

@@ -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",