-##---------------------------------------------------------------------------
-## These test core error checking, eg. "silly values" for malloc/calloc,
-## pthread errors (and suppressions), signal handling errors, invalid fds for
-## blocking syscalls, etc.
-##---------------------------------------------------------------------------
-
noinst_SCRIPTS = filter_stderr
-
-EXTRA_DIST = $(noinst_SCRIPTS) \
- erringfds.stderr.exp erringfds.stdout.exp erringfds.vgtest \
- sigkill.stderr.exp sigkill.stderr.exp2 sigkill.vgtest \
- stack_changes.vgtest
-
-check_PROGRAMS = \
- erringfds sigkill stack_changes
-
-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -O0
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CXXFLAGS = $(AM_CFLAGS)
-
-sigkill_SOURCES = sigkill.c
-
-# Stack tests
-stack_changes_SOURCES = stack_changes.c
+++ /dev/null
-
-Warning: invalid file descriptor -1 in syscall read()
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
/*--- Helper fns ---*/
/*------------------------------------------------------------*/
+// Only show core errors if the tool wants to, we're not running with -q,
+// and were not outputting XML.
+Bool VG_(showing_core_errors)(void)
+{
+ return VG_(needs).core_errors && VG_(clo_verbosity) >= 1 && !VG_(clo_xml);
+}
+
/* Compare error contexts, to detect duplicates. Note that if they
are otherwise the same, the faulting addrs and associated rwoffsets
are allowed to be different. */
return VG_(mk_SysRes_Success)( 0 );
bad_signo:
- if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
- && !VG_(clo_xml)) {
+ if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: bad signal number %d in sigaction()",
signo);
return VG_(mk_SysRes_Error)( VKI_EINVAL );
bad_signo_reserved:
- if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
- && !VG_(clo_xml)) {
+ if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: ignored attempt to set %s handler in sigaction();",
signame(signo));
return VG_(mk_SysRes_Error)( VKI_EINVAL );
bad_sigkill_or_sigstop:
- if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
- && !VG_(clo_xml)) {
+ if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: ignored attempt to set %s handler in sigaction();",
signame(signo));
#include "pub_core_debuginfo.h" // Needed for pub_core_aspacemgr :(
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
+#include "pub_core_errormgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
/* Return true if we're allowed to use or create this fd */
Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft)
{
- if (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) {
+ if ((fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) &&
+ VG_(showing_core_errors)())
+ {
VG_(message)(Vg_UserMsg,
"Warning: invalid file descriptor %d in syscall %s()",
fd, syscallname);
+
/*--------------------------------------------------------------------*/
/*--- ErrorMgr: management of errors and suppressions. ---*/
/*--- pub_core_errormgr.h ---*/
extern Bool VG_(is_action_requested) ( Char* action, Bool* clo );
+extern Bool VG_(showing_core_errors) ( void );
+
extern UInt VG_(get_n_errs_found) ( void );
#endif // __PUB_CORE_ERRORMGR_H
extern void VG_(needs_libc_freeres) ( void );
/* Want to have errors detected by Valgrind's core reported? Includes:
- - pthread API errors (many; eg. unlocking a non-locked mutex)
- - invalid file descriptors to blocking syscalls read() and write()
+ - pthread API errors (many; eg. unlocking a non-locked mutex)
+ [currently disabled]
+ - invalid file descriptors to syscalls like read() and write()
- bad signal numbers passed to sigaction()
- attempt to install signal handler for SIGKILL or SIGSTOP */
extern void VG_(needs_core_errors) ( void );
custom_alloc.stderr.exp custom_alloc.vgtest \
describe-block.stderr.exp describe-block.vgtest \
doublefree.stderr.exp doublefree.vgtest \
+ erringfds.stderr.exp erringfds.stdout.exp erringfds.vgtest \
error_counts.stderr.exp error_counts.stdout.exp error_counts.vgtest \
errs1.stderr.exp errs1.vgtest \
exitprog.stderr.exp exitprog.vgtest \
realloc2.stderr.exp realloc2.vgtest \
realloc3.stderr.exp realloc3.vgtest \
sigaltstack.stderr.exp sigaltstack.vgtest \
+ sigkill.stderr.exp sigkill.stderr.exp2 sigkill.vgtest \
signal2.stderr.exp signal2.stdout.exp signal2.vgtest \
sigprocmask.stderr.exp sigprocmask.vgtest \
+ stack_changes.stderr.exp stack_changes.stdout.exp stack_changes.vgtest \
strchr.stderr.exp strchr.vgtest \
str_tester.stderr.exp str_tester.vgtest \
supp1.stderr.exp supp1.vgtest \
badloop badpoll badrw brk brk2 buflen_check \
clientperm custom_alloc \
describe-block \
- doublefree error_counts errs1 exitprog execve execve2 \
+ doublefree error_counts errs1 exitprog execve execve2 erringfds \
fprw fwrite hello inits inline \
leak-0 leak-cycle leak-tree leak-regroot leakotron \
malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
pointer-trace \
post-syscall \
realloc1 realloc2 realloc3 \
- sigaltstack signal2 sigprocmask \
- strchr str_tester supp1 supp2 suppfree \
+ sigaltstack signal2 sigprocmask sigkill \
+ stack_changes strchr str_tester supp1 supp2 suppfree \
trivialleak weirdioctl \
mismatches new_override metadata \
vgtest_ume xml1 \
AM_CXXFLAGS = $(AM_CFLAGS)
# C ones
-addressable_SOURCES = addressable.c
-badaddrvalue_SOURCES = badaddrvalue.c
-badfree_SOURCES = badfree.c
-badjump_SOURCES = badjump.c
-badjump2_SOURCES = badjump2.c
-badloop_SOURCES = badloop.c
-badpoll_SOURCES = badpoll.c
-badrw_SOURCES = badrw.c
-brk_SOURCES = brk.c
-brk2_SOURCES = brk2.c
-buflen_check_SOURCES = buflen_check.c
-clientperm_SOURCES = clientperm.c
+#addressable_SOURCES = addressable.c
+#badaddrvalue_SOURCES = badaddrvalue.c
+#badfree_SOURCES = badfree.c
+#badjump_SOURCES = badjump.c
+#badjump2_SOURCES = badjump2.c
+#badloop_SOURCES = badloop.c
+#badpoll_SOURCES = badpoll.c
+#badrw_SOURCES = badrw.c
+#brk_SOURCES = brk.c
+#brk2_SOURCES = brk2.c
+#buflen_check_SOURCES = buflen_check.c
+#clientperm_SOURCES = clientperm.c
custom_alloc_SOURCES = custom_alloc.c
describe_block_SOURCES = describe-block.c
doublefree_SOURCES = doublefree.c
overlap_SOURCES = overlap.c
# Don't allow GCC to inline memcpy(), because then we can't intercept it
overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy
-pointer_trace_SOURCES = pointer-trace.c
+#pointer_trace_SOURCES = pointer-trace.c
post_syscall_SOURCES = post-syscall.c
realloc1_SOURCES = realloc1.c
realloc2_SOURCES = realloc2.c
realloc3_SOURCES = realloc3.c
+sigkill_SOURCES = sigkill.c
signal2_SOURCES = signal2.c
sigprocmask_SOURCES = sigprocmask.c
+stack_changes_SOURCES = stack_changes.c
supp1_SOURCES = supp.c
supp2_SOURCES = supp.c
suppfree_SOURCES = suppfree.c
--- /dev/null
+
+Warning: invalid file descriptor -1 in syscall read()
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v