|
From: <sv...@va...> - 2005-04-25 02:06:03
|
Author: sewardj
Date: 2005-04-25 03:05:54 +0100 (Mon, 25 Apr 2005)
New Revision: 3561
Modified:
trunk/coregrind/vg_main.c
Log:
Print debugging info at various places in the startup sequence.
Modified: trunk/coregrind/vg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_main.c 2005-04-25 02:04:54 UTC (rev 3560)
+++ trunk/coregrind/vg_main.c 2005-04-25 02:05:54 UTC (rev 3561)
@@ -2404,12 +2404,6 @@
build the segment skip-list.
*/
=20
-static int prmap(char *start, char *end, const char *perm, off_t off,=20
- int maj, int min, int ino, void* dummy) {
- printf("mapping %10p-%10p %s %02x:%02x %d\n",
- start, end, perm, maj, min, ino);
- return True;
-}
=20
/* This may be needed before m_mylibc is OK to run. */
static Int local_strcmp ( const HChar* s1, const HChar* s2 )
@@ -2493,14 +2487,11 @@
// Check we were launched by stage1
// p: none
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Doing scan_auxv()\n");
{
- void* init_sp =3D argv - 1;
- padfile =3D scan_auxv(init_sp);
+ void* init_sp =3D argv - 1;
+ padfile =3D scan_auxv(init_sp);
}
- if (0) {
- printf("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D main() =3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D\n");
- foreach_map(prmap, /*dummy*/NULL);
- }
=20
//--------------------------------------------------------------
// Look for alternative libdir =20
@@ -2516,6 +2507,7 @@
// Pre-process the command line.
// p: none
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Preprocess command line opts\n");
get_command_line(argc, argv, &vg_argc, &vg_argv, &cl_argv);
pre_process_cmd_line_options(&need_help, &tool, &exec);
=20
@@ -2529,6 +2521,7 @@
// p: set-libdir [for VG_(libdir)]
// p: pre_process_cmd_line_options() [for 'tool']
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Loading tool\n");
load_tool(tool, &toolinfo, &preload);
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -2540,6 +2533,7 @@
// Finalise address space layout
// p: load_tool() [for 'toolinfo']
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Laying out remaining space\n");
layout_remaining_space( (Addr) & argc, toolinfo->shadow_ratio );
=20
//--------------------------------------------------------------
@@ -2547,6 +2541,7 @@
// p: pre_process_cmd_line_options() [for 'exec', 'need_help']
// p: layout_remaining_space [so there's space]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Loading client\n");
load_client(cl_argv, exec, need_help, &info, &client_eip);
=20
//--------------------------------------------------------------
@@ -2562,6 +2557,7 @@
// p: set-libdir [for VG_(libdir)]
// p: load_tool() [for 'preload']
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Setup client env\n");
env =3D fix_environment(envp, preload);
=20
//--------------------------------------------------------------
@@ -2569,18 +2565,20 @@
// p: load_client() [for 'info']
// p: fix_environment() [for 'env']
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Setup client stack\n");
{=20
- void* init_sp =3D argv - 1;
+ void* init_sp =3D argv - 1;
=20
- sp_at_startup =3D setup_client_stack(init_sp, cl_argv, env, &info,
- &client_auxv);
- free(env);
+ sp_at_startup =3D setup_client_stack(init_sp, cl_argv, env, &info,
+ &client_auxv);
+ free(env);
}
=20
- if (0)
- printf("entry=3D%p client esp=3D%p vg_argc=3D%d brkbase=3D%p\n",
- (void*)client_eip, (void*)sp_at_startup, vg_argc,=20
- (void*)VG_(brk_base));
+ VG_(debugLog)(2, "main",
+ "Client info: "
+ "entry=3D%p client esp=3D%p vg_argc=3D%d brkbase=3D%=
p\n",
+ (void*)client_eip, (void*)sp_at_startup, vg_argc,=20
+ (void*)VG_(brk_base) );
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
// Finished setting up operating environment. Now initialise
@@ -2591,12 +2589,14 @@
// setup file descriptors
// p: n/a
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Setup file descriptors\n");
setup_file_descriptors();
=20
//--------------------------------------------------------------
// Build segment map (Valgrind segments only)
// p: tl_pre_clo_init() [to setup new_mem_startup tracker]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Parse /proc/self/maps (round 1)\n");
VG_(parse_procselfmaps) ( build_valgrind_map_callback );
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -2611,6 +2611,7 @@
// p: parse_procselfmaps [so VG segments are setup so tool c=
an
// call VG_(malloc)]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise the tool\n");
(*toolinfo->tl_pre_clo_init)();
VG_(sanity_check_needs)();
=20
@@ -2627,6 +2628,7 @@
// Determine CPU architecture and subarchitecture
// p: none
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Check CPU arch/subarch\n");
{ Bool ok =3D VGA_(getArchAndSubArch)(
& VG_(vex_arch), & VG_(vex_subarch) );
if (!ok) {
@@ -2652,6 +2654,7 @@
// p: setup_client_stack() [for 'sp_at_startup']
// p: init tool [for 'new_mem_startup']
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Parse /proc/self/maps (round 2)\n");
sp_at_startup___global_arg =3D sp_at_startup;
VG_(parse_procselfmaps) ( build_segment_map_callback ); /* everythin=
g */
sp_at_startup___global_arg =3D 0;
@@ -2683,6 +2686,7 @@
/* Hook to delay things long enough so we can get the pid and
attach GDB in another shell. */
if (VG_(clo_wait_for_gdb)) {
+ VG_(debugLog)(1, "main", "Wait for GDB\n");
VG_(printf)("pid=3D%d, entering delay loop\n", VG_(getpid)());
/* jrs 20050206: I don't understand why this works on x86. On
amd64 the obvious analogues (jump *$rip or jump *$rcx) don't
@@ -2696,13 +2700,16 @@
// Search for file descriptors that are inherited from our parent
// p: process_cmd_line_options [for VG_(clo_track_fds)]
//--------------------------------------------------------------
- if (VG_(clo_track_fds))
+ if (VG_(clo_track_fds)) {
+ VG_(debugLog)(1, "main", "Init preopened fds\n");
VG_(init_preopened_fds)();
+ }
=20
//--------------------------------------------------------------
// Initialise the scheduler
// p: setup_file_descriptors() [else VG_(safe_fd)() breaks]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise scheduler\n");
VG_(scheduler_init)();
=20
//--------------------------------------------------------------
@@ -2712,6 +2719,7 @@
// setup_client_stack() [for 'sp_at_startup']
// setup_scheduler() [for the rest of state 1 stuff]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise thread 1's state\n");
VGA_(init_thread1state)(client_eip, sp_at_startup, &VG_(threads)[1].a=
rch );
=20
// Tell the tool that we just wrote to the registers.
@@ -2730,6 +2738,7 @@
// p: n/a
//--------------------------------------------------------------
// Nb: temporarily parks the saved blocking-mask in saved_sigmask.
+ VG_(debugLog)(1, "main", "Initialise signal management\n");
VG_(sigstartup_actions)();
=20
//--------------------------------------------------------------
@@ -2753,8 +2762,10 @@
// Read suppression file
// p: process_cmd_line_options() [for VG_(clo_suppressions)]
//--------------------------------------------------------------
- if (VG_(needs).core_errors || VG_(needs).tool_errors)
+ if (VG_(needs).core_errors || VG_(needs).tool_errors) {
+ VG_(debugLog)(1, "main", "Load suppressions\n");
VG_(load_suppressions)();
+ }
=20
//--------------------------------------------------------------
// Initialise translation table and translation cache
@@ -2762,6 +2773,7 @@
// aren't identified as part of the client, which would waste
// > 20M of virtual address space.]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise TT/TC\n");
VG_(init_tt_tc)();
=20
//--------------------------------------------------------------
@@ -2769,6 +2781,7 @@
// p: parse_procselfmaps? [XXX for debug info?]
// p: init_tt_tc [so it can call VG_(search_transtab) safely]
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise redirects\n");
VG_(setup_code_redirect_table)();
VGP_(setup_redirects)();
=20
@@ -2795,6 +2808,7 @@
=20
vg_assert(VG_(master_tid) =3D=3D 1);
=20
+ VG_(debugLog)(1, "main", "Running thread 1\n");
VGA_(main_thread_wrapper)(1);
=20
abort();
|