]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD support, patch 7
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 6 Oct 2021 20:58:15 +0000 (22:58 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 6 Oct 2021 20:58:15 +0000 (22:58 +0200)
tests directory
configure.ac to generate tests/filter_discards and tests/filter_stderr_basic
.gitignore to ignore these generated filters

.gitignore
configure.ac
tests/arch_test.c
tests/filter_discards [deleted file]
tests/filter_discards.in [new file with mode: 0755]
tests/filter_libc
tests/filter_stderr_basic.in [moved from tests/filter_stderr_basic with 72% similarity]
tests/malloc.h
tests/platform_test

index 05b0b040b22d9da0b033af68890bccf09d6a2685..bb8578d6802de6fb99653c024a173cb3e820bdd0 100644 (file)
 
 # /tests/
 /tests/*.dSYM
+/tests/filter_discards
+/tests/filter_stderr_basic
 /tests/.deps
 /tests/Makefile
 /tests/Makefile.in
index 27400ad1e59fd0b37fdfbe97110fd5727107fd52..0398aafa1c82f7b9a9e0a7507921db40c8cca88e 100755 (executable)
@@ -5060,6 +5060,10 @@ AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
                 [chmod +x coregrind/link_tool_exe_darwin])
 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
                 [chmod +x coregrind/link_tool_exe_solaris])
+AC_CONFIG_FILES([tests/filter_stderr_basic],
+                [chmod +x tests/filter_stderr_basic])
+AC_CONFIG_FILES([tests/filter_discards],
+                [chmod +x tests/filter_discards])
 AC_OUTPUT
 
 cat<<EOF
index f132ea3c03329880121255a371d0e3da482418dc..37cc1bc76d62ad89ae467e066ba3651666881dde 100644 (file)
@@ -40,11 +40,11 @@ char* all_archs[] = {
 static Bool go(char* arch)
 { 
 #if defined(VGP_x86_linux) || defined(VGP_x86_darwin) \
-   || defined(VGP_x86_solaris)
+   || defined(VGP_x86_solaris) || defined(VGP_x86_freebsd)
    if ( 0 == strcmp( arch, "x86"   ) ) return True;
 
 #elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) \
-   || defined(VGP_amd64_solaris)
+   || defined(VGP_amd64_solaris) || defined(VGP_amd64_freebsd)
 #if defined(VGA_SEC_x86)
    if ( 0 == strcmp( arch, "x86"   ) ) return True;
 #endif
diff --git a/tests/filter_discards b/tests/filter_discards
deleted file mode 100755 (executable)
index df98d45..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh
-
-dir=`dirname $0`
-
-# Remove number and position of discards
-sed "s/discard [0-9]\+ ([0-9]\+ -> [0-9]\+) translations in range/discard ... (... -> ...) translations in range/"     |
-
-$dir/filter_addresses
diff --git a/tests/filter_discards.in b/tests/filter_discards.in
new file mode 100755 (executable)
index 0000000..05e8236
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+dir=`dirname $0`
+
+SED=@SED@
+
+
+# Remove number and position of discards
+$SED "s/discard [0-9]\+ ([0-9]\+ -> [0-9]\+) translations in range/discard ... (... -> ...) translations in range/"     |
+
+$dir/filter_addresses
index 8eb9911cb0308ba9320396b463439174ea7f516a..4f097903a3bf99a2b5807bd0c8e517321d73d73a 100755 (executable)
@@ -1,6 +1,7 @@
-#! /usr/bin/perl -w
+#!/usr/bin/env perl
 
 use strict;
+use warnings;
 
 while (<>)
 {
@@ -20,6 +21,9 @@ while (<>)
     # libc, on some (eg. Darwin) it will be in the main executable.
     s/\(below main\) \(.+\)$/(below main)/;
 
+    # libc on x86 FreeBSD
+    s#_start1 \(src/lib/csu/i386/crt1_c.c.*#(below main)#;
+
     # filter out the exact libc-start.c:### line number. (ppc64*)
     s/\(libc-start.c:[0-9]*\)$/(in \/...libc...)/;
 
similarity index 72%
rename from tests/filter_stderr_basic
rename to tests/filter_stderr_basic.in
index 4b6e4806be6e6cee9fb7dba514690097a76ce321..fc1d19b35b5f7769b5425f51cb493d8d5c2f16aa 100755 (executable)
@@ -1,5 +1,7 @@
 #! /bin/sh
 
+SED=@SED@
+
 # This filter should be applied to *every* stderr result.  It removes
 # Valgrind startup stuff and pid numbers.
 #
@@ -18,14 +20,14 @@ perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' |
 
 # Remove "Command: line".  (If wrapping occurs, it won't remove the
 # subsequent lines...)
-sed "/^Command: .*$/d" |
+$SED "/^Command: .*$/d" |
 
 # Remove "WARNING: assuming toc 0x.." strings
-sed "/^WARNING: assuming toc 0x*/d" |
+$SED "/^WARNING: assuming toc 0x*/d" |
 
 # Remove "Using Valgrind-$VERSION and LibVEX..." line.
 # Tools have to filter their own line themselves.
-sed "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" |
+$SED "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" |
 
 # Anonymise line numbers in vg_replace_malloc.c, remove dirname if present
 perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" |
@@ -34,13 +36,13 @@ perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:
 perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" |
 
 # Hide suppressed error counts
-sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" |
+$SED "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" |
 
 # Reduce some libc incompatibility
 $dir/filter_libc |
 
 # Remove line info out of order warnings
-sed "/warning: line info addresses out of order/d" |
+$SED "/warning: line info addresses out of order/d" |
 
 # Older bash versions print abnormal termination messages on the stderr
 # of the bash process. Newer bash versions redirect such messages properly.
@@ -53,20 +55,20 @@ perl -n -e 'print if !/^(Memory fault|Killed) $/' |
 
 # Translate intercepted glibc functions back to their canonical name
 perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:.*?\)/: memcpy \(vg_replace_strmem.c:...\)/" |
