OLD | NEW |
| (Empty) |
1 This patch adds a "STOP" frame to valgrind suppressions | |
2 so we can do exact matches. This is filed as | |
3 https://bugs.kde.org/show_bug.cgi?id=222604 | |
4 TODO(thestig) update the matcher spec and submit upstream. | |
5 Index: include/pub_tool_seqmatch.h | |
6 =================================================================== | |
7 --- include/pub_tool_seqmatch.h (revision 10880) | |
8 +++ include/pub_tool_seqmatch.h (working copy) | |
9 @@ -76,6 +76,7 @@ | |
10 void* input, SizeT szbInput, UWord nInput, UWord ixInput, | |
11 Bool (*pIsStar)(void*), | |
12 Bool (*pIsQuery)(void*), | |
13 + Bool (*pIsStop)(void*), | |
14 Bool (*pattEQinp)(void*,void*) | |
15 ); | |
16 | |
17 Index: coregrind/m_errormgr.c | |
18 =================================================================== | |
19 --- coregrind/m_errormgr.c (revision 10880) | |
20 +++ coregrind/m_errormgr.c (working copy) | |
21 @@ -194,7 +194,8 @@ | |
22 NoName, /* Error case */ | |
23 ObjName, /* Name is of an shared object file. */ | |
24 FunName, /* Name is of a function. */ | |
25 - DotDotDot /* Frame-level wildcard */ | |
26 + DotDotDot, /* Frame-level wildcard */ | |
27 + STOP /* STOP sign */ | |
28 } | |
29 SuppLocTy; | |
30 | |
31 @@ -1074,6 +1075,11 @@ | |
32 p->ty = DotDotDot; | |
33 return True; | |
34 } | |
35 + if (VG_(strcmp)(p->name, "STOP") == 0) { | |
36 + p->name = NULL; | |
37 + p->ty = STOP; | |
38 + return True; | |
39 + } | |
40 VG_(printf)("location should be \"...\", or should start " | |
41 "with \"fun:\" or \"obj:\"\n"); | |
42 return False; | |
43 @@ -1243,13 +1249,17 @@ | |
44 } while (!eof && !VG_STREQ(buf, "}")); | |
45 } | |
46 | |
47 - // Reject entries which are entirely composed of frame | |
48 - // level wildcards. | |
49 vg_assert(i > 0); // guaranteed by frame-descriptor reading loop | |
50 + // Reject any pattern where STOP is not the last entry. | |
51 + for (j = 0; j < i - 1; j++) { | |
52 + if (tmp_callers[j].ty == STOP) | |
53 + BOMB("STOP must be the last entry in a suppression"); | |
54 + } | |
55 + // Reject entries which are entirely composed of frame level wildcards. | |
56 for (j = 0; j < i; j++) { | |
57 if (tmp_callers[j].ty == FunName || tmp_callers[j].ty == ObjName) | |
58 break; | |
59 - vg_assert(tmp_callers[j].ty == DotDotDot); | |
60 + vg_assert(tmp_callers[j].ty == DotDotDot || tmp_callers[j].ty == STOP)
; | |
61 } | |
62 vg_assert(j >= 0 && j <= i); | |
63 if (j == i) { | |
64 @@ -1324,6 +1334,12 @@ | |
65 return False; /* there's no '?' equivalent in the supp syntax */ | |
66 } | |
67 | |
68 +static Bool supploc_IsStop ( void* supplocV ) | |
69 +{ | |
70 + SuppLoc* supploc = (SuppLoc*)supplocV; | |
71 + return supploc->ty == STOP; | |
72 +} | |
73 + | |
74 static Bool supp_pattEQinp ( void* supplocV, void* addrV ) | |
75 { | |
76 SuppLoc* supploc = (SuppLoc*)supplocV; /* PATTERN */ | |
77 @@ -1340,6 +1356,8 @@ | |
78 should never get called with a pattern value for which the | |
79 _IsStar or _IsQuery function would return True. Hence | |
80 this can't happen. */ | |
81 + case STOP: | |
82 + // Ditto. | |
83 vg_assert(0); | |
84 case ObjName: | |
85 /* Get the object name into 'caller_name', or "???" | |
86 @@ -1389,7 +1407,7 @@ | |
87 matchAll, | |
88 /*PATT*/supps, szbPatt, n_supps, 0/*initial Ix*/, | |
89 /*INPUT*/ips, szbInput, n_ips, 0/*initial Ix*/, | |
90 - supploc_IsStar, supploc_IsQuery, supp_pattEQinp | |
91 + supploc_IsStar, supploc_IsQuery, supploc_IsStop, supp_pattEQinp | |
92 ); | |
93 } | |
94 | |
95 Index: coregrind/m_seqmatch.c | |
96 =================================================================== | |
97 --- coregrind/m_seqmatch.c (revision 10880) | |
98 +++ coregrind/m_seqmatch.c (working copy) | |
99 @@ -45,6 +45,7 @@ | |
100 void* input, SizeT szbInput, UWord nInput, UWord ixInput, | |
101 Bool (*pIsStar)(void*), | |
102 Bool (*pIsQuery)(void*), | |
103 + Bool (*pIsStop)(void*), | |
104 Bool (*pattEQinp)(void*,void*) | |
105 ) | |
106 { | |
107 @@ -102,7 +103,7 @@ | |
108 if (VG_(generic_match)( matchAll, | |
109 patt, szbPatt, nPatt, ixPatt+1, | |
110 input,szbInput,nInput, ixInput+0, | |
111 - pIsStar,pIsQuery,pattEQinp) ) { | |
112 + pIsStar,pIsQuery,pIsStop,pattEQinp) ) { | |
113 return True; | |
114 } | |
115 // but we can tail-recurse for the second call | |
116 @@ -125,6 +126,9 @@ | |
117 } | |
118 } | |
119 | |
120 + if (havePatt && pIsStop(currPatt)) | |
121 + return !haveInput; | |
122 + | |
123 // obvious case with literal chars in the pattern | |
124 // | |
125 // ma (p:ps) (i:is) = p == i && ma ps is | |
126 @@ -163,10 +167,11 @@ | |
127 */ | |
128 static Bool charIsStar ( void* pV ) { return *(Char*)pV == '*'; } | |
129 static Bool charIsQuery ( void* pV ) { return *(Char*)pV == '?'; } | |
130 +static Bool charIsStop ( void* pV ) { return *(Char*)pV == '!'; } | |
131 static Bool char_p_EQ_i ( void* pV, void* cV ) { | |
132 Char p = *(Char*)pV; | |
133 Char c = *(Char*)cV; | |
134 - vg_assert(p != '*' && p != '?'); | |
135 + vg_assert(p != '*' && p != '?' && p != '!'); | |
136 return p == c; | |
137 } | |
138 Bool VG_(string_match) ( const Char* patt, const Char* input ) | |
139 @@ -175,7 +180,7 @@ | |
140 True/* match-all */, | |
141 (void*)patt, sizeof(UChar), VG_(strlen)(patt), 0, | |
142 (void*)input, sizeof(UChar), VG_(strlen)(input), 0, | |
143 - charIsStar, charIsQuery, char_p_EQ_i | |
144 + charIsStar, charIsQuery, charIsStop, char_p_EQ_i | |
145 ); | |
146 } | |
147 | |
OLD | NEW |