]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Support AT_EXECFN in the ELF auxv, filling it in with the path of
authorTom Hughes <tom@compton.nu>
Fri, 4 Sep 2009 13:03:41 +0000 (13:03 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 4 Sep 2009 13:03:41 +0000 (13:03 +0000)
the client executable valgrind is starting.

Based on a patch from John Reiser.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10885

coregrind/m_initimg/initimg-linux.c

index ec77cd283616c7c84b5d8c052837008777eb7535..7cd836e3bc7e35664efe192e46069f9e3dbd78d3 100644 (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",