From: Bart Van Assche Date: Thu, 13 Oct 2011 16:42:49 +0000 (+0000) Subject: drd, XML: make the XML output a little easier to parse X-Git-Tag: svn/VALGRIND_3_7_0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef91802c741fb1a3a9eda85c5d0c003bd68ecceb;p=thirdparty%2Fvalgrind.git drd, XML: make the XML output a little easier to parse git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12144 --- diff --git a/drd/drd_error.c b/drd/drd_error.c index de433a0fba..334c020d8a 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -138,6 +138,8 @@ void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) const Bool xml = VG_(clo_xml); const char* const what_prefix = xml ? " " : ""; const char* const what_suffix = xml ? "" : ""; + const char* const auxwhat_prefix = xml ? " " : ""; + const char* const auxwhat_suffix = xml ? "" : ""; const char* const indent = xml ? " " : ""; AddrInfo ai; @@ -190,39 +192,30 @@ void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) if (descr2 != NULL) print_err_detail("%s%s\n", indent, (HChar*)VG_(indexXA)(descr2, 0)); } else if (ai.akind == eMallocd && ai.lastchange) { + print_err_detail("%sAddress 0x%lx is at offset %ld from 0x%lx.%s%s", + auxwhat_prefix, dri->addr, ai.rwoffset, + dri->addr - ai.rwoffset, auxwhat_suffix, + xml ? "\n" : ""); if (xml) - print_err_detail(" \n "); - print_err_detail("Address 0x%lx is at offset %ld from 0x%lx.", - dri->addr, ai.rwoffset, dri->addr - ai.rwoffset); - if (xml) - print_err_detail("\n"); + print_err_detail(" \n"); else print_err_detail(" Allocation context:\n"); VG_(pp_ExeContext)(ai.lastchange); if (xml) - print_err_detail(" \n"); + print_err_detail(" \n"); } else { char sect_name[64]; VgSectKind sect_kind; sect_kind = VG_(DebugInfo_sect_kind)(sect_name, sizeof(sect_name), dri->addr); - if (xml) { - print_err_detail(" "); - if (sect_kind != Vg_SectUnknown) { - print_err_detail(" Allocation context: %pS section of %pS\n", - VG_(pp_SectKind)(sect_kind), sect_name); - } else { - print_err_detail(" Allocation context: unknown.\n"); - } - print_err_detail(" \n"); + if (sect_kind != Vg_SectUnknown) { + print_err_detail("%sAllocation context: %ps section of %ps%s\n", + auxwhat_prefix, VG_(pp_SectKind)(sect_kind), + sect_name, auxwhat_suffix); } else { - if (sect_kind != Vg_SectUnknown) { - print_err_detail("Allocation context: %s section of %s\n", - VG_(pp_SectKind)(sect_kind), sect_name); - } else { - print_err_detail("Allocation context: unknown.\n"); - } + print_err_detail("%sAllocation context: unknown.%s\n", + auxwhat_prefix, auxwhat_suffix); } } if (s_show_conflicting_segments) diff --git a/drd/tests/annotate_barrier_xml.stderr.exp b/drd/tests/annotate_barrier_xml.stderr.exp index 63355da0ef..4b884b24da 100644 --- a/drd/tests/annotate_barrier_xml.stderr.exp +++ b/drd/tests/annotate_barrier_xml.stderr.exp @@ -194,8 +194,8 @@ ... - - Address 0x........ is at offset 0 from 0x......... + Address 0x........ is at offset 0 from 0x......... + 0x........ @@ -222,7 +222,7 @@ ... - + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp b/drd/tests/annotate_trace_memory_xml.stderr.exp index 71cdf0364b..6180194598 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp @@ -96,8 +96,7 @@ test01: positive ... - Allocation context: BSS section of tsan_unittest - + Allocation context: BSS section of tsan_unittest