]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd, XML: make the XML output a little easier to parse
authorBart Van Assche <bvanassche@acm.org>
Thu, 13 Oct 2011 16:42:49 +0000 (16:42 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 13 Oct 2011 16:42:49 +0000 (16:42 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12144

drd/drd_error.c
drd/tests/annotate_barrier_xml.stderr.exp
drd/tests/annotate_trace_memory_xml.stderr.exp

index de433a0fba0728e02cf66d9dc0ce2da061527774..334c020d8accb06ea879f726ee336001c8d976ce 100644 (file)
@@ -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 ? "  <what>" : "";
    const char* const what_suffix = xml ? "</what>" : "";
+   const char* const auxwhat_prefix = xml ? "  <auxwhat>" : "";
+   const char* const auxwhat_suffix = xml ? "</auxwhat>" : "";
    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("  <auxwhat>\n    <text>");
-      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("</text>\n");
+         print_err_detail("  <allocation_context>\n");
       else
          print_err_detail(" Allocation context:\n");
       VG_(pp_ExeContext)(ai.lastchange);
       if (xml)
-         print_err_detail("  </auxwhat>\n");
+         print_err_detail("  </allocation_context>\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("  <auxwhat><text>");
-         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("  </text></auxwhat>\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)
index 63355da0ef7e0b4c69005a9ed68d62b2b4560403..4b884b24da6f8d386e9fda6747690b79ecb0a921 100644 (file)
       <line>...</line>
     </frame>
   </stack>
-  <auxwhat>
-    <text>Address 0x........ is at offset 0 from 0x.........</text>
+  <auxwhat>Address 0x........ is at offset 0 from 0x.........</auxwhat>
+  <allocation_context>
   <stack>
     <frame>
       <ip>0x........</ip>
       <line>...</line>
     </frame>
   </stack>
-  </auxwhat>
+  </allocation_context>
 </error>
 
 <error>
index 71cdf0364b491bfc9fb04c33251bb9dc2b6f2ba6..618019459843d36907447d0e7efc4c516072ed8c 100644 (file)
@@ -96,8 +96,7 @@ test01: positive
       <line>...</line>
     </frame>
   </stack>
-  <auxwhat><text>      Allocation context: BSS section of tsan_unittest
-  </text></auxwhat>
+  <auxwhat>Allocation context: BSS section of tsan_unittest</auxwhat>
 </error>
 
 <traceline>