|
From: <sv...@va...> - 2008-02-27 01:47:39
|
Author: sewardj
Date: 2008-02-27 01:47:41 +0000 (Wed, 27 Feb 2008)
New Revision: 7486
Log:
Change core-tool interface to take account of variable location
reading machinery:
VG_(needs_data_syms) is gone. Data symbols are always read.
It is replaced by VG_(needs_var_info). This asks for variable info to
be read. The only tools to use this are Helgrind and DRD.
The user can force loading of variable info, even if the tool
doesn't request it. This is useful for eg making Memcheck produce
better error messages. A new flag is provided for this:
--read-var-info=yes|no read variable type & location info? [no]
Modified:
branches/DATASYMS/coregrind/m_debuginfo/readelf.c
branches/DATASYMS/coregrind/m_main.c
branches/DATASYMS/coregrind/m_options.c
branches/DATASYMS/coregrind/m_tooliface.c
branches/DATASYMS/coregrind/pub_core_options.h
branches/DATASYMS/coregrind/pub_core_tooliface.h
branches/DATASYMS/exp-drd/drd_main.c
branches/DATASYMS/helgrind/hg_main.c
branches/DATASYMS/include/pub_tool_tooliface.h
branches/DATASYMS/memcheck/tests/varinfo1.vgtest
branches/DATASYMS/memcheck/tests/varinfo2.vgtest
branches/DATASYMS/memcheck/tests/varinfo3.vgtest
branches/DATASYMS/memcheck/tests/varinfo4.vgtest
branches/DATASYMS/memcheck/tests/varinfo5.vgtest
branches/DATASYMS/memcheck/tests/varinfo6.vgtest
branches/DATASYMS/none/tests/cmdline2.stdout.exp
Modified: branches/DATASYMS/coregrind/m_debuginfo/readelf.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readelf.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/m_debuginfo/readelf.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1853,15 +1853,20 @@
debug_str_img, debug_str_sz );
/* The new reader: read the DIEs in .debug_info to acquire
- information on variable types and locations. */
- ML_(new_dwarf3_reader) ( di,
- debug_info_img, debug_info_sz,
- debug_abbv_img, debug_abbv_sz,
- debug_line_img, debug_line_sz,
- debug_str_img, debug_str_sz,
- debug_ranges_img, debug_ranges_sz,
- debug_loc_img, debug_loc_sz );
-
+ information on variable types and locations. But only if
+ the tool asks for it, or the user requests it on the
+ command line. */
+ if (VG_(needs).var_info /* the tool requires it */
+ || VG_(clo_read_var_info) /* the user asked for it */) {
+ ML_(new_dwarf3_reader)(
+ di, debug_info_img, debug_info_sz,
+ debug_abbv_img, debug_abbv_sz,
+ debug_line_img, debug_line_sz,
+ debug_str_img, debug_str_sz,
+ debug_ranges_img, debug_ranges_sz,
+ debug_loc_img, debug_loc_sz
+ );
+ }
}
if (dwarf1d_img && dwarf1l_img) {
ML_(read_debuginfo_dwarf1) ( di, dwarf1d_img, dwarf1d_sz,
Modified: branches/DATASYMS/coregrind/m_main.c
===================================================================
--- branches/DATASYMS/coregrind/m_main.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/m_main.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -172,6 +172,7 @@
" --trace-sched=no|yes show thread scheduler details? [no]\n"
" --wait-for-gdb=yes|no pause on startup to wait for gdb attach\n"
" --sym-offsets=yes|no show syms in form 'name+offset' ? [no]\n"
+" --read-var-info=yes|no read variable type & location info? [no]\n"
" --command-line-only=no|yes only use command line options [no]\n"
"\n"
" --vex-iropt-verbosity 0 .. 9 [0]\n"
@@ -423,6 +424,7 @@
else VG_STR_CLO (arg, "--db-command", VG_(clo_db_command))
else VG_STR_CLO (arg, "--sim-hints", VG_(clo_sim_hints))
else VG_BOOL_CLO(arg, "--sym-offsets", VG_(clo_sym_offsets))
+ else VG_BOOL_CLO(arg, "--read-var-info", VG_(clo_read_var_info))
else VG_NUM_CLO (arg, "--dump-error", VG_(clo_dump_error))
else VG_NUM_CLO (arg, "--input-fd", VG_(clo_input_fd))
Modified: branches/DATASYMS/coregrind/m_options.c
===================================================================
--- branches/DATASYMS/coregrind/m_options.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/m_options.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -80,6 +80,7 @@
Int VG_(clo_backtrace_size) = 12;
Char* VG_(clo_sim_hints) = NULL;
Bool VG_(clo_sym_offsets) = False;
+Bool VG_(clo_read_var_info) = False;
Bool VG_(clo_run_libc_freeres) = True;
Bool VG_(clo_track_fds) = False;
Bool VG_(clo_show_below_main)= False;
Modified: branches/DATASYMS/coregrind/m_tooliface.c
===================================================================
--- branches/DATASYMS/coregrind/m_tooliface.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/m_tooliface.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -91,7 +91,7 @@
.client_requests = False,
.syscall_wrapper = False,
.sanity_checks = False,
- .data_syms = False,
+ .var_info = False,
.malloc_replacement = False,
.xml_output = False,
.final_IR_tidy_pass = False
@@ -162,7 +162,7 @@
// These ones don't require any tool-supplied functions
NEEDS(libc_freeres)
NEEDS(core_errors)
-NEEDS(data_syms)
+NEEDS(var_info)
NEEDS(xml_output)
void VG_(needs_superblock_discards)(
Modified: branches/DATASYMS/coregrind/pub_core_options.h
===================================================================
--- branches/DATASYMS/coregrind/pub_core_options.h 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/pub_core_options.h 2008-02-27 01:47:41 UTC (rev 7486)
@@ -137,6 +137,8 @@
extern Char* VG_(clo_sim_hints);
/* Show symbols in the form 'name+offset' ? Default: NO */
extern Bool VG_(clo_sym_offsets);
+/* Read DWARF3 variable info even if tool doesn't ask for it? */
+extern Bool VG_(clo_read_var_info);
/* Track open file descriptors? */
extern Bool VG_(clo_track_fds);
Modified: branches/DATASYMS/coregrind/pub_core_tooliface.h
===================================================================
--- branches/DATASYMS/coregrind/pub_core_tooliface.h 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/coregrind/pub_core_tooliface.h 2008-02-27 01:47:41 UTC (rev 7486)
@@ -88,7 +88,7 @@
Bool client_requests;
Bool syscall_wrapper;
Bool sanity_checks;
- Bool data_syms;
+ Bool var_info;
Bool malloc_replacement;
Bool xml_output;
Bool final_IR_tidy_pass;
Modified: branches/DATASYMS/exp-drd/drd_main.c
===================================================================
--- branches/DATASYMS/exp-drd/drd_main.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/exp-drd/drd_main.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -736,7 +736,7 @@
VG_(track_pre_thread_ll_exit) (drd_thread_finished);
// Other stuff.
- VG_(needs_data_syms)();
+ VG_(needs_var_info)();
drd_register_malloc_wrappers(drd_start_using_mem, drd_stop_using_mem);
Modified: branches/DATASYMS/helgrind/hg_main.c
===================================================================
--- branches/DATASYMS/helgrind/hg_main.c 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/helgrind/hg_main.c 2008-02-27 01:47:41 UTC (rev 7486)
@@ -8819,7 +8819,7 @@
hg_cli__realloc,
HG_CLI__MALLOC_REDZONE_SZB );
- VG_(needs_data_syms)();
+ VG_(needs_var_info)();
//VG_(needs_xml_output) ();
Modified: branches/DATASYMS/include/pub_tool_tooliface.h
===================================================================
--- branches/DATASYMS/include/pub_tool_tooliface.h 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/include/pub_tool_tooliface.h 2008-02-27 01:47:41 UTC (rev 7486)
@@ -416,8 +416,8 @@
Bool(*expensive_sanity_check)(void)
);
-/* Do we need to see data symbols? */
-extern void VG_(needs_data_syms) ( void );
+/* Do we need to see variable type and location information? */
+extern void VG_(needs_var_info) ( void );
/* Does the tool replace malloc() and friends with its own versions?
This has to be combined with the use of a vgpreload_<tool>.so module
Modified: branches/DATASYMS/memcheck/tests/varinfo1.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo1.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo1.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1 +1,2 @@
prog: varinfo1
+vgopts: --read-var-info=yes
Modified: branches/DATASYMS/memcheck/tests/varinfo2.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo2.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo2.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1 +1,2 @@
prog: varinfo2
+vgopts: --read-var-info=yes
Modified: branches/DATASYMS/memcheck/tests/varinfo3.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo3.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo3.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1,2 +1,3 @@
prog: varinfo3
+vgopts: --read-var-info=yes
stderr_filter: filter_varinfo3
Modified: branches/DATASYMS/memcheck/tests/varinfo4.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo4.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo4.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1 +1,2 @@
prog: varinfo4
+vgopts: --read-var-info=yes
Modified: branches/DATASYMS/memcheck/tests/varinfo5.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo5.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo5.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1 +1,2 @@
prog: varinfo5
+vgopts: --read-var-info=yes
Modified: branches/DATASYMS/memcheck/tests/varinfo6.vgtest
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo6.vgtest 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/memcheck/tests/varinfo6.vgtest 2008-02-27 01:47:41 UTC (rev 7486)
@@ -1 +1,2 @@
prog: varinfo6
+vgopts: --read-var-info=yes
Modified: branches/DATASYMS/none/tests/cmdline2.stdout.exp
===================================================================
--- branches/DATASYMS/none/tests/cmdline2.stdout.exp 2008-02-26 19:53:11 UTC (rev 7485)
+++ branches/DATASYMS/none/tests/cmdline2.stdout.exp 2008-02-27 01:47:41 UTC (rev 7486)
@@ -63,6 +63,7 @@
--trace-sched=no|yes show thread scheduler details? [no]
--wait-for-gdb=yes|no pause on startup to wait for gdb attach
--sym-offsets=yes|no show syms in form 'name+offset' ? [no]
+ --read-var-info=yes|no read variable type & location info? [no]
--command-line-only=no|yes only use command line options [no]
--vex-iropt-verbosity 0 .. 9 [0]
|