|
From: Ashley P. <as...@qu...> - 2007-02-14 16:02:02
|
Hello,
This patch fixes up a oversight in the xml code, if the program dies
with a fatal signal the error message displayed isn't wrapped in xml
tags so it's impossible for external tools to load this information.
This patch puts <error></error> tags around it similar to how other
errors are displayed.
Currently:
Process terminating with default action of signal 11 (SIGSEGV): dumping core
Access not within mapped region at address 0x2
<stack>
<frame>
<ip>0x8048332</ip>
<obj>/tmp/a.out</obj>
<fn>main</fn>
</frame>
</stack>
With patch:
<error>
<tid>1</tid>
<kind>Signal</kind>
<signal>11</signal>
<what>Process terminating with default action of signal 11 (SIGSEGV): dumping core</what>
<event>Access not within mapped region</event>
<address>0x2</address>
<stack>
<frame>
<ip>0x8048332</ip>
<obj>/tmp/a.out</obj>
<fn>main</fn>
</frame>
</stack>
</error>
Ashley,
$ svn diff coregrind/m_signals.c
Index: coregrind/m_signals.c
===================================================================
--- coregrind/m_signals.c (revision 6536)
+++ coregrind/m_signals.c (working copy)
@@ -1206,11 +1206,21 @@
}
if (VG_(clo_verbosity) > 1 || (could_core && info->si_code > VKI_SI_USER)) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "Process terminating with default action of signal %d (%s)%s",
- sigNo, signame(sigNo), core ? ": dumping core" : "");
-
+ if (VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, "<error>");
+ VG_(message)(Vg_UserMsg, " <tid>%d</tid>", tid);
+ VG_(message)(Vg_UserMsg, " <kind>Signal</kind>");
+ VG_(message)(Vg_UserMsg, " <signal>%d</signal>",sigNo);
+ VG_(message)(Vg_UserMsg,
+ " <what>Process terminating with default action of signal %d (%s)%s</what>",
+ sigNo, signame(sigNo), core ? ": dumping core" : "");
+ } else {
+ VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg,
+ "Process terminating with default action of signal %d (%s)%s",
+ sigNo, signame(sigNo), core ? ": dumping core" : "");
+ }
+
/* Be helpful - decode some more details about this fault */
if (info->si_code > VKI_SI_USER) {
const Char *event = NULL;
@@ -1276,17 +1286,27 @@
}
if (event != NULL) {
- if (haveaddr)
- VG_(message)(Vg_UserMsg, " %s at address %p",
- event, info->VKI_SIGINFO_si_addr);
- else
- VG_(message)(Vg_UserMsg, " %s", event);
+ if (VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, " <event>%s</event>", event);
+ if (haveaddr)
+ VG_(message)(Vg_UserMsg, " <address>%p</address>",
+ info->VKI_SIGINFO_si_addr);
+ } else {
+ if (haveaddr)
+ VG_(message)(Vg_UserMsg, " %s at address %p",
+ event, info->VKI_SIGINFO_si_addr);
+ else
+ VG_(message)(Vg_UserMsg, " %s", event);
+ }
}
}
if (tid != VG_INVALID_THREADID) {
VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
}
+ if (VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, "</error>");
+ }
}
if (VG_(is_action_requested)( "Attach to debugger", & VG_(clo_db_attach) )) {
|