From: Nicholas Nethercote Date: Sun, 16 Apr 2006 10:25:43 +0000 (+0000) Subject: Remove tool-specific code (which says which tools allow XML) from the core X-Git-Tag: svn/VALGRIND_3_2_0~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a7237d77b368cec2924029991516b38d1a87e7f;p=thirdparty%2Fvalgrind.git Remove tool-specific code (which says which tools allow XML) from the core by introducing a new "need": VG_(needs_xml_output)(). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5854 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index bc0b591fb5..8b5a1d3e07 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -912,7 +912,7 @@ static void usage_NORETURN ( Bool debug_help ) " handle non-standard kernel variants\n" "\n" " user options for Valgrind tools that report errors:\n" -" --xml=yes all output is in XML (Memcheck/Nulgrind only)\n" +" --xml=yes all output is in XML (some tools only)\n" " --xml-user-comment=STR copy STR verbatim to XML output\n" " --demangle=no|yes automatically demangle C++ names? [yes]\n" " --num-callers= show callers in stack traces [12]\n" @@ -1457,11 +1457,10 @@ static Bool process_cmd_line_options( UInt* client_auxv, const char* toolname ) /* Check that the requested tool actually supports XML output. */ - if (VG_(clo_xml) && !VG_STREQ(toolname, "memcheck") - && !VG_STREQ(toolname, "none")) { + if (VG_(clo_xml) && !VG_(needs).xml_output) { VG_(clo_xml) = False; VG_(message)(Vg_UserMsg, - "Currently only Memcheck|None supports XML output."); + "%s does not support XML output.", VG_(details).name); VG_(bad_option)("--xml=yes"); /*NOTREACHED*/ } diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 359408bbee..dd941efad5 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -93,6 +93,7 @@ VgNeeds VG_(needs) = { .sanity_checks = False, .data_syms = False, .malloc_replacement = False, + .xml_output = False, }; /* static */ @@ -161,6 +162,7 @@ Bool VG_(sanity_check_needs)(Char** failmsg) NEEDS(libc_freeres) NEEDS(core_errors) NEEDS(data_syms) +NEEDS(xml_output) void VG_(needs_basic_block_discards)( void (*discard)(Addr64, VexGuestExtents) diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 58666287eb..7746fee0e6 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -90,6 +90,7 @@ typedef Bool sanity_checks; Bool data_syms; Bool malloc_replacement; + Bool xml_output; } VgNeeds; diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index b059ae1827..f33375676b 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -766,7 +766,7 @@ that can report errors, e.g. Memcheck, but not Cachegrind. When enabled, output will be in XML format. This is aimed at making life easier for tools that consume Valgrind's output as input, such as GUI front ends. Currently this option only works - with Memcheck and Nulgrind. + with Memcheck. diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index 7ae35d1063..6f70836bfd 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -138,9 +138,6 @@ extern void VG_(details_bug_reports_to) ( Char* bug_reports_to ); /* ------------------------------------------------------------------ */ /* Needs */ -/* Booleans that decide core behaviour, but don't require extra - operations to be defined if `True' */ - /* Should __libc_freeres() be run? Bugs in it can crash the tool. */ extern void VG_(needs_libc_freeres) ( void ); @@ -299,6 +296,11 @@ extern void VG_(needs_malloc_replacement)( SizeT client_malloc_redzone_szB ); +/* Can the tool do XML output? This is a slight misnomer, because the tool + * is not requesting the core to do anything, rather saying "I can handle + * it". */ +extern void VG_(needs_xml_output)( void ); + /* ------------------------------------------------------------------ */ /* Core events to track */ diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 6286dbdeb3..0ee073b25a 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -4330,7 +4330,6 @@ static void mc_pre_clo_init(void) VG_(needs_client_requests) (mc_handle_client_request); VG_(needs_sanity_checks) (mc_cheap_sanity_check, mc_expensive_sanity_check); - VG_(needs_malloc_replacement) (MC_(malloc), MC_(__builtin_new), MC_(__builtin_vec_new), @@ -4341,6 +4340,7 @@ static void mc_pre_clo_init(void) MC_(__builtin_vec_delete), MC_(realloc), MC_MALLOC_REDZONE_SZB ); + VG_(needs_xml_output) (); VG_(track_new_mem_startup) ( mc_new_mem_startup ); VG_(track_new_mem_stack_signal)( MC_(make_mem_undefined) ); diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index 6ceb817e17..1338d918e3 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -27,7 +27,7 @@ usage: valgrind [options] prog-and-args handle non-standard kernel variants user options for Valgrind tools that report errors: - --xml=yes all output is in XML (Memcheck/Nulgrind only) + --xml=yes all output is in XML (some tools only) --xml-user-comment=STR copy STR verbatim to XML output --demangle=no|yes automatically demangle C++ names? [yes] --num-callers= show callers in stack traces [12] diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 69a4e27cce..f1fc904abd 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -27,7 +27,7 @@ usage: valgrind [options] prog-and-args handle non-standard kernel variants user options for Valgrind tools that report errors: - --xml=yes all output is in XML (Memcheck/Nulgrind only) + --xml=yes all output is in XML (some tools only) --xml-user-comment=STR copy STR verbatim to XML output --demangle=no|yes automatically demangle C++ names? [yes] --num-callers= show callers in stack traces [12]