Author: florian
Date: Wed Aug 20 21:04:14 2014
New Revision: 14323
Log:
Clean up confusion about VG_(args_the_exename) which was believed to
possibly be NULL in several places. Nowadays, VG_(ii_create_image) will
terminate the process if VG_(args_the_exename) is NULL.
Modified:
trunk/cachegrind/cg_main.c
trunk/callgrind/dump.c
trunk/coregrind/m_initimg/initimg-darwin.c
trunk/coregrind/m_initimg/initimg-linux.c
trunk/coregrind/m_main.c
trunk/massif/ms_main.c
Modified: trunk/cachegrind/cg_main.c
==============================================================================
--- trunk/cachegrind/cg_main.c (original)
+++ trunk/cachegrind/cg_main.c Wed Aug 20 21:04:14 2014
@@ -1421,11 +1421,9 @@
// "cmd:" line
VG_(strcpy)(buf, "cmd:");
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- if (VG_(args_the_exename)) {
- VG_(write)(fd, " ", 1);
- VG_(write)(fd, VG_(args_the_exename),
- VG_(strlen)( VG_(args_the_exename) ));
- }
+ VG_(write)(fd, " ", 1);
+ VG_(write)(fd, VG_(args_the_exename),
+ VG_(strlen)( VG_(args_the_exename) ));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
if (arg) {
Modified: trunk/callgrind/dump.c
==============================================================================
--- trunk/callgrind/dump.c (original)
+++ trunk/callgrind/dump.c Wed Aug 20 21:04:14 2014
@@ -1623,10 +1623,8 @@
Int i,j,size = 0;
HChar* argv;
- if (VG_(args_the_exename)) {
- CLG_ASSERT( VG_(strlen)( VG_(args_the_exename) ) < BUF_LEN-1);
- size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
- }
+ CLG_ASSERT( VG_(strlen)( VG_(args_the_exename) ) < BUF_LEN-1);
+ size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
for(i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argv = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
Modified: trunk/coregrind/m_initimg/initimg-darwin.c
==============================================================================
--- trunk/coregrind/m_initimg/initimg-darwin.c (original)
+++ trunk/coregrind/m_initimg/initimg-darwin.c Wed Aug 20 21:04:14 2014
@@ -333,7 +333,6 @@
Addr client_SP; /* client stack base (initial SP) */
Addr clstack_start;
Int i;
- Bool have_exename;
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
vg_assert( VG_(args_for_client) );
@@ -343,7 +342,6 @@
/* first of all, work out how big the client stack will be */
stringsize = 0;
auxsize = 0;
- have_exename = VG_(args_the_exename) != NULL;
/* paste on the extra args if the loader needs them (ie, the #!
interpreter and its argument) */
@@ -358,8 +356,7 @@
}
/* now scan the args we're given... */
- if (have_exename)
- stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
+ stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argc++;
@@ -387,7 +384,7 @@
/* OK, now we know how big the client stack is */
stacksize =
sizeof(Word) + /* argc */
- (have_exename ? sizeof(HChar **) : 0) + /* argc[0] == exename */
+ sizeof(HChar **) + /* argc[0] == exename */
sizeof(HChar **)*argc + /* argv */
sizeof(HChar **) + /* terminal NULL */
sizeof(HChar **)*envc + /* envp */
@@ -435,7 +432,7 @@
if (info->dynamic) *ptr++ = info->text;
/* --- client argc --- */
- *ptr++ = (Addr)(argc + (have_exename ? 1 : 0));
+ *ptr++ = (Addr)(argc + 1);
/* --- client argv --- */
if (info->interp_name) {
@@ -447,8 +444,7 @@
VG_(free)(info->interp_args);
}
- if (have_exename)
- *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
+ *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
*ptr++ = (Addr)copy_str(
Modified: trunk/coregrind/m_initimg/initimg-linux.c
==============================================================================
--- trunk/coregrind/m_initimg/initimg-linux.c (original)
+++ trunk/coregrind/m_initimg/initimg-linux.c Wed Aug 20 21:04:14 2014
@@ -400,7 +400,6 @@
Addr client_SP; /* client stack base (initial SP) */
Addr clstack_start;
Int i;
- Bool have_exename;
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
vg_assert( VG_(args_for_client) );
@@ -412,7 +411,6 @@
/* first of all, work out how big the client stack will be */
stringsize = 0;
- have_exename = VG_(args_the_exename) != NULL;
/* paste on the extra args if the loader needs them (ie, the #!
interpreter and its argument) */
@@ -427,8 +425,7 @@
}
/* now scan the args we're given... */
- if (have_exename)
- stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
+ stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argc++;
@@ -452,7 +449,7 @@
stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1;
else if (cauxv->a_type == AT_RANDOM)
stringsize += 16;
- else if (cauxv->a_type == AT_EXECFN && have_exename)
+ else if (cauxv->a_type == AT_EXECFN)
stringsize += VG_(strlen)(VG_(args_the_exename)) + 1;
auxsize += sizeof(*cauxv);
}
@@ -465,7 +462,7 @@
/* OK, now we know how big the client stack is */
stacksize =
sizeof(Word) + /* argc */
- (have_exename ? sizeof(HChar **) : 0) + /* argc[0] == exename */
+ sizeof(HChar **) + /* argc[0] == exename */
sizeof(HChar **)*argc + /* argv */
sizeof(HChar **) + /* terminal NULL */
sizeof(HChar **)*envc + /* envp */
@@ -577,7 +574,7 @@
ptr = (Addr*)client_SP;
/* --- client argc --- */
- *ptr++ = argc + (have_exename ? 1 : 0);
+ *ptr++ = argc + 1;
/* --- client argv --- */
if (info->interp_name) {
@@ -589,8 +586,7 @@
VG_(free)(info->interp_args);
}
- if (have_exename)
- *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
+ *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
*ptr++ = (Addr)copy_str(
Modified: trunk/coregrind/m_main.c
==============================================================================
--- trunk/coregrind/m_main.c (original)
+++ trunk/coregrind/m_main.c Wed Aug 20 21:04:14 2014
@@ -1275,8 +1275,7 @@
// paste the command line (because of the "==pid==" prefixes), so we now
// favour utility and simplicity over aesthetics.
umsg_or_xml("%sCommand: ", xpre);
- if (VG_(args_the_exename))
- umsg_or_xml_arg(VG_(args_the_exename));
+ umsg_or_xml_arg(VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* s = *(HChar**)VG_(indexXA)( VG_(args_for_client), i );
@@ -1327,8 +1326,7 @@
VG_(printf_xml)(" </vargv>\n");
VG_(printf_xml)(" <argv>\n");
- if (VG_(args_the_exename))
- VG_(printf_xml)(" <exe>%pS</exe>\n",
+ VG_(printf_xml)(" <exe>%pS</exe>\n",
VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
VG_(printf_xml)(
@@ -1876,8 +1874,7 @@
VG_(err_config_error)("Can't create client cmdline file in %s\n", buf2);
nul[0] = 0;
- exename = VG_(args_the_exename) ? VG_(args_the_exename)
- : "unknown_exename";
+ exename = VG_(args_the_exename);
VG_(write)(fd, exename, VG_(strlen)( exename ));
VG_(write)(fd, nul, 1);
Modified: trunk/massif/ms_main.c
==============================================================================
--- trunk/massif/ms_main.c (original)
+++ trunk/massif/ms_main.c Wed Aug 20 21:04:14 2014
@@ -2331,15 +2331,11 @@
// Print "cmd:" line.
FP("cmd: ");
- if (VG_(args_the_exename)) {
- FP("%s", VG_(args_the_exename));
- for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
- HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
- if (arg)
- FP(" %s", arg);
- }
- } else {
- FP(" ???");
+ FP("%s", VG_(args_the_exename));
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
+ if (arg)
+ FP(" %s", arg);
}
FP("\n");
|