|
From: Nicholas N. <nj...@ca...> - 2004-06-22 14:00:20
|
CVS commit by nethercote:
Slightly disentangle main().
M +15 -13 vg_main.c 1.159 [POSSIBLY UNSAFE: printf]
--- valgrind/coregrind/vg_main.c #1.158:1.159
@@ -1046,9 +1046,4 @@ static Addr setup_client_stack(char **or
cl_esp = ROUNDDN(cl_esp, 16); /* make stack 16 byte aligned */
- if (0)
- printf("stringsize=%d auxsize=%d stacksize=%d\n",
- stringsize, auxsize, stacksize);
-
-
/* base of the string table (aligned) */
stringbase = strtab = (char *)(VG_(client_trampoline_code) - ROUNDUP(stringsize, sizeof(int)));
@@ -1057,4 +1052,11 @@ static Addr setup_client_stack(char **or
VG_(clstk_end) = VG_(client_end);
+ if (0)
+ printf("stringsize=%d auxsize=%d stacksize=%d\n"
+ "clstk_base %x\n"
+ "clstk_end %x\n",
+ stringsize, auxsize, stacksize, VG_(clstk_base), VG_(clstk_end));
+
+
/* ==================== allocate space ==================== */
@@ -1186,4 +1188,8 @@ static Addr setup_client_stack(char **or
vg_assert((strtab-stringbase) == stringsize);
+ /* We know the initial ESP is pointing at argc/argv */
+ VG_(client_argc) = *(Int*)cl_esp;
+ VG_(client_argv) = (Char**)(cl_esp + sizeof(Int));
+
return cl_esp;
}
@@ -1634,6 +1640,5 @@ static void pre_process_cmd_line_options
}
-static void process_cmd_line_options
- ( UInt* client_auxv, Addr esp_at_startup, const char* toolname )
+static void process_cmd_line_options( UInt* client_auxv, const char* toolname )
{
Int i, eventually_log_fd;
@@ -1659,8 +1664,4 @@ static void process_cmd_line_options
}
- /* We know the initial ESP is pointing at argc/argv */
- VG_(client_argc) = *(Int *)esp_at_startup;
- VG_(client_argv) = (Char **)(esp_at_startup + sizeof(Int));
-
for (i = 1; i < VG_(vg_argc); i++) {
@@ -2750,5 +2751,5 @@ int main(int argc, char **argv)
//--------------------------------------------------------------
- // Setup client stack and eip
+ // Setup client stack, eip, and VG_(client_arg[cv])
// p: load_client() [for 'info']
// p: fix_environment() [for 'env']
@@ -2792,4 +2793,5 @@ int main(int argc, char **argv)
// XXX: alternatively, if sk_pre_clo_init does use VG_(malloc)(), is it
// wrong to ignore any segments that might add in parse_procselfmaps?
+ // p: setup_client_stack() [for 'VG_(client_arg[cv]']
//--------------------------------------------------------------
(*toolinfo->sk_pre_clo_init)();
@@ -2812,5 +2814,5 @@ int main(int argc, char **argv)
// p: sk_pre_clo_init [to set 'command_line_options' need]
//--------------------------------------------------------------
- process_cmd_line_options(client_auxv, esp_at_startup, tool);
+ process_cmd_line_options(client_auxv, tool);
//--------------------------------------------------------------
|