-sed -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\|_sse2\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" |
+$SED -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\|_sse2\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" |
 
 # Remove any ": dumping core" message as the user might have a
 # limit set that prevents the core dump
-sed "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" |
+$SED "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" |
 
 # Remove the size in "The main thread stack size..." message.
-sed "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" |
+$SED "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" |
 
 # Remove the size in "10482464 bytes below stack pointer" message.
-sed "s/[0-9][0-9]* bytes below stack pointer/.... bytes below stack pointer/" |
+$SED "s/[0-9][0-9]* bytes below stack pointer/.... bytes below stack pointer/" |
 
 # Suppress warnings from incompatible debug info
-sed '/warning: the debug information found in "[^"]*" does not match/d' |
+$SED '/warning: the debug information found in "[^"]*" does not match/d' |
 
 # Suppress warnings from Dwarf reader
-sed '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d'
+$SED '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d'
index 146790e3c7e48db08a4523559bd9434108c3af73..a64abbf2d79439134907d551fa33679dbdf7c3a8 100644 (file)
@@ -1,8 +1,12 @@
 // Replacement for malloc.h which factors out platform differences.
 
 #include <stdlib.h>
+#include "config.h"
 #if defined(VGO_darwin)
 #  include <malloc/malloc.h>
+#elif defined(VGO_freebsd)
+#  include <stdlib.h>
+#  include <malloc_np.h>
 #else
 #  include <malloc.h>
 #endif
@@ -14,7 +18,7 @@ __attribute__((unused))
 static void* memalign16(size_t szB)
 {
    void* x;
-#if defined(VGO_darwin)
+#if defined(VGO_darwin) || defined(VGO_freebsd)
    // Darwin lacks memalign, but its malloc is always 16-aligned anyway.
    posix_memalign((void **)&x, 16, szB);
 #else
@@ -30,7 +34,7 @@ __attribute__((unused))
 static void* memalign32(size_t szB)
 {
    void* x;
-#if defined(VGO_darwin)
+#if defined(VGO_darwin) || defined(VGO_freebsd)
    // Darwin lacks memalign
    posix_memalign((void **)&x, 32, szB);
 #else
@@ -46,7 +50,7 @@ __attribute__((unused))
 static void* memalign64(size_t szB)
 {
    void* x;
-#if defined(VGO_darwin)
+#if defined(VGO_darwin) || defined(VGO_freebsd)
    // Darwin lacks memalign
    posix_memalign((void **)&x, 64, szB);
 #else
index 376f62eb4120770f50de3fde7c06f134ac15a227..c23a4f64538a58739e6ef1fc6835f016aaef0ada 100644 (file)
@@ -16,6 +16,7 @@ all_platforms="$all_platforms arm-linux arm64-linux"
 all_platforms="$all_platforms s390x-linux mips32-linux mips64-linux"
 all_platforms="$all_platforms x86-darwin amd64-darwin"
 all_platforms="$all_platforms x86-solaris amd64-solaris"
+all_platforms="$all_platforms x86-freebsd amd64-freebsd"
 
 if [ $# -ne 2 ] ; then
     echo "usage: platform_test <arch-type> <OS-type>"