You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(23) |
2
(15) |
|
3
|
4
|
5
|
6
|
7
(3) |
8
(22) |
9
(12) |
|
10
|
11
|
12
(1) |
13
(13) |
14
(4) |
15
(12) |
16
|
|
17
(5) |
18
(13) |
19
(6) |
20
(10) |
21
(17) |
22
|
23
(3) |
|
24
(18) |
25
(17) |
26
(12) |
27
|
28
(1) |
29
(3) |
30
(12) |
|
From: Mark W. <mj...@re...> - 2013-11-17 19:47:08
|
On Sun, Nov 17, 2013 at 07:59:45PM +0100, Florian Krohm wrote: > I've been looking some more at running valgrind on binaries compiled by > clang 3.3 -- mainly by running regression tests. Most of the failures I > see there had this cause: > > parse_var_DIE: confused by: > <0><b>: DW_TAG_compile_unit > DW_AT_producer : (indirect string, offset: 0x........): clang > version 3.3 (tags/RELEASE_33/final) > DW_AT_language : 12 > DW_AT_name : (indirect string, offset: 0x........): > free_is_write.c > DW_AT_low_pc : 0x........ > DW_AT_stmt_list : 0 > DW_AT_comp_dir : (indirect string, offset: 0x........): ... > > The assert is thrown because upon reaching the sanity checks in > readwarf.c:1740 we have this: > > have_lo = true > have_hi1 = false > have_range = false > > and that causes the assertion. The patch below works around this but I > won't pretend that I know what I'm doing here.. Is this sensible? This is a bug in clang apparently, see also https://bugs.kde.org/show_bug.cgi?id=306340 It isn't valid DWARF, you do need either, no range at all, a single range (with DW_AT_high_pc) or multiple ranges (with DW_AT_ranges). With only DW_AT_low_pc your patch might be the best we can do. Assume the CU doesn't really describe an code ranges. Does the CU really not contain any DIEs that describe code ranges? If they do, then theoretically we could scan the full CU and create the ranges that way, but that is very expensive. It might be good to print a warning. And file a bug upstream against the compiler. Working around it with your patch (and maybe a warning) might sadly be the only thing we can do since it isn't just clang that gets this wrong. icc also seems to have a similar DWARF output bug sometimes: https://bugs.kde.org/show_bug.cgi?id=317698 Cheers, Mark |
|
From: Florian K. <fl...@ei...> - 2013-11-17 18:59:57
|
I've been looking some more at running valgrind on binaries compiled by
clang 3.3 -- mainly by running regression tests. Most of the failures I
see there had this cause:
parse_var_DIE: confused by:
<0><b>: DW_TAG_compile_unit
DW_AT_producer : (indirect string, offset: 0x........): clang
version 3.3 (tags/RELEASE_33/final)
DW_AT_language : 12
DW_AT_name : (indirect string, offset: 0x........):
free_is_write.c
DW_AT_low_pc : 0x........
DW_AT_stmt_list : 0
DW_AT_comp_dir : (indirect string, offset: 0x........): ...
The assert is thrown because upon reaching the sanity checks in
readwarf.c:1740 we have this:
have_lo = true
have_hi1 = false
have_range = false
and that causes the assertion. The patch below works around this but I
won't pretend that I know what I'm doing here.. Is this sensible?
I reran the regressions with this patch and there are no longer
assertions about invalid DIEs.
Thanks,
Florian
Index: coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- coregrind/m_debuginfo/readdwarf3.c (revision 13714)
+++ coregrind/m_debuginfo/readdwarf3.c (working copy)
@@ -1758,6 +1758,14 @@
level,
False/*isFunc*/, NULL/*fbGX*/ );
} else
+ // clang generates this
+ if ((have_lo) && (!have_hi1) && (!have_range)) {
+ /* CU has no code, presumably? */
+ varstack_push( cc, parser, td3,
+ empty_range_list(),
+ level,
+ False/*isFunc*/, NULL/*fbGX*/ );
+ } else
if (have_lo && (!have_hi1) && have_range && ip_lo == 0) {
/* broken DIE created by gcc-4.3.X ? Ignore the
apparently-redundant DW_AT_low_pc and use the DW_AT_ranges
|
|
From: Bart V. A. <bva...@ac...> - 2013-11-17 13:06:06
|
There is quite some duplicate code in mc_replace_strmem.c, hg_intercepts.c
and drd_strmem_intercepts.c, hence this patch that merges these files. This
patch moves memcheck/mc_replace_strmem.c to shared/vg_replace_strmem.c and
adds several intercepts for SSE-variants. Include that source file from
drd/drd_strmem_intercepts.c, helgrind/hg_intercepts.c and
memcheck/mc_replace_strmem.c. The test filters that depend on the file
name of the file with the intercept code are updated.
---
drd/drd_strmem_intercepts.c | 508 +---------
helgrind/hg_intercepts.c | 196 +---
memcheck/mc_replace_strmem.c | 1762 +-------------------------------
memcheck/tests/Makefile.am | 3 +-
memcheck/tests/filter_memcheck | 2 +-
memcheck/tests/filter_memcpy | 8 -
memcheck/tests/filter_strchr | 8 +-
memcheck/tests/memcmptest.stderr.exp | 2 +-
memcheck/tests/overlap.stderr.exp | 14 +-
memcheck/tests/overlap.vgtest | 1 -
memcheck/tests/strchr.stderr.exp | 10 +-
shared/vg_replace_strmem.c | 1836 ++++++++++++++++++++++++++++++++++
tests/check_headers_and_includes | 1 +
tests/filter_stderr_basic | 5 +
14 files changed, 1861 insertions(+), 2495 deletions(-)
delete mode 100755 memcheck/tests/filter_memcpy
create mode 100644 shared/vg_replace_strmem.c
diff --git a/drd/drd_strmem_intercepts.c b/drd/drd_strmem_intercepts.c
index 3e4bf08..139117c 100644
--- a/drd/drd_strmem_intercepts.c
+++ b/drd/drd_strmem_intercepts.c
@@ -30,510 +30,4 @@
The GNU General Public License is contained in the file COPYING.
*/
-#include "pub_tool_basics.h"
-#include "pub_tool_hashtable.h"
-#include "pub_tool_redir.h"
-#include "pub_tool_tooliface.h"
-#include "pub_tool_clreq.h"
-
-
-/*---------------------- strrchr ----------------------*/
-
-#define STRRCHR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ); \
- char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ) \
- { \
- HChar ch = (HChar)c; \
- const HChar* p = s; \
- const HChar* last = NULL; \
- while (True) { \
- if (*p == ch) last = p; \
- if (*p == 0) return (HChar *)last; \
- p++; \
- } \
- }
-
-// Apparently rindex() is the same thing as strrchr()
-#if defined(VGO_linux)
- STRRCHR(VG_Z_LIBC_SONAME, strrchr)
- STRRCHR(VG_Z_LIBC_SONAME, rindex)
- STRRCHR(VG_Z_LIBC_SONAME, __GI_strrchr)
- STRRCHR(VG_Z_LIBC_SONAME, __strrchr_sse2)
- STRRCHR(VG_Z_LIBC_SONAME, __strrchr_sse2_no_bsf)
- STRRCHR(VG_Z_LIBC_SONAME, __strrchr_sse42)
- STRRCHR(VG_Z_LD_LINUX_SO_2, rindex)
-#if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android)
- STRRCHR(NONE, __dl_strrchr); /* in /system/bin/linker */
-#endif
-#elif defined(VGO_darwin)
- //STRRCHR(VG_Z_LIBC_SONAME, strrchr)
- //STRRCHR(VG_Z_LIBC_SONAME, rindex)
- //STRRCHR(VG_Z_DYLD, strrchr)
- //STRRCHR(VG_Z_DYLD, rindex)
- STRRCHR(VG_Z_LIBC_SONAME, strrchr)
-#endif
-
-
-/*---------------------- strchr ----------------------*/
-
-#define STRCHR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s, int c); \
- char* VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s, int c) \
- { \
- HChar ch = (HChar)c; \
- const HChar* p = s; \
- while (True) { \
- if (*p == ch) return (HChar *)p; \
- if (*p == 0) return NULL; \
- p++; \
- } \
- }
-
-// Apparently index() is the same thing as strchr()
-#if defined(VGO_linux)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
- STRCHR(VG_Z_LIBC_SONAME, __GI_strchr)
- STRCHR(VG_Z_LIBC_SONAME, __strchr_sse2)
- STRCHR(VG_Z_LIBC_SONAME, __strchr_sse2_no_bsf)
- STRCHR(VG_Z_LIBC_SONAME, index)
- STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_SO_2, index)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, index)
-#elif defined(VGO_darwin)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
- STRCHR(VG_Z_LIBC_SONAME, index)
-#endif
-
-
-/*---------------------- strnlen ----------------------*/
-
-#define STRNLEN(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ) \
- { \
- SizeT i = 0; \
- while (i < n && str[i] != 0) i++; \
- return i; \
- }
-
-#if defined(VGO_linux)
- STRNLEN(VG_Z_LIBC_SONAME, strnlen)
-#elif defined(VGO_darwin)
- STRNLEN(VG_Z_LIBC_SONAME, strnlen)
-#endif
-
-
-/*---------------------- strlen ----------------------*/
-
-// Note that this replacement often doesn't get used because gcc inlines
-// calls to strlen() with its own built-in version. This can be very
-// confusing if you aren't expecting it. Other small functions in this file
-// may also be inline by gcc.
-#define STRLEN(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ); \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ) \
- { \
- SizeT i = 0; \
- while (str[i] != 0) i++; \
- return i; \
- }
-
-#if defined(VGO_linux)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
- STRLEN(VG_Z_LIBC_SONAME, __GI_strlen)
- STRLEN(VG_Z_LIBC_SONAME, __strlen_sse2)
- STRLEN(VG_Z_LIBC_SONAME, __strlen_sse2_no_bsf)
- STRLEN(VG_Z_LIBC_SONAME, __strlen_sse42)
- STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
- STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
-#elif defined(VGO_darwin)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
-#endif
-
-
-/*---------------------- strcpy ----------------------*/
-
-#define STRCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_ZU(soname, fnname)(char* dst, const char* src); \
- char* VG_REPLACE_FUNCTION_ZU(soname, fnname)(char* dst, const char* src) \
- { \
- HChar* dst_orig = dst; \
- \
- while (*src) *dst++ = *src++; \
- *dst = 0; \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
- STRCPY(VG_Z_LIBC_SONAME, __GI_strcpy)
-#elif defined(VGO_darwin)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
-#endif
-
-
-/*---------------------- strncpy ----------------------*/
-
-#define STRNCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20090,soname,fnname) \
- (char* dst, const char* src, SizeT n); \
- char* VG_REPLACE_FUNCTION_EZU(20090,soname,fnname) \
- (char* dst, const char* src, SizeT n) \
- { \
- HChar* dst_orig = dst; \
- SizeT m = 0; \
- \
- while (m < n && *src) { m++; *dst++ = *src++; } \
- while (m++ < n) *dst++ = 0; /* must pad remainder with nulls */ \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRNCPY(VG_Z_LIBC_SONAME, strncpy)
- STRNCPY(VG_Z_LIBC_SONAME, __GI_strncpy)
- STRNCPY(VG_Z_LIBC_SONAME, __strncpy_sse2)
- STRNCPY(VG_Z_LIBC_SONAME, __strncpy_sse2_unaligned)
-#elif defined(VGO_darwin)
- //STRNCPY(VG_Z_LIBC_SONAME, strncpy)
- //STRNCPY(VG_Z_DYLD, strncpy)
- STRNCPY(VG_Z_LIBC_SONAME, strncpy)
-#endif
-
-
-/*---------------------- strncmp ----------------------*/
-
-#define STRNCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20110,soname,fnname) \
- (const char* s1, const char* s2, SizeT nmax); \
- int VG_REPLACE_FUNCTION_EZU(20110,soname,fnname) \
- (const char* s1, const char* s2, SizeT nmax) \
- { \
- SizeT n = 0; \
- while (True) { \
- if (n >= nmax) return 0; \
- if (*s1 == 0 && *s2 == 0) return 0; \
- if (*s1 == 0) return -1; \
- if (*s2 == 0) return 1; \
- \
- if (*(const UChar*)s1 < *(const UChar*)s2) return -1; \
- if (*(const UChar*)s1 > *(const UChar*)s2) return 1; \
- \
- s1++; s2++; n++; \
- } \
- }
-
-#if defined(VGO_linux)
- STRNCMP(VG_Z_LIBC_SONAME, strncmp)
- STRNCMP(VG_Z_LIBC_SONAME, __GI_strncmp)
- STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse2)
- STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse42)
-#elif defined(VGO_darwin)
- //STRNCMP(VG_Z_LIBC_SONAME, strncmp)
- //STRNCMP(VG_Z_DYLD, strncmp)
- STRNCMP(VG_Z_LIBC_SONAME, strncmp)
-#endif
-
-
-/*---------------------- strcmp ----------------------*/
-
-#define STRCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s1, const char* s2); \
- int VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s1, const char* s2) \
- { \
- register UChar c1; \
- register UChar c2; \
- while (True) { \
- c1 = *(UChar *)s1; \
- c2 = *(UChar *)s2; \
- if (c1 != c2) break; \
- if (c1 == 0) break; \
- s1++; s2++; \
- } \
- if ((UChar)c1 < (UChar)c2) return -1; \
- if ((UChar)c1 > (UChar)c2) return 1; \
- return 0; \
- }
-
-#if defined(VGO_linux)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
- STRCMP(VG_Z_LIBC_SONAME, __GI_strcmp)
- STRCMP(VG_Z_LIBC_SONAME, __strcmp_sse2)
- STRCMP(VG_Z_LIBC_SONAME, __strcmp_sse42)
- STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
- STRCMP(VG_Z_LD64_SO_1, strcmp)
-#elif defined(VGO_darwin)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
-#endif
-
-
-/*---------------------- memchr ----------------------*/
-
-#define MEMCHR(soname, fnname) \
- void* VG_REPLACE_FUNCTION_EZU(20170,soname,fnname) \
- (const void *s, int c, SizeT n); \
- void* VG_REPLACE_FUNCTION_EZU(20170,soname,fnname) \
- (const void *s, int c, SizeT n) \
- { \
- SizeT i; \
- UChar c0 = (UChar)c; \
- UChar* p = (UChar*)s; \
- for (i = 0; i < n; i++) \
- if (p[i] == c0) return (void*)(&p[i]); \
- return NULL; \
- }
-
-#if defined(VGO_linux)
- MEMCHR(VG_Z_LIBC_SONAME, memchr)
- MEMCHR(VG_Z_LIBC_SONAME, __GI_memchr)
-#elif defined(VGO_darwin)
- //MEMCHR(VG_Z_LIBC_SONAME, memchr)
- //MEMCHR(VG_Z_DYLD, memchr)
-#endif
-
-
-/*---------------------- memrchr ----------------------*/
-
-#define MEMRCHR(soname, fnname) \
- void* VG_REPLACE_FUNCTION_EZU(20360,soname,fnname) \
- (const void *s, int c, SizeT n); \
- void* VG_REPLACE_FUNCTION_EZU(20360,soname,fnname) \
- (const void *s, int c, SizeT n) \
- { \
- SizeT i; \
- UChar c0 = (UChar)c; \
- UChar* p = (UChar*)s; \
- for (i = 0; i < n; i++) \
- if (p[n-1-i] == c0) return (void*)(&p[n-1-i]); \
- return NULL; \
- }
-
-#if defined(VGO_linux)
- MEMRCHR(VG_Z_LIBC_SONAME, memrchr)
-#elif defined(VGO_darwin)
- //MEMRCHR(VG_Z_LIBC_SONAME, memrchr)
- //MEMRCHR(VG_Z_DYLD, memrchr)
-#endif
-
-
-/*---------------------- memcpy ----------------------*/
-
-#define MEMCPY(soname, fnname) \
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- (void *dst, const void *src, SizeT len); \
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- (void *dst, const void *src, SizeT len) \
- { \
- const Addr WS = sizeof(UWord); /* 8 or 4 */ \
- const Addr WM = WS - 1; /* 7 or 3 */ \
- \
- if (len > 0) { \
- if (dst < src) { \
- \
- /* Copying backwards. */ \
- SizeT n = len; \
- Addr d = (Addr)dst; \
- Addr s = (Addr)src; \
- \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Pull up to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { *(UShort*)d = *(UShort*)s; s += 2; d += 2; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- \
- } else if (dst > src) { \
- \
- SizeT n = len; \
- Addr d = ((Addr)dst) + n; \
- Addr s = ((Addr)src) + n; \
- \
- /* Copying forwards. */ \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Back down to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { s -= 2; d -= 2; *(UShort*)d = *(UShort*)s; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- \
- } \
- } \
- \
- return dst; \
- }
-
-#if defined(VGO_linux)
- MEMCPY(VG_Z_LIBC_SONAME, memcpy)
- MEMCPY(VG_Z_LIBC_SONAME, __GI_memcpy)
- MEMCPY(VG_Z_LIBC_SONAME, __memcpy_sse2)
- MEMCPY(VG_Z_LD_SO_1, memcpy) /* ld.so.1 */
- MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64.so.1 */
- /* icc9 blats these around all over the place. Not only in the main
- executable but various .so's. They are highly tuned and read
- memory beyond the source boundary (although work correctly and
- never go across page boundaries), so give errors when run
- natively, at least for misaligned source arg. Just intercepting
- in the exe only until we understand more about the problem. See
- http://bugs.kde.org/show_bug.cgi?id=139776
- */
- MEMCPY(NONE, _intel_fast_memcpy)
-
-#elif defined(VGO_darwin)
-# if DARWIN_VERS <= DARWIN_10_6
- MEMCPY(VG_Z_LIBC_SONAME, memcpy)
-# endif
- MEMCPY(VG_Z_LIBC_SONAME, memcpyZDVARIANTZDsse3x) /* memcpy$VARIANT$sse3x */
- MEMCPY(VG_Z_LIBC_SONAME, memcpyZDVARIANTZDsse42) /* memcpy$VARIANT$sse42 */
-
-#endif
-
-
-/*---------------------- memcmp ----------------------*/
-
-#define MEMCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20190,soname,fnname) \
- (const void *s1V, const void *s2V, SizeT n); \
- int VG_REPLACE_FUNCTION_EZU(20190,soname,fnname) \
- (const void *s1V, const void *s2V, SizeT n) \
- { \
- int res; \
- UChar a0; \
- UChar b0; \
- const UChar* s1 = s1V; \
- const UChar* s2 = s2V; \
- \
- while (n != 0) { \
- a0 = s1[0]; \
- b0 = s2[0]; \
- s1 += 1; \
- s2 += 1; \
- res = ((int)a0) - ((int)b0); \
- if (res != 0) \
- return res; \
- n -= 1; \
- } \
- return 0; \
- }
-
-#if defined(VGO_linux)
- MEMCMP(VG_Z_LIBC_SONAME, memcmp)
- MEMCMP(VG_Z_LIBC_SONAME, __GI_memcmp)
- MEMCMP(VG_Z_LIBC_SONAME, __memcmp_sse2)
- MEMCMP(VG_Z_LIBC_SONAME, __memcmp_sse4_1)
- MEMCMP(VG_Z_LIBC_SONAME, bcmp)
- MEMCMP(VG_Z_LD_SO_1, bcmp)
-#elif defined(VGO_darwin)
- //MEMCMP(VG_Z_LIBC_SONAME, memcmp)
- //MEMCMP(VG_Z_LIBC_SONAME, bcmp)
- //MEMCMP(VG_Z_DYLD, memcmp)
- //MEMCMP(VG_Z_DYLD, bcmp)
-#endif
-
-
-/*---------------------- stpcpy ----------------------*/
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in
- DEST. (minor variant of strcpy) */
-#define STPCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20200,soname,fnname) \
- (char* dst, const char* src); \
- char* VG_REPLACE_FUNCTION_EZU(20200,soname,fnname) \
- (char* dst, const char* src) \
- { \
- while (*src) *dst++ = *src++; \
- *dst = 0; \
- \
- return dst; \
- }
-
-#if defined(VGO_linux)
- STPCPY(VG_Z_LIBC_SONAME, stpcpy)
- STPCPY(VG_Z_LIBC_SONAME, __GI_stpcpy)
- STPCPY(VG_Z_LIBC_SONAME, __stpcpy_sse2)
- STPCPY(VG_Z_LIBC_SONAME, __stpcpy_sse2_unaligned)
- STPCPY(VG_Z_LD_LINUX_SO_2, stpcpy)
- STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
-#elif defined(VGO_darwin)
- //STPCPY(VG_Z_LIBC_SONAME, stpcpy)
- //STPCPY(VG_Z_DYLD, stpcpy)
-#endif
-
-
-/*---------------------- strstr ----------------------*/
-
-#define STRSTR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
- (const char* haystack, const char* needle); \
- char* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
- (const char* haystack, const char* needle) \
- { \
- const HChar* h = haystack; \
- const HChar* n = needle; \
- \
- /* find the length of n, not including terminating zero */ \
- UWord nlen = 0; \
- while (n[nlen]) nlen++; \
- \
- /* if n is the empty string, match immediately. */ \
- if (nlen == 0) return (HChar *)h; \
- \
- /* assert(nlen >= 1); */ \
- HChar n0 = n[0]; \
- \
- while (1) { \
- const HChar hh = *h; \
- if (hh == 0) return NULL; \
- if (hh != n0) { h++; continue; } \
- \
- UWord i; \
- for (i = 0; i < nlen; i++) { \
- if (n[i] != h[i]) \
- break; \
- } \
- /* assert(i >= 0 && i <= nlen); */ \
- if (i == nlen) \
- return (HChar *)h; \
- \
- h++; \
- } \
- }
-
-#if defined(VGO_linux)
- STRSTR(VG_Z_LIBC_SONAME, strstr)
- STRSTR(VG_Z_LIBC_SONAME, __strstr_sse2)
- STRSTR(VG_Z_LIBC_SONAME, __strstr_sse42)
-#elif defined(VGO_darwin)
-#endif
-
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
+#include "../shared/vg_replace_strmem.c"
diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c
index 05b709c..5f02e5b 100644
--- a/helgrind/hg_intercepts.c
+++ b/helgrind/hg_intercepts.c
@@ -2434,201 +2434,7 @@ QT5_FUNC(void*, _ZN6QMutexD2Ev, void* self)
/*--- overrun the input arrays. ---*/
/*----------------------------------------------------------------*/
-/* Copied verbatim from memcheck/mc_replace_strmem.c. When copying
- new functions, please keep them in the same order as they appear in
- mc_replace_strmem.c. */
-
-
-#define STRCHR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ); \
- char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ) \
- { \
- HChar ch = (HChar)c ; \
- const HChar* p = s; \
- while (True) { \
- if (*p == ch) return (HChar *)p; \
- if (*p == 0) return NULL; \
- p++; \
- } \
- }
-
-// Apparently index() is the same thing as strchr()
-#if defined(VGO_linux)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
- STRCHR(VG_Z_LIBC_SONAME, index)
- STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_SO_2, index)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, index)
-#elif defined(VGO_darwin)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
- STRCHR(VG_Z_LIBC_SONAME, index)
-#endif
-
-
-// Note that this replacement often doesn't get used because gcc inlines
-// calls to strlen() with its own built-in version. This can be very
-// confusing if you aren't expecting it. Other small functions in this file
-// may also be inline by gcc.
-#define STRLEN(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ); \
- SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ) \
- { \
- SizeT i = 0; \
- while (str[i] != 0) i++; \
- return i; \
- }
-
-#if defined(VGO_linux)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
- STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
- STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
-#elif defined(VGO_darwin)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
-#endif
-
-
-#define STRCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ); \
- char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ) \
- { \
- HChar* dst_orig = dst; \
- \
- while (*src) *dst++ = *src++; \
- *dst = 0; \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
-#elif defined(VGO_darwin)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
-#endif
-
-
-#define STRCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- ( const char* s1, const char* s2 ); \
- int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- ( const char* s1, const char* s2 ) \
- { \
- register UChar c1; \
- register UChar c2; \
- while (True) { \
- c1 = *(UChar *)s1; \
- c2 = *(UChar *)s2; \
- if (c1 != c2) break; \
- if (c1 == 0) break; \
- s1++; s2++; \
- } \
- if ((UChar)c1 < (UChar)c2) return -1; \
- if ((UChar)c1 > (UChar)c2) return 1; \
- return 0; \
- }
-
-#if defined(VGO_linux)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
- STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
- STRCMP(VG_Z_LD64_SO_1, strcmp)
-#elif defined(VGO_darwin)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
-#endif
-
-
-#define MEMCPY(soname, fnname) \
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- ( void *dst, const void *src, SizeT len ); \
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
- ( void *dst, const void *src, SizeT len ) \
- { \
- const Addr WS = sizeof(UWord); /* 8 or 4 */ \
- const Addr WM = WS - 1; /* 7 or 3 */ \
- \
- if (len > 0) { \
- if (dst < src) { \
- \
- /* Copying backwards. */ \
- SizeT n = len; \
- Addr d = (Addr)dst; \
- Addr s = (Addr)src; \
- \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Pull up to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { *(UShort*)d = *(UShort*)s; s += 2; d += 2; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- \
- } else if (dst > src) { \
- \
- SizeT n = len; \
- Addr d = ((Addr)dst) + n; \
- Addr s = ((Addr)src) + n; \
- \
- /* Copying forwards. */ \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Back down to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { s -= 2; d -= 2; *(UShort*)d = *(UShort*)s; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- \
- } \
- } \
- \
- return dst; \
- }
-
-#if defined(VGO_linux)
- MEMCPY(VG_Z_LIBC_SONAME, memcpy)
- MEMCPY(VG_Z_LD_SO_1, memcpy) /* ld.so.1 */
- MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64.so.1 */
- /* icc9 blats these around all over the place. Not only in the main
- executable but various .so's. They are highly tuned and read
- memory beyond the source boundary (although work correctly and
- never go across page boundaries), so give errors when run
- natively, at least for misaligned source arg. Just intercepting
- in the exe only until we understand more about the problem. See
- http://bugs.kde.org/show_bug.cgi?id=139776
- */
- MEMCPY(NONE, _intel_fast_memcpy)
-
-#elif defined(VGO_darwin)
-# if DARWIN_VERS <= DARWIN_10_6
- MEMCPY(VG_Z_LIBC_SONAME, memcpy)
-# endif
- MEMCPY(VG_Z_LIBC_SONAME, memcpyZDVARIANTZDsse3x) /* memcpy$VARIANT$sse3x */
- MEMCPY(VG_Z_LIBC_SONAME, memcpyZDVARIANTZDsse42) /* memcpy$VARIANT$sse42 */
-
-#endif
-
+#include "../shared/vg_replace_strmem.c"
/*--------------------------------------------------------------------*/
/*--- end hg_intercepts.c ---*/
diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c
index 912b494..d9f52af 100644
--- a/memcheck/mc_replace_strmem.c
+++ b/memcheck/mc_replace_strmem.c
@@ -40,1769 +40,9 @@
#include "mc_include.h"
#include "memcheck.h"
-/* ---------------------------------------------------------------------
- We have our own versions of these functions for two reasons:
- (a) it allows us to do overlap checking
- (b) some of the normal versions are hyper-optimised, which fools
- Memcheck and cause spurious value warnings. Our versions are
- simpler.
-
- Note that overenthusiastic use of PLT bypassing by the glibc people also
- means that we need to patch multiple versions of some of the functions to
- our own implementations.
-
- THEY RUN ON THE SIMD CPU!
- ------------------------------------------------------------------ */
-
-/* Assignment of behavioural equivalence class tags: 2NNNP is intended
- to be reserved for Memcheck. Current usage:
-
- 20010 STRRCHR
- 20020 STRCHR
- 20030 STRCAT
- 20040 STRNCAT
- 20050 STRLCAT
- 20060 STRNLEN
- 20070 STRLEN
- 20080 STRCPY
- 20090 STRNCPY
- 20100 STRLCPY
- 20110 STRNCMP
- 20120 STRCASECMP
- 20130 STRNCASECMP
- 20140 STRCASECMP_L
- 20150 STRNCASECMP_L
- 20160 STRCMP
- 20170 MEMCHR
-
- 20180 MEMCPY if there's a conflict between memcpy and
- 20181 MEMMOVE memmove, prefer memmove
-
- 20190 MEMCMP
- 20200 STPCPY
- 20210 MEMSET
- 2022P unused (was previously MEMMOVE)
- 20230 BCOPY
- 20240 GLIBC25___MEMMOVE_CHK
- 20250 GLIBC232_STRCHRNUL
- 20260 GLIBC232_RAWMEMCHR
- 20270 GLIBC25___STRCPY_CHK
- 20280 GLIBC25___STPCPY_CHK
- 20290 GLIBC25_MEMPCPY
- 20300 GLIBC26___MEMCPY_CHK
- 20310 STRSTR
- 20320 STRPBRK
- 20330 STRCSPN
- 20340 STRSPN
- 20350 STRCASESTR
- 20360 MEMRCHR
- 20370 WCSLEN
- 20380 WCSCMP
- 20390 WCSCPY
- 20400 WCSCHR
- 20410 WCSRCHR
- 20420 STPNCPY
-*/
-
-
-/* Figure out if [dst .. dst+dstlen-1] overlaps with
- [src .. src+srclen-1].
- We assume that the address ranges do not wrap around
- (which is safe since on Linux addresses >= 0xC0000000
- are not accessible and the program will segfault in this
- circumstance, presumably).
-*/
-static inline
-Bool is_overlap ( void* dst, const void* src, SizeT dstlen, SizeT srclen )
-{
- Addr loS, hiS, loD, hiD;
-
- if (dstlen == 0 || srclen == 0)
- return False;
-
- loS = (Addr)src;
- loD = (Addr)dst;
- hiS = loS + srclen - 1;
- hiD = loD + dstlen - 1;
-
- /* So figure out if [loS .. hiS] overlaps with [loD .. hiD]. */
- if (loS < loD) {
- return !(hiS < loD);
- }
- else if (loD < loS) {
- return !(hiD < loS);
- }
- else {
- /* They start at same place. Since we know neither of them has
- zero length, they must overlap. */
- return True;
- }
-}
-
-
-/* Call here to exit if we can't continue. On Android we can't call
- _exit for some reason, so we have to blunt-instrument it. */
-__attribute__ ((__noreturn__))
-static inline void my_exit ( int x )
-{
-# if defined(VGPV_arm_linux_android)
- __asm__ __volatile__(".word 0xFFFFFFFF");
- while (1) {}
-# elif defined(VGPV_x86_linux_android)
- __asm__ __volatile__("ud2");
- while (1) {}
-# else
- extern __attribute__ ((__noreturn__)) void _exit(int status);
- _exit(x);
-# endif
-}
-
-
-// This is a macro rather than a function because we don't want to have an
-// extra function in the stack trace.
#define RECORD_OVERLAP_ERROR(s, src, dst, len) \
VALGRIND_DO_CLIENT_REQUEST_STMT( \
_VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR, \
s, src, dst, len, 0)
-
-/*---------------------- strrchr ----------------------*/
-
-#define STRRCHR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ); \
- char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ) \
- { \
- HChar ch = (HChar)c; \
- const HChar* p = s; \
- const HChar* last = NULL; \
- while (True) { \
- if (*p == ch) last = p; \
- if (*p == 0) return (HChar *)last; \
- p++; \
- } \
- }
-
-// Apparently rindex() is the same thing as strrchr()
-#if defined(VGO_linux)
- STRRCHR(VG_Z_LIBC_SONAME, strrchr)
- STRRCHR(VG_Z_LIBC_SONAME, rindex)
- STRRCHR(VG_Z_LIBC_SONAME, __GI_strrchr)
- STRRCHR(VG_Z_LD_LINUX_SO_2, rindex)
-#if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android)
- STRRCHR(NONE, __dl_strrchr); /* in /system/bin/linker */
-#endif
-
-#elif defined(VGO_darwin)
- //STRRCHR(VG_Z_LIBC_SONAME, strrchr)
- //STRRCHR(VG_Z_LIBC_SONAME, rindex)
- //STRRCHR(VG_Z_DYLD, strrchr)
- //STRRCHR(VG_Z_DYLD, rindex)
- STRRCHR(VG_Z_LIBC_SONAME, strrchr)
-
-#endif
-
-
-/*---------------------- strchr ----------------------*/
-
-#define STRCHR(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20020,soname,fnname) ( const char* s, int c ); \
- char* VG_REPLACE_FUNCTION_EZU(20020,soname,fnname) ( const char* s, int c ) \
- { \
- HChar ch = (HChar)c ; \
- const HChar* p = s; \
- while (True) { \
- if (*p == ch) return (HChar *)p; \
- if (*p == 0) return NULL; \
- p++; \
- } \
- }
-
-// Apparently index() is the same thing as strchr()
-#if defined(VGO_linux)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
- STRCHR(VG_Z_LIBC_SONAME, index)
- STRCHR(VG_Z_LIBC_SONAME, __GI_strchr)
-# if !defined(VGP_x86_linux)
- STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_SO_2, index)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)
- STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, index)
-# endif
-
-#elif defined(VGO_darwin)
- //STRCHR(VG_Z_LIBC_SONAME, strchr)
- //STRCHR(VG_Z_LIBC_SONAME, index)
- //STRCHR(VG_Z_DYLD, strchr)
- //STRCHR(VG_Z_DYLD, index)
- STRCHR(VG_Z_LIBC_SONAME, strchr)
-
-#endif
-
-
-/*---------------------- strcat ----------------------*/
-
-#define STRCAT(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20030,soname,fnname) \
- ( char* dst, const char* src ); \
- char* VG_REPLACE_FUNCTION_EZU(20030,soname,fnname) \
- ( char* dst, const char* src ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- while (*dst) dst++; \
- while (*src) *dst++ = *src++; \
- *dst = 0; \
- \
- /* This is a bit redundant, I think; any overlap and the strcat will */ \
- /* go forever... or until a seg fault occurs. */ \
- if (is_overlap(dst_orig, \
- src_orig, \
- (Addr)dst-(Addr)dst_orig+1, \
- (Addr)src-(Addr)src_orig+1)) \
- RECORD_OVERLAP_ERROR("strcat", dst_orig, src_orig, 0); \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRCAT(VG_Z_LIBC_SONAME, strcat)
- STRCAT(VG_Z_LIBC_SONAME, __GI_strcat)
-
-#elif defined(VGO_darwin)
- //STRCAT(VG_Z_LIBC_SONAME, strcat)
-
-#endif
-
-
-/*---------------------- strncat ----------------------*/
-
-#define STRNCAT(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20040,soname,fnname) \
- ( char* dst, const char* src, SizeT n ); \
- char* VG_REPLACE_FUNCTION_EZU(20040,soname,fnname) \
- ( char* dst, const char* src, SizeT n ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- SizeT m = 0; \
- \
- while (*dst) dst++; \
- while (m < n && *src) { m++; *dst++ = *src++; } /* concat <= n chars */ \
- *dst = 0; /* always add null */ \
- \
- /* This checks for overlap after copying, unavoidable without */ \
- /* pre-counting lengths... should be ok */ \
- if (is_overlap(dst_orig, \
- src_orig, \
- (Addr)dst-(Addr)dst_orig+1, \
- (Addr)src-(Addr)src_orig+1)) \
- RECORD_OVERLAP_ERROR("strncat", dst_orig, src_orig, n); \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRNCAT(VG_Z_LIBC_SONAME, strncat)
-
-#elif defined(VGO_darwin)
- //STRNCAT(VG_Z_LIBC_SONAME, strncat)
- //STRNCAT(VG_Z_DYLD, strncat)
-
-#endif
-
-
-/*---------------------- strlcat ----------------------*/
-
-/* Append src to dst. n is the size of dst's buffer. dst is guaranteed
- to be nul-terminated after the copy, unless n <= strlen(dst_orig).
- Returns min(n, strlen(dst_orig)) + strlen(src_orig).
- Truncation occurred if retval >= n.
-*/
-#define STRLCAT(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_EZU(20050,soname,fnname) \
- ( char* dst, const char* src, SizeT n ); \
- SizeT VG_REPLACE_FUNCTION_EZU(20050,soname,fnname) \
- ( char* dst, const char* src, SizeT n ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- SizeT m = 0; \
- \
- while (m < n && *dst) { m++; dst++; } \
- if (m < n) { \
- /* Fill as far as dst_orig[n-2], then nul-terminate. */ \
- while (m < n-1 && *src) { m++; *dst++ = *src++; } \
- *dst = 0; \
- } else { \
- /* No space to copy anything to dst. m == n */ \
- } \
- /* Finish counting min(n, strlen(dst_orig)) + strlen(src_orig) */ \
- while (*src) { m++; src++; } \
- /* This checks for overlap after copying, unavoidable without */ \
- /* pre-counting lengths... should be ok */ \
- if (is_overlap(dst_orig, \
- src_orig, \
- (Addr)dst-(Addr)dst_orig+1, \
- (Addr)src-(Addr)src_orig+1)) \
- RECORD_OVERLAP_ERROR("strlcat", dst_orig, src_orig, n); \
- \
- return m; \
- }
-
-#if defined(VGO_linux)
-
-#elif defined(VGO_darwin)
- //STRLCAT(VG_Z_LIBC_SONAME, strlcat)
- //STRLCAT(VG_Z_DYLD, strlcat)
- STRLCAT(VG_Z_LIBC_SONAME, strlcat)
-
-#endif
-
-
-/*---------------------- strnlen ----------------------*/
-
-#define STRNLEN(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_EZU(20060,soname,fnname) \
- ( const char* str, SizeT n ); \
- SizeT VG_REPLACE_FUNCTION_EZU(20060,soname,fnname) \
- ( const char* str, SizeT n ) \
- { \
- SizeT i = 0; \
- while (i < n && str[i] != 0) i++; \
- return i; \
- }
-
-#if defined(VGO_linux)
- STRNLEN(VG_Z_LIBC_SONAME, strnlen)
- STRNLEN(VG_Z_LIBC_SONAME, __GI_strnlen)
-
-#elif defined(VGO_darwin)
- //STRNLEN(VG_Z_LIBC_SONAME, strnlen)
-
-#endif
-
-
-/*---------------------- strlen ----------------------*/
-
-// Note that this replacement often doesn't get used because gcc inlines
-// calls to strlen() with its own built-in version. This can be very
-// confusing if you aren't expecting it. Other small functions in
-// this file may also be inline by gcc.
-
-#define STRLEN(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_EZU(20070,soname,fnname) \
- ( const char* str ); \
- SizeT VG_REPLACE_FUNCTION_EZU(20070,soname,fnname) \
- ( const char* str ) \
- { \
- SizeT i = 0; \
- while (str[i] != 0) i++; \
- return i; \
- }
-
-#if defined(VGO_linux)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
- STRLEN(VG_Z_LIBC_SONAME, __GI_strlen)
-# if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android)
- STRLEN(NONE, __dl_strlen); /* in /system/bin/linker */
-# endif
-
-#elif defined(VGO_darwin)
- //STRLEN(VG_Z_LIBC_SONAME, strlen)
- STRLEN(VG_Z_LIBC_SONAME, strlen)
-
-#endif
-
-
-/*---------------------- strcpy ----------------------*/
-
-#define STRCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20080,soname,fnname) \
- ( char* dst, const char* src ); \
- char* VG_REPLACE_FUNCTION_EZU(20080,soname,fnname) \
- ( char* dst, const char* src ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- \
- while (*src) *dst++ = *src++; \
- *dst = 0; \
- \
- /* This checks for overlap after copying, unavoidable without */ \
- /* pre-counting length... should be ok */ \
- if (is_overlap(dst_orig, \
- src_orig, \
- (Addr)dst-(Addr)dst_orig+1, \
- (Addr)src-(Addr)src_orig+1)) \
- RECORD_OVERLAP_ERROR("strcpy", dst_orig, src_orig, 0); \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
- STRCPY(VG_Z_LIBC_SONAME, __GI_strcpy)
-
-#elif defined(VGO_darwin)
- //STRCPY(VG_Z_LIBC_SONAME, strcpy)
- //STRCPY(VG_Z_DYLD, strcpy)
- STRCPY(VG_Z_LIBC_SONAME, strcpy)
-
-#endif
-
-
-/*---------------------- strncpy ----------------------*/
-
-#define STRNCPY(soname, fnname) \
- char* VG_REPLACE_FUNCTION_EZU(20090,soname,fnname) \
- ( char* dst, const char* src, SizeT n ); \
- char* VG_REPLACE_FUNCTION_EZU(20090,soname,fnname) \
- ( char* dst, const char* src, SizeT n ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- SizeT m = 0; \
- \
- while (m < n && *src) { m++; *dst++ = *src++; } \
- /* Check for overlap after copying; all n bytes of dst are relevant, */ \
- /* but only m+1 bytes of src if terminator was found */ \
- if (is_overlap(dst_orig, src_orig, n, (m < n) ? m+1 : n)) \
- RECORD_OVERLAP_ERROR("strncpy", dst, src, n); \
- while (m++ < n) *dst++ = 0; /* must pad remainder with nulls */ \
- \
- return dst_orig; \
- }
-
-#if defined(VGO_linux)
- STRNCPY(VG_Z_LIBC_SONAME, strncpy)
- STRNCPY(VG_Z_LIBC_SONAME, __GI_strncpy)
-
-#elif defined(VGO_darwin)
- //STRNCPY(VG_Z_LIBC_SONAME, strncpy)
- //STRNCPY(VG_Z_DYLD, strncpy)
- STRNCPY(VG_Z_LIBC_SONAME, strncpy)
-
-#endif
-
-
-/*---------------------- strlcpy ----------------------*/
-
-/* Copy up to n-1 bytes from src to dst. Then nul-terminate dst if n > 0.
- Returns strlen(src). Does not zero-fill the remainder of dst. */
-#define STRLCPY(soname, fnname) \
- SizeT VG_REPLACE_FUNCTION_EZU(20100,soname,fnname) \
- ( char* dst, const char* src, SizeT n ); \
- SizeT VG_REPLACE_FUNCTION_EZU(20100,soname,fnname) \
- ( char* dst, const char* src, SizeT n ) \
- { \
- const HChar* src_orig = src; \
- HChar* dst_orig = dst; \
- SizeT m = 0; \
- \
- while (m < n-1 && *src) { m++; *dst++ = *src++; } \
- /* m non-nul bytes have now been copied, and m <= n-1. */ \
- /* Check for overlap after copying; all n bytes of dst are relevant, */ \
- /* but only m+1 bytes of src if terminator was found */ \
- if (is_overlap(dst_orig, src_orig, n, (m < n) ? m+1 : n)) \
- RECORD_OVERLAP_ERROR("strlcpy", dst, src, n); \
- /* Nul-terminate dst. */ \
- if (n > 0) *dst = 0; \
- /* Finish counting strlen(src). */ \
- while (*src) src++; \
- return src - src_orig; \
- }
-
-#if defined(VGO_linux)
-
-#if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android)
- STRLCPY(VG_Z_LIBC_SONAME, strlcpy);
-#endif
-
-#elif defined(VGO_darwin)
- //STRLCPY(VG_Z_LIBC_SONAME, strlcpy)
- //STRLCPY(VG_Z_DYLD, strlcpy)
- STRLCPY(VG_Z_LIBC_SONAME, strlcpy)
-
-#endif
-
-
-/*---------------------- strncmp ----------------------*/
-
-#define STRNCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20110,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax ); \
- int VG_REPLACE_FUNCTION_EZU(20110,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax ) \
- { \
- SizeT n = 0; \
- while (True) { \
- if (n >= nmax) return 0; \
- if (*s1 == 0 && *s2 == 0) return 0; \
- if (*s1 == 0) return -1; \
- if (*s2 == 0) return 1; \
- \
- if (*(const UChar*)s1 < *(const UChar*)s2) return -1; \
- if (*(const UChar*)s1 > *(const UChar*)s2) return 1; \
- \
- s1++; s2++; n++; \
- } \
- }
-
-#if defined(VGO_linux)
- STRNCMP(VG_Z_LIBC_SONAME, strncmp)
- STRNCMP(VG_Z_LIBC_SONAME, __GI_strncmp)
-
-#elif defined(VGO_darwin)
- //STRNCMP(VG_Z_LIBC_SONAME, strncmp)
- //STRNCMP(VG_Z_DYLD, strncmp)
- STRNCMP(VG_Z_LIBC_SONAME, strncmp)
-
-#endif
-
-
-/*---------------------- strcasecmp ----------------------*/
-
-#define STRCASECMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20120,soname,fnname) \
- ( const char* s1, const char* s2 ); \
- int VG_REPLACE_FUNCTION_EZU(20120,soname,fnname) \
- ( const char* s1, const char* s2 ) \
- { \
- extern int tolower(int); \
- register UChar c1; \
- register UChar c2; \
- while (True) { \
- c1 = tolower(*(const UChar *)s1); \
- c2 = tolower(*(const UChar *)s2); \
- if (c1 != c2) break; \
- if (c1 == 0) break; \
- s1++; s2++; \
- } \
- if ((UChar)c1 < (UChar)c2) return -1; \
- if ((UChar)c1 > (UChar)c2) return 1; \
- return 0; \
- }
-
-#if defined(VGO_linux)
-# if !defined(VGPV_arm_linux_android) && !defined(VGPV_x86_linux_android)
- STRCASECMP(VG_Z_LIBC_SONAME, strcasecmp)
- STRCASECMP(VG_Z_LIBC_SONAME, __GI_strcasecmp)
-# endif
-
-#elif defined(VGO_darwin)
- //STRCASECMP(VG_Z_LIBC_SONAME, strcasecmp)
-
-#endif
-
-
-/*---------------------- strncasecmp ----------------------*/
-
-#define STRNCASECMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20130,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax ); \
- int VG_REPLACE_FUNCTION_EZU(20130,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax ) \
- { \
- extern int tolower(int); \
- SizeT n = 0; \
- while (True) { \
- if (n >= nmax) return 0; \
- if (*s1 == 0 && *s2 == 0) return 0; \
- if (*s1 == 0) return -1; \
- if (*s2 == 0) return 1; \
- \
- if (tolower(*(const UChar *)s1) \
- < tolower(*(const UChar*)s2)) return -1; \
- if (tolower(*(const UChar *)s1) \
- > tolower(*(const UChar *)s2)) return 1; \
- \
- s1++; s2++; n++; \
- } \
- }
-
-#if defined(VGO_linux)
-# if !defined(VGPV_arm_linux_android) && !defined(VGPV_x86_linux_android)
- STRNCASECMP(VG_Z_LIBC_SONAME, strncasecmp)
- STRNCASECMP(VG_Z_LIBC_SONAME, __GI_strncasecmp)
-# endif
-
-#elif defined(VGO_darwin)
- //STRNCASECMP(VG_Z_LIBC_SONAME, strncasecmp)
- //STRNCASECMP(VG_Z_DYLD, strncasecmp)
-
-#endif
-
-
-/*---------------------- strcasecmp_l ----------------------*/
-
-#define STRCASECMP_L(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20140,soname,fnname) \
- ( const char* s1, const char* s2, void* locale ); \
- int VG_REPLACE_FUNCTION_EZU(20140,soname,fnname) \
- ( const char* s1, const char* s2, void* locale ) \
- { \
- extern int tolower_l(int, void*) __attribute__((weak)); \
- register UChar c1; \
- register UChar c2; \
- while (True) { \
- c1 = tolower_l(*(const UChar *)s1, locale); \
- c2 = tolower_l(*(const UChar *)s2, locale); \
- if (c1 != c2) break; \
- if (c1 == 0) break; \
- s1++; s2++; \
- } \
- if ((UChar)c1 < (UChar)c2) return -1; \
- if ((UChar)c1 > (UChar)c2) return 1; \
- return 0; \
- }
-
-#if defined(VGO_linux)
- STRCASECMP_L(VG_Z_LIBC_SONAME, strcasecmp_l)
- STRCASECMP_L(VG_Z_LIBC_SONAME, __GI_strcasecmp_l)
- STRCASECMP_L(VG_Z_LIBC_SONAME, __GI___strcasecmp_l)
-
-#elif defined(VGO_darwin)
- //STRCASECMP_L(VG_Z_LIBC_SONAME, strcasecmp_l)
-
-#endif
-
-
-/*---------------------- strncasecmp_l ----------------------*/
-
-#define STRNCASECMP_L(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20150,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax, void* locale ); \
- int VG_REPLACE_FUNCTION_EZU(20150,soname,fnname) \
- ( const char* s1, const char* s2, SizeT nmax, void* locale ) \
- { \
- extern int tolower_l(int, void*) __attribute__((weak)); \
- SizeT n = 0; \
- while (True) { \
- if (n >= nmax) return 0; \
- if (*s1 == 0 && *s2 == 0) return 0; \
- if (*s1 == 0) return -1; \
- if (*s2 == 0) return 1; \
- \
- if (tolower_l(*(const UChar *)s1, locale) \
- < tolower_l(*(const UChar *)s2, locale)) return -1; \
- if (tolower_l(*(const UChar *)s1, locale) \
- > tolower_l(*(const UChar *)s2, locale)) return 1; \
- \
- s1++; s2++; n++; \
- } \
- }
-
-#if defined(VGO_linux)
- STRNCASECMP_L(VG_Z_LIBC_SONAME, strncasecmp_l)
- STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI_strncasecmp_l)
- STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI___strncasecmp_l)
-
-#elif defined(VGO_darwin)
- //STRNCASECMP_L(VG_Z_LIBC_SONAME, strncasecmp_l)
- //STRNCASECMP_L(VG_Z_DYLD, strncasecmp_l)
-
-#endif
-
-
-/*---------------------- strcmp ----------------------*/
-
-#define STRCMP(soname, fnname) \
- int VG_REPLACE_FUNCTION_EZU(20160,soname,fnname) \
- ( const char* s1, const char* s2 ); \
- int VG_REPLACE_FUNCTION_EZU(20160,soname,fnname) \
- ( const char* s1, const char* s2 ) \
- { \
- register UChar c1; \
- register UChar c2; \
- while (True) { \
- c1 = *(const UChar *)s1; \
- c2 = *(const UChar *)s2; \
- if (c1 != c2) break; \
- if (c1 == 0) break; \
- s1++; s2++; \
- } \
- if ((UChar)c1 < (UChar)c2) return -1; \
- if ((UChar)c1 > (UChar)c2) return 1; \
- return 0; \
- }
-
-#if defined(VGO_linux)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
- STRCMP(VG_Z_LIBC_SONAME, __GI_strcmp)
- STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
- STRCMP(VG_Z_LD64_SO_1, strcmp)
-# if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android)
- STRCMP(NONE, __dl_strcmp); /* in /system/bin/linker */
-# endif
-
-#elif defined(VGO_darwin)
- //STRCMP(VG_Z_LIBC_SONAME, strcmp)
- STRCMP(VG_Z_LIBC_SONAME, strcmp)
-
-#endif
-
-
-/*---------------------- memchr ----------------------*/
-
-#define MEMCHR(soname, fnname) \
- void* VG_REPLACE_FUNCTION_EZU(20170,soname,fnname) \
- (const void *s, int c, SizeT n); \
- void* VG_REPLACE_FUNCTION_EZU(20170,soname,fnname) \
- (const void *s, int c, SizeT n) \
- { \
- SizeT i; \
- UChar c0 = (UChar)c; \
- UChar* p = (UChar*)s; \
- for (i = 0; i < n; i++) \
- if (p[i] == c0) return (void*)(&p[i]); \
- return NULL; \
- }
-
-#if defined(VGO_linux)
- MEMCHR(VG_Z_LIBC_SONAME, memchr)
-
-#elif defined(VGO_darwin)
- //MEMCHR(VG_Z_LIBC_SONAME, memchr)
- //MEMCHR(VG_Z_DYLD, memchr)
-
-#endif
-
-
-/*---------------------- memrchr ----------------------*/
-
-#define MEMRCHR(soname, fnname) \
- void* VG_REPLACE_FUNCTION_EZU(20360,soname,fnname) \
- (const void *s, int c, SizeT n); \
- void* VG_REPLACE_FUNCTION_EZU(20360,soname,fnname) \
- (const void *s, int c, SizeT n) \
- { \
- SizeT i; \
- UChar c0 = (UChar)c; \
- UChar* p = (UChar*)s; \
- for (i = 0; i < n; i++) \
- if (p[n-1-i] == c0) return (void*)(&p[n-1-i]); \
- return NULL; \
- }
-
-#if defined(VGO_linux)
- MEMRCHR(VG_Z_LIBC_SONAME, memrchr)
-
-#elif defined(VGO_darwin)
- //MEMRCHR(VG_Z_LIBC_SONAME, memrchr)
- //MEMRCHR(VG_Z_DYLD, memrchr)
-
-#endif
-
-
-/*---------------------- memcpy ----------------------*/
-
-#define MEMMOVE_OR_MEMCPY(becTag, soname, fnname, do_ol_check) \
- void* VG_REPLACE_FUNCTION_EZZ(becTag,soname,fnname) \
- ( void *dst, const void *src, SizeT len ); \
- void* VG_REPLACE_FUNCTION_EZZ(becTag,soname,fnname) \
- ( void *dst, const void *src, SizeT len ) \
- { \
- if (do_ol_check && is_overlap(dst, src, len, len)) \
- RECORD_OVERLAP_ERROR("memcpy", dst, src, len); \
- \
- const Addr WS = sizeof(UWord); /* 8 or 4 */ \
- const Addr WM = WS - 1; /* 7 or 3 */ \
- \
- if (len > 0) { \
- if (dst < src) { \
- \
- /* Copying backwards. */ \
- SizeT n = len; \
- Addr d = (Addr)dst; \
- Addr s = (Addr)src; \
- \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Pull up to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { *(UShort*)d = *(UShort*)s; s += 2; d += 2; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \
- \
- } else if (dst > src) { \
- \
- SizeT n = len; \
- Addr d = ((Addr)dst) + n; \
- Addr s = ((Addr)src) + n; \
- \
- /* Copying forwards. */ \
- if (((s^d) & WM) == 0) { \
- /* s and d have same UWord alignment. */ \
- /* Back down to a UWord boundary. */ \
- while ((s & WM) != 0 && n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- /* Copy UWords. */ \
- while (n >= WS) \
- { s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; } \
- if (n == 0) \
- return dst; \
- } \
- if (((s|d) & 1) == 0) { \
- /* Both are 16-aligned; copy what we can thusly. */ \
- while (n >= 2) \
- { s -= 2; d -= 2; *(UShort*)d = *(UShort*)s; n -= 2; } \
- } \
- /* Copy leftovers, or everything if misaligned. */ \
- while (n >= 1) \
- { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \
- \
- } \
- } \
- \
- return dst; \
- }
-
-#define MEMMOVE(soname, fnname) \
- MEMMOVE_OR_MEMCPY(20181, soname, ...
[truncated message content] |
|
From: <sv...@va...> - 2013-11-17 10:06:21
|
Author: bart
Date: Sun Nov 17 10:06:09 2013
New Revision: 13714
Log:
tests/check_headers_and_includes: Use File::Basename
Modified:
trunk/tests/check_headers_and_includes
Modified: trunk/tests/check_headers_and_includes
==============================================================================
--- trunk/tests/check_headers_and_includes (original)
+++ trunk/tests/check_headers_and_includes Sun Nov 17 10:06:09 2013
@@ -14,9 +14,10 @@
use strict;
use warnings;
+use File::Basename;
use Getopt::Long;
-my $this_script = "check_headers_and_includes";
+my $this_script = basename($0);
# The list of top-level directories is divided into three sets:
#
@@ -147,18 +148,6 @@
}
#---------------------------------------------------------------------
-# Given a path name strip leading directories.
-#---------------------------------------------------------------------
-sub basename {
- my ($path_name) = @_;
- my $file = $path_name;
-
- $file =~ s/^.*\///;
-
- return $file;
-}
-
-#---------------------------------------------------------------------
# Return 1, if file is located in <valgrind>/include
#---------------------------------------------------------------------
sub is_coregrind_export_header {
|
|
From: Petar J. <mip...@gm...> - 2013-11-17 05:03:24
|
Hello Sasi, >From what I can see, you have come across 'ldx' instruction that comes from MIPS64 DSP ASE that is not yet supported in Valgrind. There are instructions missing from Cavium set, so if your program is built with Cavium flags it is likely that you will come across more unimplemented instructions even if you workaround this one. There are a few patches in-review that you may want to cherry pick and try, they also include support for 'ldx' instruction, see: https://bugs.kde.org/show_bug.cgi?id=326444 https://bugs.kde.org/show_bug.cgi?id=327223 Cheers, Petar On Wed, Nov 13, 2013 at 5:23 PM, Sasikanth babu <sas...@gm...>wrote: > Hi all, > > I'm using valgrind 3.9.0 which has the mips octeon support but when I > tried > run valgrind on octeon, it thows an error saying unhandled instruction > bytes. > > > root@octeon-test:/root> valgrind /bin/ls > ==1631== Memcheck, a memory error detector > ==1631== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. > ==1631== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info > ==1631== Command: /bin/ls > ==1631== > Error occured while trying to decode MIPS32 DSP instruction. > Your platform probably doesn't support MIPS32 DSP ASE. > vex mips->IR: unhandled instruction bytes: 0x7C 0x65 0x1A 0xA > ==1631== valgrind: Unrecognised instruction at address 0x40190dc. > > I see that the support was added only for OCTEON_CN63XX and I'm using > is OCTEON_CN68XX. Any pointers on how to solve this issue, > > Thanks in Advance > Sasi > > > ------------------------------------------------------------------------------ > DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps > OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access > Free app hosting. Or install the open source package on any LAMP server. > Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! > http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |