diff --git a/NEWS b/NEWS
index b68d3c49d..2988e47aa 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,7 @@ To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
where XXXXXX is the bug number as listed below.
+191069 report fatal signal in XML output
278744 cvtps2pd with redundant RexW
353083 arm64 doesn't implement various xattr system calls
353084 arm64 doesn't support sigpending system call
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index db756cb36..f029c2ab5 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -1740,14 +1740,26 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
core = False;
}
- if ( (VG_(clo_verbosity) >= 1 ||
- (could_core && is_signal_from_kernel(tid, sigNo, info->si_code))
- ) &&
- !VG_(clo_xml) ) {
- VG_(umsg)(
- "\n"
- "Process terminating with default action of signal %d (%s)%s\n",
- sigNo, VG_(signame)(sigNo), core ? ": dumping core" : "");
+ if ( VG_(clo_verbosity) >= 1
+ || (could_core && is_signal_from_kernel(tid, sigNo, info->si_code))
+ || VG_(clo_xml) ) {
+ if (VG_(clo_xml)) {
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)(" %d\n", tid);
+ ThreadState* tst = VG_(get_ThreadState)(tid);
+ if (tst->thread_name) {
+ VG_(printf_xml)(" %s\n",
+ tst->thread_name);
+ }
+ VG_(printf_xml)(" %d\n", sigNo);
+ VG_(printf_xml)(" %s\n", VG_(signame)(sigNo));
+ VG_(printf_xml)(" %d\n", info->si_code);
+ } else {
+ VG_(umsg)(
+ "\n"
+ "Process terminating with default action of signal %d (%s)%s\n",
+ sigNo, VG_(signame)(sigNo), core ? ": dumping core" : "");
+ }
/* Be helpful - decode some more details about this fault */
if (is_signal_from_kernel(tid, sigNo, info->si_code)) {
@@ -1820,13 +1832,21 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
break;
} /* switch (sigNo) */
- if (event != NULL) {
- if (haveaddr)
- VG_(umsg)(" %s at address %p\n",
- event, info->VKI_SIGINFO_si_addr);
- else
- VG_(umsg)(" %s\n", event);
- }
+ if (VG_(clo_xml)) {
+ if (event != NULL)
+ VG_(printf_xml)(" %s\n", event);
+ if (haveaddr)
+ VG_(printf_xml)(" %p\n",
+ info->VKI_SIGINFO_si_addr);
+ } else {
+ if (event != NULL) {
+ if (haveaddr)
+ VG_(umsg)(" %s at address %p\n",
+ event, info->VKI_SIGINFO_si_addr);
+ else
+ VG_(umsg)(" %s\n", event);
+ }
+ }
}
/* Print a stack trace. Be cautious if the thread's SP is in an
obviously stupid place (not mapped readable) that would
@@ -1845,8 +1865,8 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
if (tid == 1) { // main thread
Addr esp = VG_(get_SP)(tid);
Addr base = VG_PGROUNDDN(esp - VG_STACK_REDZONE_SZB);
- if (VG_(am_addr_is_in_extensible_client_stack)(base) &&
- VG_(extend_stack)(tid, base)) {
+ if (VG_(am_addr_is_in_extensible_client_stack)(base)
+ && VG_(extend_stack)(tid, base)) {
if (VG_(clo_trace_signals))
VG_(dmsg)(" -> extended stack base to %#lx\n",
VG_PGROUNDDN(esp));
@@ -1889,6 +1909,11 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
VG_(threads)[1].client_stack_szB);
}
}
+ if (VG_(clo_xml)) {
+ /* postamble */
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)("\n");
+ }
}
if (VG_(clo_vgdb) != Vg_VgdbNo
@@ -2683,8 +2708,8 @@ static Bool extend_stack_if_appropriate(ThreadId tid, vki_siginfo_t* info)
then extend the stack segment.
*/
Addr base = VG_PGROUNDDN(esp - VG_STACK_REDZONE_SZB);
- if (VG_(am_addr_is_in_extensible_client_stack)(base) &&
- VG_(extend_stack)(tid, base)) {
+ if (VG_(am_addr_is_in_extensible_client_stack)(base)
+ && VG_(extend_stack)(tid, base)) {
if (VG_(clo_trace_signals))
VG_(dmsg)(" -> extended stack base to %#lx\n",
VG_PGROUNDDN(fault));
@@ -2783,11 +2808,11 @@ void sync_signalhandler ( Int sigNo,
vg_assert(info != NULL);
vg_assert(info->si_signo == sigNo);
- vg_assert(sigNo == VKI_SIGSEGV ||
- sigNo == VKI_SIGBUS ||
- sigNo == VKI_SIGFPE ||
- sigNo == VKI_SIGILL ||
- sigNo == VKI_SIGTRAP);
+ vg_assert(sigNo == VKI_SIGSEGV
+ || sigNo == VKI_SIGBUS
+ || sigNo == VKI_SIGFPE
+ || sigNo == VKI_SIGILL
+ || sigNo == VKI_SIGTRAP);
info->si_code = sanitize_si_code(info->si_code);
diff --git a/docs/internals/xml-output-protocol4.txt b/docs/internals/xml-output-protocol4.txt
index ccb22b44d..50828c0a1 100644
--- a/docs/internals/xml-output-protocol4.txt
+++ b/docs/internals/xml-output-protocol4.txt
@@ -743,3 +743,53 @@ OR
* STACK is only present in case of VALGRIND_PRINTF_BACKTRACE. See above
for a definition of STACK.
+
+====================================================================
+
+FATAL_SIGNAL
+
+FATAL_SIGNAL defines a message that was caused by a signal that killed them
+process.
+
+Definition:
+
+
+ INT
+ NAME if set
+
+ INT
+ NAME
+
+ INT
+ NAME
+ ADDR
+
+ STACK
+
+
+
+* The tag indicates the Valgrind thread number. This value
+ is arbitrary but may be used to determine which threads produced
+ which errors (at least, the first instance of each error).
+
+* The tag identifies the name of the thread if it was
+ set by the client application. If no name was set, the tag is
+ omitted.
+
+* The tag indicates signo value from struct siginfo.
+
+* In tag there is the decoded name of signo.
+
+* The tag contains the sicode from struct siginfo.
+
+* The tag indicates the decoded name of the sicode. If sicode
+ has no name, the tag is omitted.
+
+* The tag indicates the address that is the reason
+ why the signal was triggered. This can be an unaligned pointer value or
+ just the address of not mapped memory that is accessed nevertheless.
+ If the signal reason is not related to an address, the tag is omitted.
+
+* STACK is defined above and shows where the thread was when it
+ catched the signal. When sending the signal to itself using raise,
+ then raise is visible in this stack.
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
index 0f341279a..2e4b24386 100644
--- a/memcheck/tests/Makefile.am
+++ b/memcheck/tests/Makefile.am
@@ -297,7 +297,8 @@ EXTRA_DIST = \
writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \
xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc \
threadname.vgtest threadname.stderr.exp \
- threadname_xml.vgtest threadname_xml.stderr.exp
+ threadname_xml.vgtest threadname_xml.stderr.exp \
+ gone_abrt_xml.vgtest gone_abrt_xml.stderr.exp
check_PROGRAMS = \
accounting \
diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp b/memcheck/tests/gone_abrt_xml.stderr.exp
new file mode 100644
index 000000000..b0faf73bd
--- /dev/null
+++ b/memcheck/tests/gone_abrt_xml.stderr.exp
@@ -0,0 +1,63 @@
+
+
+
+
+4
+memcheck
+
+
+ ...
+ ...
+ ...
+ ...
+
+
+...
+...
+memcheck
+
+
+ ...
+
+ ./../../gdbserver_tests/gone
+ abort
+
+
+
+
+ RUNNING
+
+
+
+starting ...
+aborting ...
+
+ ...
+ 6
+ SIGABRT
+ 0
+
+
+ 0x........
+ ...
+ main
+ ...
+ gone.c
+ ...
+
+
+
+
+
+
+ FINISHED
+
+
+
+
+
+
+...
+
+
+
diff --git a/memcheck/tests/gone_abrt_xml.vgtest b/memcheck/tests/gone_abrt_xml.vgtest
new file mode 100644
index 000000000..dc18192d1
--- /dev/null
+++ b/memcheck/tests/gone_abrt_xml.vgtest
@@ -0,0 +1,5 @@
+prog: ../../gdbserver_tests/gone
+args: abort
+vgopts: --xml=yes --xml-fd=2 --log-file=/dev/null
+stderr_filter: filter_xml
+cleanup: rm -f vgcore.*