cl_esp = VG_(client_end) - stacksize;
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)));
VG_(clstk_base) = PGROUNDDN(cl_esp);
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 ==================== */
/* allocate a stack - mmap enough space for the stack */
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;
}
}
}
-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;
Int *auxp;
}
}
- /* 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++) {
Char* arg = VG_(vg_argv)[i];
env = fix_environment(environ, preload);
//--------------------------------------------------------------
- // Setup client stack and eip
+ // Setup client stack, eip, and VG_(client_arg[cv])
// p: load_client() [for 'info']
// p: fix_environment() [for 'env']
//--------------------------------------------------------------
// XXX: is that necessary, now that we look for V's segments separately?
// 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)();
VG_(tool_init_dlsym)(tool_dlhandle);
// p: setup_file_descriptors() [for 'VG_(max_fd)']
// 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);
//--------------------------------------------------------------
// Allow GDB attach