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
(2) |
2
(4) |
3
(1) |
4
(7) |
5
|
|
6
|
7
(4) |
8
|
9
(3) |
10
(6) |
11
(13) |
12
(6) |
|
13
(1) |
14
|
15
(1) |
16
|
17
(4) |
18
(3) |
19
(5) |
|
20
(5) |
21
(5) |
22
(5) |
23
(6) |
24
|
25
(1) |
26
(1) |
|
27
(1) |
28
(4) |
29
(5) |
30
|
|
|
|
|
From: <sv...@va...> - 2016-11-07 19:58:26
|
Author: carll
Date: Mon Nov 7 19:58:19 2016
New Revision: 3285
Log:
Fix xxsel parsing error, update.
Commit 3284 listed Bugzilla 148000 which is incorrect.
Tweeked comments so the file VEX/priv/guest_ppc_toIR.c can be committed again.
The correct bugzilla is 372185.
Modified:
trunk/priv/guest_ppc_toIR.c
Modified: trunk/priv/guest_ppc_toIR.c
==============================================================================
--- trunk/priv/guest_ppc_toIR.c (original)
+++ trunk/priv/guest_ppc_toIR.c Mon Nov 7 19:58:19 2016
@@ -27218,7 +27218,9 @@
#define VSX_XX3_LEN (sizeof vsx_xx3 / sizeof *vsx_xx3)
-// ATTENTION: This search functions assumes vsx_all array is sorted.
+/* ATTENTION: These search functions assumes vsx_xx2 and vsx_xx3 arrays
+ * are sorted.
+ */
static Int findVSXextOpCode_xx2(UInt opcode)
{
Int low, mid, high;
|
|
From: <sv...@va...> - 2016-11-07 19:41:38
|
Author: carll
Date: Mon Nov 7 19:41:30 2016
New Revision: 3284
Log:
Fix xxsel parsing error.
The xxsel instruction uses part of the standard opc2 field to specify
a additional operand or other values. A subset of the field is used for
the actual opcode. The masking and array lookup was getting confused by
bits in the the additional operand field. The arrays were split so only
the opcodes that should be found for a given mask is in the array. This
also speeds up the search as you are not searching through values that
cannot match. The small groups of opcodes for a couple of the masks are
now done in a case statement as that is probably faster then doing an array
look up.
Bugzilla 148000
Modified:
trunk/priv/guest_ppc_toIR.c
Modified: trunk/priv/guest_ppc_toIR.c
==============================================================================
--- trunk/priv/guest_ppc_toIR.c (original)
+++ trunk/priv/guest_ppc_toIR.c Mon Nov 7 19:41:30 2016
@@ -18146,7 +18146,7 @@
assign( vB, getVSReg( XB ) );
switch (opc2) {
- case 0x18C: case 0x38C: // xvcmpeqdp[.] (VSX Vector Compare Equal To Double-Precision [ & Record ])
+ case 0x18C: // xvcmpeqdp[.] (VSX Vector Compare Equal To Double-Precision [ & Record ])
{
DIP("xvcmpeqdp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""),
XT, XA, XB);
@@ -18154,7 +18154,7 @@
break;
}
- case 0x1CC: case 0x3CC: // xvcmpgedp[.] (VSX Vector Compare Greater Than or Equal To Double-Precision [ & Record ])
+ case 0x1CC: // xvcmpgedp[.] (VSX Vector Compare Greater Than or Equal To Double-Precision [ & Record ])
{
DIP("xvcmpgedp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""),
XT, XA, XB);
@@ -18162,7 +18162,7 @@
break;
}
- case 0x1AC: case 0x3AC: // xvcmpgtdp[.] (VSX Vector Compare Greater Than Double-Precision [ & Record ])
+ case 0x1AC: // xvcmpgtdp[.] (VSX Vector Compare Greater Than Double-Precision [ & Record ])
{
DIP("xvcmpgtdp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""),
XT, XA, XB);
@@ -18170,7 +18170,7 @@
break;
}
- case 0x10C: case 0x30C: // xvcmpeqsp[.] (VSX Vector Compare Equal To Single-Precision [ & Record ])
+ case 0x10C: // xvcmpeqsp[.] (VSX Vector Compare Equal To Single-Precision [ & Record ])
{
IRTemp vD = newTemp(Ity_V128);
@@ -18184,7 +18184,7 @@
break;
}
- case 0x14C: case 0x34C: // xvcmpgesp[.] (VSX Vector Compare Greater Than or Equal To Single-Precision [ & Record ])
+ case 0x14C: // xvcmpgesp[.] (VSX Vector Compare Greater Than or Equal To Single-Precision [ & Record ])
{
IRTemp vD = newTemp(Ity_V128);
@@ -18198,7 +18198,7 @@
break;
}
- case 0x12C: case 0x32C: //xvcmpgtsp[.] (VSX Vector Compare Greater Than Single-Precision [ & Record ])
+ case 0x12C: //xvcmpgtsp[.] (VSX Vector Compare Greater Than Single-Precision [ & Record ])
{
IRTemp vD = newTemp(Ity_V128);
@@ -27043,17 +27043,93 @@
};
// ATTENTION: Keep this array sorted on the opcocde!!!
-static struct vsx_insn vsx_all[] = {
- { 0x0, "xsaddsp" },
- { 0x4, "xsmaddasp" },
- { 0x8, "xxsldwi" },
+static struct vsx_insn vsx_xx2[] = {
{ 0x14, "xsrsqrtesp" },
{ 0x16, "xssqrtsp" },
{ 0x18, "xxsel" },
+ { 0x34, "xsresp" },
+ { 0x90, "xscvdpuxws" },
+ { 0x92, "xsrdpi" },
+ { 0x94, "xsrsqrtedp" },
+ { 0x96, "xssqrtdp" },
+ { 0xb0, "xscvdpsxws" },
+ { 0xb2, "xsrdpiz" },
+ { 0xb4, "xsredp" },
+ { 0xd2, "xsrdpip" },
+ { 0xd4, "xstsqrtdp" },
+ { 0xd6, "xsrdpic" },
+ { 0xf2, "xsrdpim" },
+ { 0x112, "xvrspi" },
+ { 0x116, "xvsqrtsp" },
+ { 0x130, "xvcvspsxws" },
+ { 0x132, "xvrspiz" },
+ { 0x134, "xvresp" },
+ { 0x148, "xxspltw" },
+ { 0x14A, "xxextractuw" },
+ { 0x150, "xvcvuxwsp" },
+ { 0x152, "xvrspip" },
+ { 0x154, "xvtsqrtsp" },
+ { 0x156, "xvrspic" },
+ { 0x16A, "xxinsertw" },
+ { 0x170, "xvcvsxwsp" },
+ { 0x172, "xvrspim" },
+ { 0x190, "xvcvdpuxws" },
+ { 0x192, "xvrdpi" },
+ { 0x194, "xvrsqrtedp" },
+ { 0x196, "xvsqrtdp" },
+ { 0x1b0, "xvcvdpsxws" },
+ { 0x1b2, "xvrdpiz" },
+ { 0x1b4, "xvredp" },
+ { 0x1d0, "xvcvuxwdp" },
+ { 0x1d2, "xvrdpip" },
+ { 0x1d4, "xvtsqrtdp" },
+ { 0x1d6, "xvrdpic" },
+ { 0x1f0, "xvcvsxwdp" },
+ { 0x1f2, "xvrdpim" },
+ { 0x212, "xscvdpsp" },
+ { 0x216, "xscvdpspn" },
+ { 0x232, "xxrsp" },
+ { 0x250, "xscvuxdsp" },
+ { 0x254, "xststdcsp" },
+ { 0x270, "xscvsxdsp" },
+ { 0x290, "xscvdpuxds" },
+ { 0x292, "xscvspdp" },
+ { 0x296, "xscvspdpn" },
+ { 0x2b0, "xscvdpsxds" },
+ { 0x2b2, "xsabsdp" },
+ { 0x2b6, "xsxexpdp_xsxigdp" },
+ { 0x2d0, "xscvuxddp" },
+ { 0x2d2, "xsnabsdp" },
+ { 0x2d4, "xststdcdp" },
+ { 0x2e4, "xsnmsubmdp" },
+ { 0x2f0, "xscvsxddp" },
+ { 0x2f2, "xsnegdp" },
+ { 0x310, "xvcvspuxds" },
+ { 0x312, "xvcvdpsp" },
+ { 0x330, "xvcvspsxds" },
+ { 0x332, "xvabssp" },
+ { 0x350, "xvcvuxdsp" },
+ { 0x352, "xvnabssp" },
+ { 0x370, "xvcvsxdsp" },
+ { 0x372, "xvnegsp" },
+ { 0x390, "xvcvdpuxds" },
+ { 0x392, "xvcvspdp" },
+ { 0x3b0, "xvcvdpsxds" },
+ { 0x3b2, "xvabsdp" },
+ { 0x3b6, "xxbr[h|w|d|q]|xvxexpdp|xvxexpsp|xvxsigdp|xvxsigsp|xvcvhpsp|xvcvsphp|xscvdphp|xscvhpdp" },
+ { 0x3d0, "xvcvuxddp" },
+ { 0x3d2, "xvnabsdp" },
+ { 0x3f2, "xvnegdp" }
+};
+#define VSX_XX2_LEN (sizeof vsx_xx2 / sizeof *vsx_xx2)
+
+// ATTENTION: Keep this array sorted on the opcocde!!!
+static struct vsx_insn vsx_xx3[] = {
+ { 0x0, "xsaddsp" },
+ { 0x4, "xsmaddasp" },
+ { 0x9, "xsmaddmsp" },
{ 0x20, "xssubsp" },
{ 0x24, "xsmaddmsp" },
- { 0x28, "xxpermdi" },
- { 0x34, "xsresp" },
{ 0x3A, "xxpermr" },
{ 0x40, "xsmulsp" },
{ 0x44, "xsmsubasp" },
@@ -27064,174 +27140,112 @@
{ 0x80, "xsadddp" },
{ 0x84, "xsmaddadp" },
{ 0x8c, "xscmpudp" },
- { 0x90, "xscvdpuxws" },
- { 0x92, "xsrdpi" },
- { 0x94, "xsrsqrtedp" },
- { 0x96, "xssqrtdp" },
{ 0xa0, "xssubdp" },
{ 0xa4, "xsmaddmdp" },
{ 0xac, "xscmpodp" },
- { 0xb0, "xscvdpsxws" },
- { 0xb2, "xsrdpiz" },
- { 0xb4, "xsredp" },
{ 0xc0, "xsmuldp" },
{ 0xc4, "xsmsubadp" },
{ 0xc8, "xxmrglw" },
- { 0xd2, "xsrdpip" },
{ 0xd4, "xstsqrtdp" },
- { 0xd6, "xsrdpic" },
{ 0xe0, "xsdivdp" },
{ 0xe4, "xsmsubmdp" },
{ 0xe8, "xxpermr" },
{ 0xeC, "xscmpexpdp" },
- { 0xf2, "xsrdpim" },
{ 0xf4, "xstdivdp" },
{ 0x100, "xvaddsp" },
{ 0x104, "xvmaddasp" },
- { 0x10c, "xvcmpeqsp" },
+ { 0x10C, "xvcmpeqsp" },
{ 0x110, "xvcvspuxws" },
- { 0x112, "xvrspi" },
{ 0x114, "xvrsqrtesp" },
- { 0x116, "xvsqrtsp" },
{ 0x120, "xvsubsp" },
{ 0x124, "xvmaddmsp" },
- { 0x12c, "xvcmpgtsp" },
{ 0x130, "xvcvspsxws" },
- { 0x132, "xvrspiz" },
- { 0x134, "xvresp" },
{ 0x140, "xvmulsp" },
{ 0x144, "xvmsubasp" },
- { 0x148, "xxspltw" },
- { 0x14A, "xxextractuw" },
- { 0x14c, "xvcmpgesp" },
- { 0x150, "xvcvuxwsp" },
- { 0x152, "xvrspip" },
- { 0x154, "xvtsqrtsp" },
- { 0x156, "xvrspic" },
+ { 0x14C, "xvcmpgesp", },
{ 0x160, "xvdivsp" },
{ 0x164, "xvmsubmsp" },
- { 0x16A, "xxinsertw" },
- { 0x170, "xvcvsxwsp" },
- { 0x172, "xvrspim" },
{ 0x174, "xvtdivsp" },
{ 0x180, "xvadddp" },
{ 0x184, "xvmaddadp" },
- { 0x18c, "xvcmpeqdp" },
- { 0x190, "xvcvdpuxws" },
- { 0x192, "xvrdpi" },
- { 0x194, "xvrsqrtedp" },
- { 0x196, "xvsqrtdp" },
+ { 0x18C, "xvcmpeqdp" },
{ 0x1a0, "xvsubdp" },
{ 0x1a4, "xvmaddmdp" },
- { 0x1ac, "xvcmpgtdp" },
- { 0x1b0, "xvcvdpsxws" },
- { 0x1b2, "xvrdpiz" },
- { 0x1b4, "xvredp" },
+ { 0x1aC, "xvcmpgtdp" },
{ 0x1c0, "xvmuldp" },
{ 0x1c4, "xvmsubadp" },
{ 0x1cc, "xvcmpgedp" },
- { 0x1d0, "xvcvuxwdp" },
- { 0x1d2, "xvrdpip" },
- { 0x1d4, "xvtsqrtdp" },
- { 0x1d6, "xvrdpic" },
{ 0x1e0, "xvdivdp" },
{ 0x1e4, "xvmsubmdp" },
- { 0x1f0, "xvcvsxwdp" },
- { 0x1f2, "xvrdpim" },
{ 0x1f4, "xvtdivdp" },
{ 0x204, "xsnmaddasp" },
{ 0x208, "xxland" },
- { 0x212, "xscvdpsp" },
- { 0x216, "xscvdpspn" },
{ 0x224, "xsnmaddmsp" },
{ 0x228, "xxlandc" },
- { 0x232, "xxrsp" },
{ 0x244, "xsnmsubasp" },
{ 0x248, "xxlor" },
- { 0x250, "xscvuxdsp" },
- { 0x254, "xststdcsp" },
{ 0x264, "xsnmsubmsp" },
{ 0x268, "xxlxor" },
- { 0x270, "xscvsxdsp" },
{ 0x280, "xsmaxdp" },
{ 0x284, "xsnmaddadp" },
{ 0x288, "xxlnor" },
- { 0x290, "xscvdpuxds" },
- { 0x292, "xscvspdp" },
- { 0x296, "xscvspdpn" },
{ 0x2a0, "xsmindp" },
{ 0x2a4, "xsnmaddmdp" },
{ 0x2a8, "xxlorc" },
- { 0x2b0, "xscvdpsxds" },
- { 0x2b2, "xsabsdp" },
- { 0x2b6, "xsxexpdp_xsxigdp" },
{ 0x2c0, "xscpsgndp" },
{ 0x2c4, "xsnmsubadp" },
{ 0x2c8, "xxlnand" },
- { 0x2d0, "xscvuxddp" },
- { 0x2d2, "xsnabsdp" },
- { 0x2d4, "xststdcdp" },
{ 0x2e4, "xsnmsubmdp" },
{ 0x2e8, "xxleqv" },
- { 0x2f0, "xscvsxddp" },
- { 0x2f2, "xsnegdp" },
{ 0x300, "xvmaxsp" },
{ 0x304, "xvnmaddasp" },
- { 0x30c, "xvcmpeqsp." },
- { 0x310, "xvcvspuxds" },
- { 0x312, "xvcvdpsp" },
{ 0x320, "xvminsp" },
{ 0x324, "xvnmaddmsp" },
- { 0x32c, "xvcmpgtsp." },
- { 0x330, "xvcvspsxds" },
- { 0x332, "xvabssp" },
{ 0x340, "xvcpsgnsp" },
{ 0x344, "xvnmsubasp" },
- { 0x34c, "xvcmpgesp." },
- { 0x350, "xvcvuxdsp" },
- { 0x352, "xvnabssp" },
- { 0x354, "xvtstdcsp" },
{ 0x360, "xviexpsp" },
{ 0x364, "xvnmsubmsp" },
- { 0x370, "xvcvsxdsp" },
- { 0x372, "xvnegsp" },
{ 0x380, "xvmaxdp" },
{ 0x384, "xvnmaddadp" },
- { 0x38c, "xvcmpeqdp." },
- { 0x390, "xvcvdpuxds" },
- { 0x392, "xvcvspdp" },
- { 0x396, "xsiexpdp" },
{ 0x3a0, "xvmindp" },
{ 0x3a4, "xvnmaddmdp" },
- { 0x3ac, "xvcmpgtdp." },
- { 0x3b0, "xvcvdpsxds" },
- { 0x3b2, "xvabsdp" },
- { 0x3b6, "xxbr[h|w|d|q]|xvxexpdp|xvxexpsp|xvxsigdp|xvxsigsp|xvcvhpsp|xvcvsphp|xscvdphp|xscvhpdp" },
{ 0x3c0, "xvcpsgndp" },
{ 0x3c4, "xvnmsubadp" },
- { 0x3cc, "xvcmpgedp." },
- { 0x3d0, "xvcvuxddp" },
- { 0x3d2, "xvnabsdp" },
- { 0x3d4, "xvtstdcdp" },
{ 0x3e0, "xviexpdp" },
{ 0x3e4, "xvnmsubmdp" },
{ 0x3f0, "xvcvsxddp" },
- { 0x3f2, "xvnegdp" }
};
-#define VSX_ALL_LEN (sizeof vsx_all / sizeof *vsx_all)
+#define VSX_XX3_LEN (sizeof vsx_xx3 / sizeof *vsx_xx3)
-// ATTENTION: This search function assumes vsx_all array is sorted.
-static Int findVSXextOpCode(UInt opcode)
+// ATTENTION: This search functions assumes vsx_all array is sorted.
+static Int findVSXextOpCode_xx2(UInt opcode)
{
Int low, mid, high;
low = 0;
- high = VSX_ALL_LEN - 1;
+ high = VSX_XX2_LEN - 1;
while (low <= high) {
mid = (low + high)/2;
- if (opcode < vsx_all[mid].opcode)
+ if (opcode < vsx_xx2[mid].opcode)
high = mid - 1;
- else if (opcode > vsx_all[mid].opcode)
+ else if (opcode > vsx_xx2[mid].opcode)
+ low = mid + 1;
+ else
+ return mid;
+ }
+ return -1;
+}
+
+static Int findVSXextOpCode_xx3(UInt opcode)
+{
+ Int low, mid, high;
+ low = 0;
+ high = VSX_XX3_LEN - 1;
+ while (low <= high) {
+ mid = (low + high)/2;
+ if (opcode < vsx_xx3[mid].opcode)
+ high = mid - 1;
+ else if (opcode > vsx_xx3[mid].opcode)
low = mid + 1;
else
return mid;
@@ -27244,31 +27258,68 @@
* passed, and we then try to match it up with one of the VSX forms
* below.
*/
-static UInt get_VSX60_opc2(UInt opc2_full)
+static UInt get_VSX60_opc2(UInt opc2_full, UInt theInstr)
{
-#define XX2_MASK 0x000003FE
+#define XX2_1_MASK 0x000003FF // xsiexpdp specific
+#define XX2_2_MASK 0x000003FE
#define XX3_1_MASK 0x000003FC
#define XX3_2_MASK 0x000001FC
-#define XX3_3_MASK 0x0000007C
-#define XX4_MASK 0x00000018
-#define VDCMX_MASK 0x000003B8
+#define XX3_4_MASK 0x0000027C
+#define XX3_5_MASK 0x000003DC
+#define XX4_MASK 0x00000018
+
Int ret;
UInt vsxExtOpcode = 0;
- if (( ret = findVSXextOpCode(opc2_full & XX2_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
- else if (( ret = findVSXextOpCode(opc2_full & XX3_1_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
- else if (( ret = findVSXextOpCode(opc2_full & VDCMX_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
- else if (( ret = findVSXextOpCode(opc2_full & XX3_2_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
- else if (( ret = findVSXextOpCode(opc2_full & XX3_3_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
- else if (( ret = findVSXextOpCode(opc2_full & XX4_MASK)) >= 0)
- vsxExtOpcode = vsx_all[ret].opcode;
+ if (( ret = findVSXextOpCode_xx2(opc2_full & XX2_2_MASK)) >= 0)
+ return vsx_xx2[ret].opcode;
+ else if ((opc2_full & XX2_1_MASK) == 0x396 ) // xsiexpdp
+ return 0x396;
+ else if (( ret = findVSXextOpCode_xx3(opc2_full & XX3_1_MASK)) >= 0)
+ return vsx_xx3[ret].opcode;
+ else {
+
+ /* There are only a few codes in each of these cases it is
+ * probably faster to check for the codes then do the array lookups.
+ */
+ vsxExtOpcode = opc2_full & XX3_2_MASK;
+
+ switch (vsxExtOpcode) {
+ case 0x10C: return vsxExtOpcode; // xvcmpeqsp
+ case 0x12C: return vsxExtOpcode; // xvcmpgtsp, xvcmpgtsp.
+ case 0x14C: return vsxExtOpcode; // xvcmpgesp, xvcmpgesp.
+ case 0x18C: return vsxExtOpcode; // xvcmpeqdp, xvcmpeqdp.
+ case 0x1AC: return vsxExtOpcode; // xvcmpgtdp, xvcmpgtdp.
+ case 0x1CC: return vsxExtOpcode; // xvcmpgedp, xvcmpgedp.
+ default: break;
+ }
- return vsxExtOpcode;
+ vsxExtOpcode = opc2_full & XX3_4_MASK;
+
+ switch (vsxExtOpcode) {
+ case 0x8: return vsxExtOpcode; // xxsldwi
+ case 0x28: return vsxExtOpcode; // xxpermdi
+ default: break;
+ }
+
+ vsxExtOpcode = opc2_full & XX3_5_MASK;
+
+ switch (vsxExtOpcode) {
+ case 0x354: return vsxExtOpcode; // xvtstdcsp
+ case 0x3D4: return vsxExtOpcode; // xvtstdcdp
+ default: break;
+ }
+
+ if (( opc2_full & XX4_MASK ) == XX4_MASK ) { // xxsel
+ vsxExtOpcode = 0x18;
+ return vsxExtOpcode;
+ }
+ }
+
+ vex_printf( "Error: undefined opcode 0x %x, the instruction = 0x %x\n",
+ opc2_full, theInstr );
+ vpanic( "ERROR: get_VSX60_opc2()\n" );
+ return 0;
}
/*------------------------------------------------------------*/
@@ -27718,7 +27769,7 @@
opc2 = ifieldOPClo10(theInstr);
UInt opc2hi = IFIELD(theInstr, 7, 4);
UInt opc2lo = IFIELD(theInstr, 3, 3);
- UInt vsxOpc2 = get_VSX60_opc2(opc2);
+ UInt vsxOpc2;
if (( opc2hi == 13 ) && ( opc2lo == 5)) { //xvtstdcsp
if (dis_vxs_misc(theInstr, 0x354, allow_isa_3_0))
@@ -27747,6 +27798,8 @@
goto decode_failure;
}
+ vsxOpc2 = get_VSX60_opc2(opc2, theInstr);
+
switch (vsxOpc2) {
case 0x8: case 0x28: case 0x48: case 0xc8: // xxsldwi, xxpermdi, xxmrghw, xxmrglw
case 0x068: case 0xE8: // xxperm, xxpermr
@@ -27851,12 +27904,12 @@
if (dis_vx_conv(theInstr, vsxOpc2)) goto decode_success;
goto decode_failure;
- case 0x18C: case 0x38C: // xvcmpeqdp[.]
- case 0x10C: case 0x30C: // xvcmpeqsp[.]
- case 0x14C: case 0x34C: // xvcmpgesp[.]
- case 0x12C: case 0x32C: // xvcmpgtsp[.]
- case 0x1CC: case 0x3CC: // xvcmpgedp[.]
- case 0x1AC: case 0x3AC: // xvcmpgtdp[.]
+ case 0x18C: // xvcmpeqdp[.]
+ case 0x10C: // xvcmpeqsp[.]
+ case 0x14C: // xvcmpgesp[.]
+ case 0x12C: // xvcmpgtsp[.]
+ case 0x1CC: // xvcmpgedp[.]
+ case 0x1AC: // xvcmpgtdp[.]
if (dis_vvec_cmp(theInstr, vsxOpc2)) goto decode_success;
goto decode_failure;
|
|
From: <sv...@va...> - 2016-11-07 14:24:35
|
Author: mjw
Date: Mon Nov 7 14:24:26 2016
New Revision: 16118
Log:
Bug #372120 - c++ demangler demangles symbols which are not c++.
Explicitly check that the symbol starts with "_Z" to only demangle
modern style (gnu_v3) mangled C++ (and Rust) symbols.
Modified:
trunk/NEWS
trunk/coregrind/m_demangle/demangle.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon Nov 7 14:24:26 2016
@@ -23,6 +23,7 @@
371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
371869 support '%' in symbol Z-encoding
+372120 c++ demangler demangles symbols which are not c++
Modified: trunk/coregrind/m_demangle/demangle.c
==============================================================================
--- trunk/coregrind/m_demangle/demangle.c (original)
+++ trunk/coregrind/m_demangle/demangle.c Mon Nov 7 14:24:26 2016
@@ -141,7 +141,8 @@
}
/* Possibly undo (1) */
- if (do_cxx_demangling && VG_(clo_demangle)) {
+ if (do_cxx_demangling && VG_(clo_demangle)
+ && orig != NULL && orig[0] == '_' && orig[1] == 'Z') {
/* !!! vvv STATIC vvv !!! */
static HChar* demangled = NULL;
/* !!! ^^^ STATIC ^^^ !!! */
|
|
From: Philippe W. <phi...@sk...> - 2016-11-04 22:24:30
|
On Thu, 2016-11-03 at 23:41 -0400, Rhys Kidd wrote: > #if defined(VGO_linux) > +#define PID_EXEPATH "/proc/%d/exe" > +#define SELF_EXEPATH "/proc/self/exe" > +#define SELF_EXEFD "/proc/self/fd/%d" > +#elif defined(VGO_solaris) > +#define PID_EXEPATH "/proc/%d/path/a.out" > +#define SELF_EXEPATH "/proc/self/path/a.out" > +#define SELF_EXEFD "/proc/self/path/%d" > +#endif > > > This changes the logic of the define guards. > > Previously #if defined(VGO_linux) would continue to guard this next > block until the #elif defined(VGO_solaris) took over. > > > The union of #if defined(VGO_linux) || defined(VGO_solaris) does not > cover all platforms that build this file - namely macOS. > > > I'll send a patch shortly to correct this logic. > Humph, completely forgot about macos. Thanks for the fix. Philippe |
|
From: Ivo R. <iv...@iv...> - 2016-11-04 19:08:37
|
2016-11-04 12:32 GMT+01:00 Julian Seward <js...@ac...>: > This is annoying, also because it doesn't matter that brk will > fail, since the libc malloc then tries mmap instead, and succeeds. > > Are there any objections to that? No objections to that. Also note that glibc has this mmap backend fallback but for example Solaris libc does not. So a failure to raise brk is treated as a hard error here. I. |
|
From: <sv...@va...> - 2016-11-04 18:21:30
|
Author: petarj
Date: Fri Nov 4 18:21:22 2016
New Revision: 16117
Log:
mips: Add redir for index function in ld.so.1
Redirect index function in ld.so.1.
Optimize the existing strlen function implementations.
This removes warnings coming from optimized index and strlen functions
in ld.so.1.
Patch by Aleksandar Rikalo.
Modified:
trunk/coregrind/m_redir.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/coregrind/m_redir.c
==============================================================================
--- trunk/coregrind/m_redir.c (original)
+++ trunk/coregrind/m_redir.c Fri Nov 4 18:21:22 2016
@@ -1567,10 +1567,15 @@
/* this is mandatory - can't sanely continue without it */
add_hardwired_spec(
- "ld.so.3", "strlen",
+ "ld.so.1", "strlen",
(Addr)&VG_(mips32_linux_REDIR_FOR_strlen),
complain_about_stripped_glibc_ldso
);
+ add_hardwired_spec(
+ "ld.so.1", "index",
+ (Addr)&VG_(mips32_linux_REDIR_FOR_index),
+ complain_about_stripped_glibc_ldso
+ );
}
# elif defined(VGP_mips64_linux)
@@ -1578,10 +1583,15 @@
/* this is mandatory - can't sanely continue without it */
add_hardwired_spec(
- "ld.so.3", "strlen",
+ "ld.so.1", "strlen",
(Addr)&VG_(mips64_linux_REDIR_FOR_strlen),
complain_about_stripped_glibc_ldso
);
+ add_hardwired_spec(
+ "ld.so.1", "index",
+ (Addr)&VG_(mips64_linux_REDIR_FOR_index),
+ complain_about_stripped_glibc_ldso
+ );
}
# elif defined(VGP_tilegx_linux)
Modified: trunk/coregrind/m_trampoline.S
==============================================================================
--- trunk/coregrind/m_trampoline.S (original)
+++ trunk/coregrind/m_trampoline.S Fri Nov 4 18:21:22 2016
@@ -1269,24 +1269,43 @@
/* There's no particular reason that this needs to be handwritten
assembly, but since that's what this file contains, here's a
- simple strlen implementation (written in C and compiled by gcc.)
+ simple index() and strlen() implementations.
*/
+
+.set push
+.set noreorder
+
+.global VG_(mips32_linux_REDIR_FOR_index)
+.type VG_(mips32_linux_REDIR_FOR_index), @function
+VG_(mips32_linux_REDIR_FOR_index):
+ move $v0, $a0
+ index_loop:
+ lbu $t0, 0($v0)
+ beq $t0, $a1, index_end
+ nop
+ bne $t0, $zero, index_loop
+ addiu $v0, $v0, 1
+ move $v0, $zero
+ index_end:
+ jr $ra
+ nop
+.size VG_(mips32_linux_REDIR_FOR_index), .-VG_(mips32_linux_REDIR_FOR_index)
+
.global VG_(mips32_linux_REDIR_FOR_strlen)
.type VG_(mips32_linux_REDIR_FOR_strlen), @function
VG_(mips32_linux_REDIR_FOR_strlen):
- li $v0, 0
- //la $a0, string
- j strlen_cond
+ move $v0, $a0
strlen_loop:
- addiu $v0, $v0, 1
- addiu $a0, $a0, 1
- strlen_cond:
- lbu $t0, ($a0)
+ lbu $t0, 0($a0)
bne $t0, $zero, strlen_loop
- jr $ra
-
+ addiu $a0, $a0, 1
+ subu $v0, $a0, $v0
+ jr $ra
+ addiu $v0, $v0, -1
.size VG_(mips32_linux_REDIR_FOR_strlen), .-VG_(mips32_linux_REDIR_FOR_strlen)
+.set pop
+
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
@@ -1319,30 +1338,43 @@
/* There's no particular reason that this needs to be handwritten
assembly, but since that's what this file contains, here's a
- simple strlen implementation (written in C and compiled by gcc.)
+ simple index() and strlen() implementations.
*/
+
+.set push
+.set noreorder
+
+.global VG_(mips64_linux_REDIR_FOR_index)
+.type VG_(mips64_linux_REDIR_FOR_index), @function
+VG_(mips64_linux_REDIR_FOR_index):
+ move $v0, $a0
+ index_loop:
+ lbu $t0, 0($v0)
+ beq $t0, $a1, index_end
+ nop
+ bne $t0, $zero, index_loop
+ daddiu $v0, $v0, 1
+ move $v0, $zero
+ index_end:
+ jr $ra
+ nop
+.size VG_(mips64_linux_REDIR_FOR_index), .-VG_(mips64_linux_REDIR_FOR_index)
+
.global VG_(mips64_linux_REDIR_FOR_strlen)
.type VG_(mips64_linux_REDIR_FOR_strlen), @function
VG_(mips64_linux_REDIR_FOR_strlen):
- lbu $12, 0($4)
- li $13, 0
- beq $12, $0, M01
- nop
-
-M02:
- addiu $13, $13, 1
- addiu $4, $4, 1
- lbu $12, 0($4)
- bne $12, $0, M02
- nop
-
-M01:
- move $2, $13
- jr $31
- nop
-
+ move $v0, $a0
+ strlen_loop:
+ lbu $t0, 0($a0)
+ bne $t0, $zero, strlen_loop
+ daddiu $a0, $a0, 1
+ dsubu $v0, $a0, $v0
+ jr $ra
+ daddiu $v0, $v0, -1
.size VG_(mips64_linux_REDIR_FOR_strlen), .-VG_(mips64_linux_REDIR_FOR_strlen)
+.set pop
+
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
Modified: trunk/coregrind/pub_core_trampoline.h
==============================================================================
--- trunk/coregrind/pub_core_trampoline.h (original)
+++ trunk/coregrind/pub_core_trampoline.h Fri Nov 4 18:21:22 2016
@@ -154,11 +154,13 @@
#if defined(VGP_mips32_linux)
extern Addr VG_(mips32_linux_SUBST_FOR_sigreturn);
extern Addr VG_(mips32_linux_SUBST_FOR_rt_sigreturn);
+extern Char* VG_(mips32_linux_REDIR_FOR_index)( const Char*, Int );
extern UInt VG_(mips32_linux_REDIR_FOR_strlen)( void* );
#endif
#if defined(VGP_mips64_linux)
extern Addr VG_(mips64_linux_SUBST_FOR_rt_sigreturn);
+extern Char* VG_(mips64_linux_REDIR_FOR_index)( const Char*, Int );
extern UInt VG_(mips64_linux_REDIR_FOR_strlen)( void* );
#endif
|
|
From: Mark W. <mj...@re...> - 2016-11-04 11:50:38
|
On Fri, 2016-11-04 at 12:32 +0100, Julian Seward wrote: > Some time in the last year or so, V started to complain if attempts to > extend the brk segment failed. This usually never shows with Memcheck > because that replaces malloc and acquires memory from mmap, not brk. > But for tools that don't replace malloc, the message is printed repeatedly, > often many times. For a run of Firefox in Cachegrind, I get 56 instances > of it. This is annoying, also because it doesn't matter that brk will > fail, since the libc malloc then tries mmap instead, and succeeds. > > I would like to turn this into a one-time message, thusly: > > ==2109== brk segment overflow in thread #1: can't grow to 0x4b37000 > ==2109== (see section Limitations in user manual) > ==2109== NOTE: Further instances of this message will not be shown > > Are there any objections to that? The user would still be informed of > the first brk failure, but not spammed with messages, as it currently > stands. No objections here. Maybe make it so that -v will show them all? And if you detect that brk does succeed at a later time then a next fail should also be reported I think. BTW. This might be related to bug #357833. Linux 4.5 changing the definition of RLIMIT_DATA. Cheers, Mark |
|
From: Julian S. <js...@ac...> - 2016-11-04 11:33:02
|
Hi, Some time in the last year or so, V started to complain if attempts to extend the brk segment failed. This usually never shows with Memcheck because that replaces malloc and acquires memory from mmap, not brk. But for tools that don't replace malloc, the message is printed repeatedly, often many times. For a run of Firefox in Cachegrind, I get 56 instances of it. This is annoying, also because it doesn't matter that brk will fail, since the libc malloc then tries mmap instead, and succeeds. I would like to turn this into a one-time message, thusly: ==2109== brk segment overflow in thread #1: can't grow to 0x4b37000 ==2109== (see section Limitations in user manual) ==2109== NOTE: Further instances of this message will not be shown Are there any objections to that? The user would still be informed of the first brk failure, but not spammed with messages, as it currently stands. J |
|
From: <sv...@va...> - 2016-11-04 03:43:41
|
Author: rhyskidd
Date: Fri Nov 4 03:43:28 2016
New Revision: 16116
Log:
Fix compile error on macOS introduced in r16111. n-i-bz.
m_syswrap/syswrap-generic.c:4148:26: error: use of undeclared identifier 'PID_EXEPATH'
VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)());
^
m_syswrap/syswrap-generic.c:4150:56: error: use of undeclared identifier 'SELF_EXEPATH'
&& (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) {
^
m_syswrap/syswrap-generic.c:4150:56: error: use of undeclared identifier 'SELF_EXEPATH'
m_syswrap/syswrap-generic.c:4151:29: error: use of undeclared identifier 'SELF_EXEFD'
VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd));
^
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c Fri Nov 4 03:43:28 2016
@@ -4129,6 +4129,8 @@
PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 );
+ {
+#if defined(VGO_linux) || defined(VGO_solaris)
#if defined(VGO_linux)
#define PID_EXEPATH "/proc/%d/exe"
#define SELF_EXEPATH "/proc/self/exe"
@@ -4138,7 +4140,6 @@
#define SELF_EXEPATH "/proc/self/path/a.out"
#define SELF_EXEFD "/proc/self/path/%d"
#endif
- {
/*
* Handle the case where readlink is looking at /proc/self/exe or
* /proc/<pid>/exe, or equivalent on Solaris.
@@ -4151,7 +4152,9 @@
VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd));
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,
ARG2, ARG3));
- } else {
+ } else
+#endif
+ {
/* Normal case */
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
}
|
|
From: Rhys K. <rhy...@gm...> - 2016-11-04 03:41:28
|
On 2 November 2016 at 16:59, <sv...@va...> wrote:
> Author: philippe
> Date: Wed Nov 2 20:59:51 2016
> New Revision: 16111
>
> Log:
> Some small optimisation+some code reformatting
> * Use stack arrays instead of malloc/free
> * ensure msghdr_foreachfield does one single call to foreach_func
> for consecutive fields
> * some small code reformatting or factorisation
>
> Tested on linux, hoping it also works on solaris
>
>
> Modified:
> trunk/coregrind/m_syswrap/syswrap-generic.c
>
> Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
> ============================================================
> ==================
> --- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
> +++ trunk/coregrind/m_syswrap/syswrap-generic.c Wed Nov 2 20:59:51 2016
> @@ -79,8 +79,8 @@
> assume that sp starts near its highest possible value, and can
> only go down to the start of the mmaped segment. */
> seg = VG_(am_find_nsegment)(sp);
> - if (seg &&
> - VG_(am_is_valid_for_client)(sp, 1, VKI_PROT_READ |
> VKI_PROT_WRITE)) {
> + if (seg
> + && VG_(am_is_valid_for_client)(sp, 1, VKI_PROT_READ |
> VKI_PROT_WRITE)) {
> tst->client_stack_highest_byte = (Addr)VG_PGROUNDUP(sp)-1;
> tst->client_stack_szB = tst->client_stack_highest_byte - seg->start
> + 1;
>
> @@ -328,8 +328,8 @@
> old_seg = VG_(am_find_nsegment)( old_addr );
> if (old_addr < old_seg->start || old_addr+old_len-1 > old_seg->end)
> goto eINVAL;
> - if (old_seg->kind != SkAnonC && old_seg->kind != SkFileC &&
> - old_seg->kind != SkShmC)
> + if (old_seg->kind != SkAnonC && old_seg->kind != SkFileC
> + && old_seg->kind != SkShmC)
> goto eINVAL;
>
> vg_assert(old_len > 0);
> @@ -969,38 +969,25 @@
> #endif
> }
>
> -static
> -HChar *strdupcat ( const HChar* cc, const HChar *s1, const HChar *s2,
> - ArenaId aid )
> -{
> - UInt len = VG_(strlen) ( s1 ) + VG_(strlen) ( s2 ) + 1;
> - HChar *result = VG_(arena_malloc) ( aid, cc, len );
> - VG_(strcpy) ( result, s1 );
> - VG_(strcat) ( result, s2 );
> - return result;
> -}
> -
> static
> void pre_mem_read_sendmsg ( ThreadId tid, Bool read,
> const HChar *msg, Addr base, SizeT size )
> {
> - HChar *outmsg = strdupcat ( "di.syswrap.pmrs.1",
> - "sendmsg", msg, VG_AR_CORE );
> + HChar outmsg[VG_(strlen)(msg) + 10]; // large enough
> + VG_(sprintf)(outmsg, "sendmsg%s", msg);
> PRE_MEM_READ( outmsg, base, size );
> - VG_(free) ( outmsg );
> }
>
> static
> void pre_mem_write_recvmsg ( ThreadId tid, Bool read,
> const HChar *msg, Addr base, SizeT size )
> {
> - HChar *outmsg = strdupcat ( "di.syswrap.pmwr.1",
> - "recvmsg", msg, VG_AR_CORE );
> + HChar outmsg[VG_(strlen)(msg) + 10]; // large enough
> + VG_(sprintf)(outmsg, "recvmsg%s", msg);
> if ( read )
> PRE_MEM_READ( outmsg, base, size );
> else
> PRE_MEM_WRITE( outmsg, base, size );
> - VG_(free) ( outmsg );
> }
>
> static
> @@ -1021,21 +1008,36 @@
> Bool rekv /* "recv" apparently shadows some header decl on OSX108
> */
> )
> {
> - HChar *fieldName;
> + HChar fieldName[VG_(strlen)(name) + 32]; // large enough.
> + Addr a;
> + SizeT s;
>
> if ( !msg )
> return;
>
> - fieldName = VG_(malloc) ( "di.syswrap.mfef", VG_(strlen)(name) + 32 );
> -
> VG_(sprintf) ( fieldName, "(%s)", name );
>
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_name, sizeof(
> msg->msg_name ) );
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_namelen, sizeof(
> msg->msg_namelen ) );
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_iov, sizeof(
> msg->msg_iov ) );
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_iovlen, sizeof(
> msg->msg_iovlen ) );
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_control, sizeof(
> msg->msg_control ) );
> - foreach_func ( tid, True, fieldName, (Addr)&msg->msg_controllen,
> sizeof( msg->msg_controllen ) );
> + /* FIELDPAIR helps the compiler do one call to foreach_func
> + for consecutive (no holes) fields. */
> +#define FIELDPAIR(f1,f2) \
> + if (offsetof(struct vki_msghdr, f1) + sizeof(msg->f1) \
> + == offsetof(struct vki_msghdr, f2)) \
> + s += sizeof(msg->f2); \
> + else { \
> + foreach_func (tid, True, fieldName, a, s); \
> + a = (Addr)&msg->f2; \
> + s = sizeof(msg->f2); \
> + }
> +
> + a = (Addr)&msg->msg_name;
> + s = sizeof(msg->msg_name);
> + FIELDPAIR(msg_name, msg_namelen);
> + FIELDPAIR(msg_namelen, msg_iov);
> + FIELDPAIR(msg_iov, msg_iovlen);
> + FIELDPAIR(msg_iovlen, msg_control);
> + FIELDPAIR(msg_control, msg_controllen);
> + foreach_func ( tid, True, fieldName, a, s);
> +#undef FIELDPAIR
>
> /* msg_flags is completely ignored for send_mesg, recv_mesg doesn't
> read
> the field, but does write to it. */
> @@ -1054,9 +1056,8 @@
> struct vki_iovec *iov = msg->msg_iov;
> UInt i;
>
> - VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
> -
> if (ML_(safe_to_deref)(&msg->msg_iovlen, sizeof (UInt))) {
> + VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
> foreach_func ( tid, True, fieldName, (Addr)iov,
> msg->msg_iovlen * sizeof( struct vki_iovec ) );
>
> @@ -1073,14 +1074,12 @@
> }
>
> if ( ML_(safe_to_deref) (&msg->msg_control, sizeof (void *))
> - && msg->msg_control )
> - {
> + && msg->msg_control ) {
> VG_(sprintf) ( fieldName, "(%s.msg_control)", name );
> foreach_func ( tid, False, fieldName,
> (Addr)msg->msg_control, msg->msg_controllen );
> }
>
> - VG_(free) ( fieldName );
> }
>
> static void check_cmsg_for_fds(ThreadId tid, struct vki_msghdr *msg)
> @@ -1088,8 +1087,8 @@
> struct vki_cmsghdr *cm = VKI_CMSG_FIRSTHDR(msg);
>
> while (cm) {
> - if (cm->cmsg_level == VKI_SOL_SOCKET &&
> - cm->cmsg_type == VKI_SCM_RIGHTS ) {
> + if (cm->cmsg_level == VKI_SOL_SOCKET
> + && cm->cmsg_type == VKI_SCM_RIGHTS ) {
> Int *fds = (Int *) VKI_CMSG_DATA(cm);
> Int fdc = (cm->cmsg_len - VKI_CMSG_ALIGN(sizeof(struct
> vki_cmsghdr)))
> / sizeof(int);
> @@ -1112,7 +1111,7 @@
> const HChar *description,
> struct vki_sockaddr *sa, UInt salen )
> {
> - HChar *outmsg;
> + HChar outmsg[VG_(strlen)( description ) + 30]; // large enough
> struct vki_sockaddr_un* saun = (struct vki_sockaddr_un *)sa;
> struct vki_sockaddr_in* sin = (struct vki_sockaddr_in *)sa;
> struct vki_sockaddr_in6* sin6 = (struct vki_sockaddr_in6 *)sa;
> @@ -1126,17 +1125,12 @@
> /* NULL/zero-length sockaddrs are legal */
> if ( sa == NULL || salen == 0 ) return;
>
> - outmsg = VG_(malloc) ( "di.syswrap.pmr_sockaddr.1",
> - VG_(strlen)( description ) + 30 );
> -
> VG_(sprintf) ( outmsg, description, "sa_family" );
> PRE_MEM_READ( outmsg, (Addr) &sa->sa_family, sizeof(vki_sa_family_t));
>
> /* Don't do any extra checking if we cannot determine the sa_family. */
> - if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t))) {
> - VG_(free) (outmsg);
> + if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t)))
> return;
> - }
>
> switch (sa->sa_family) {
>
> @@ -1203,8 +1197,6 @@
> salen - sizeof(sa->sa_family));
> break;
> }
> -
> - VG_(free) ( outmsg );
> }
>
> /* Dereference a pointer to a UInt. */
> @@ -3684,8 +3676,7 @@
> UInt size = _VKI_IOC_SIZE(request);
> if (size > 0 && (dir & _VKI_IOC_READ)
> && res == 0
> - && arg != (Addr)NULL)
> - {
> + && arg != (Addr)NULL) {
> POST_MEM_WRITE(arg, size);
> }
> }
> @@ -3836,10 +3827,10 @@
>
> if (grows == VKI_PROT_GROWSDOWN) {
> rseg = VG_(am_next_nsegment)( aseg, False/*backwards*/ );
> - if (rseg &&
> - rseg->kind == SkResvn &&
> - rseg->smode == SmUpper &&
> - rseg->end+1 == aseg->start) {
> + if (rseg
> + && rseg->kind == SkResvn
> + && rseg->smode == SmUpper
> + && rseg->end+1 == aseg->start) {
> Addr end = ARG1 + ARG2;
> ARG1 = aseg->start;
> ARG2 = end - aseg->start;
> @@ -3849,10 +3840,10 @@
> }
> } else if (grows == VKI_PROT_GROWSUP) {
> rseg = VG_(am_next_nsegment)( aseg, True/*forwards*/ );
> - if (rseg &&
> - rseg->kind == SkResvn &&
> - rseg->smode == SmLower &&
> - aseg->end+1 == rseg->start) {
> + if (rseg
> + && rseg->kind == SkResvn
> + && rseg->smode == SmLower
> + && aseg->end+1 == rseg->start) {
> ARG2 = aseg->end - ARG1 + 1;
> ARG3 &= ~VKI_PROT_GROWSUP;
> } else {
> @@ -3993,10 +3984,8 @@
> SysRes sres;
>
> VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
> - if (ML_(safe_to_deref)( arg1s, 1 ) &&
> - (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/cmdline"))
> - )
> - {
> + if (ML_(safe_to_deref)( arg1s, 1 )
> + && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s,
> "/proc/self/cmdline"))) {
> sres = VG_(dup)( VG_(cl_cmdline_fd) );
> SET_STATUS_from_SysRes( sres );
> if (!sr_isError(sres)) {
> @@ -4062,8 +4051,8 @@
> && SimHintiS(SimHint_enable_outer, VG_(clo_sim_hints)))
> ok = True;
> #if defined(VGO_solaris)
> - if (!ok && VG_(vfork_fildes_addr) != NULL &&
> - *VG_(vfork_fildes_addr) >= 0 && *VG_(vfork_fildes_addr) == ARG1)
> + if (!ok && VG_(vfork_fildes_addr) != NULL
> + && *VG_(vfork_fildes_addr) >= 0 && *VG_(vfork_fildes_addr) == ARG1)
> ok = True;
> #endif
> if (!ok)
> @@ -4139,39 +4128,30 @@
> PRE_MEM_RASCIIZ( "readlink(path)", ARG1 );
> PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 );
>
> - {
> +
> #if defined(VGO_linux)
> +#define PID_EXEPATH "/proc/%d/exe"
> +#define SELF_EXEPATH "/proc/self/exe"
> +#define SELF_EXEFD "/proc/self/fd/%d"
> +#elif defined(VGO_solaris)
> +#define PID_EXEPATH "/proc/%d/path/a.out"
> +#define SELF_EXEPATH "/proc/self/path/a.out"
> +#define SELF_EXEFD "/proc/self/path/%d"
> +#endif
>
This changes the logic of the define guards.
Previously #if defined(VGO_linux) would continue to guard this next block
until the #elif defined(VGO_solaris) took over.
The union of #if defined(VGO_linux) || defined(VGO_solaris) does not cover
all platforms that build this file - namely macOS.
I'll send a patch shortly to correct this logic.
> + {
> /*
> * Handle the case where readlink is looking at /proc/self/exe or
> - * /proc/<pid>/exe.
> + * /proc/<pid>/exe, or equivalent on Solaris.
> */
> HChar name[30]; // large enough
> HChar* arg1s = (HChar*) ARG1;
> - VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
> - if (ML_(safe_to_deref)(arg1s, 1) &&
> - (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/exe"))
> - )
> - {
> - VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
> + VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)());
> + if (ML_(safe_to_deref)(arg1s, 1)
> + && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) {
> + VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd));
> SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,
> ARG2, ARG3));
> - } else
> -#elif defined(VGO_solaris)
> - /* Same for Solaris, but /proc/self/path/a.out and
> - /proc/<pid>/path/a.out. */
> - HChar name[30]; // large enough
> - HChar* arg1s = (HChar*) ARG1;
> - VG_(sprintf)(name, "/proc/%d/path/a.out", VG_(getpid)());
> - if (ML_(safe_to_deref)(arg1s, 1) &&
> - (VG_STREQ(arg1s, name) || VG_STREQ(arg1s,
> "/proc/self/path/a.out"))
> - )
> - {
> - VG_(sprintf)(name, "/proc/self/path/%d", VG_(cl_exec_fd));
> - SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,
> - ARG2, ARG3));
> - } else
> -#endif
> - {
> + } else {
> /* Normal case */
> SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2,
> ARG3));
> }
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|
|
From: <sv...@va...> - 2016-11-03 10:50:51
|
Author: sewardj
Date: Thu Nov 3 10:50:42 2016
New Revision: 16115
Log:
Add demangling support for Rust symbols. Derived from a patch by
David Tolnay <dt...@gm...>. n-i-bz.
Modified:
trunk/coregrind/m_demangle/demangle.c
Modified: trunk/coregrind/m_demangle/demangle.c
==============================================================================
--- trunk/coregrind/m_demangle/demangle.c (original)
+++ trunk/coregrind/m_demangle/demangle.c Thu Nov 3 10:50:42 2016
@@ -10,6 +10,10 @@
Copyright (C) 2000-2015 Julian Seward
js...@ac...
+ Rust demangler components are
+ Copyright (C) 2016-2016 David Tolnay
+ dt...@gm...
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -39,12 +43,26 @@
#include "vg_libciface.h"
#include "demangle.h"
+/* fwds */
+static Bool rust_is_mangled ( const HChar* );
+static void rust_demangle_sym ( HChar* );
+
+
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+
/* The demangler's job is to take a raw symbol name and turn it into
- something a Human Bean can understand. There are two levels of
- mangling.
+ something a Human Bean can understand. Our mangling model
+ comprises a three stage pipeline. Mangling pushes names forward
+ through the pipeline (0, then 1, then 2) and demangling is
+ obviously the reverse. In practice it is highly unlikely that a
+ name would require all stages, but it is not impossible either.
- 1. First, C++ names are mangled by the compiler. So we'll have to
- undo that.
+ 0. If we're working with Rust, Rust names are lightly mangled by
+ the Rust front end.
+
+ 1. Then the name is subject to standard C++ mangling.
2. Optionally, in relatively rare cases, the resulting name is then
itself encoded using Z-escaping (see pub_core_redir.h) so as to
@@ -52,20 +70,32 @@
Therefore, VG_(demangle) first tries to undo (2). If successful,
the soname part is discarded (humans don't want to see that).
- Then, it tries to undo (1) (using demangling code from GNU/FSF).
+ Then, it tries to undo (1) (using demangling code from GNU/FSF) and
+ finally it tries to undo (0).
- Finally, change the name of all symbols which are known to be
+ Finally, it changes the name of all symbols which are known to be
functions below main() to "(below main)". This helps reduce
variability of stack traces, something which has been a problem for
the testsuite for a long time.
--------
- If do_cxx_demangle == True, does all the above stages:
+ If do_cxx_demangle == True, it does all the above stages:
- undo (2) [Z-encoding]
- undo (1) [C++ mangling]
+ - if (1) succeeds, undo (0) [Rust mangling]
- do the below-main hack
- If do_cxx_demangle == False, the middle stage is skipped:
+ Rust demangling (0) is only done if C++ demangling (1) succeeds
+ because Rust demangling is performed in-place, and it is difficult
+ to prove that we "own" the storage -- hence, that the in-place
+ operation is safe -- unless it is clear that it has come from the
+ C++ demangler, which returns its output in a heap-allocated buffer
+ which we can be sure we own. In practice (Nov 2016) this does not
+ seem to be a problem, since the Rust compiler appears to apply C++
+ mangling after Rust mangling, so we never encounter symbols that
+ require Rust demangling but not C++ demangling.
+
+ If do_cxx_demangle == False, the C++ and Rust stags are skipped:
- undo (2) [Z-encoding]
- do the below-main hack
*/
@@ -89,7 +119,7 @@
that buffer is owned by VG_(demangle). That means two things:
(1) Users of VG_(demangle) must not free that buffer.
(2) If the demangled name needs to be stashed away for later use,
- the contents of the buffer needs to be copied. It is not sufficient
+ the contents of the buffer need to be copied. It is not sufficient
to just store the pointer as it will point to deallocated memory
after the next VG_(demangle) invocation. */
void VG_(demangle) ( Bool do_cxx_demangling, Bool do_z_demangling,
@@ -112,14 +142,35 @@
/* Possibly undo (1) */
if (do_cxx_demangling && VG_(clo_demangle)) {
+ /* !!! vvv STATIC vvv !!! */
static HChar* demangled = NULL;
+ /* !!! ^^^ STATIC ^^^ !!! */
/* Free up previously demangled name */
- if (demangled) VG_(arena_free) (VG_AR_DEMANGLE, demangled);
-
+ if (demangled) {
+ VG_(arena_free) (VG_AR_DEMANGLE, demangled);
+ demangled = NULL;
+ }
demangled = ML_(cplus_demangle) ( orig, DMGL_ANSI | DMGL_PARAMS );
*result = (demangled == NULL) ? orig : demangled;
+
+ if (demangled) {
+ /* Possibly undo (0). This is the only place where it is
+ safe, from a storage management perspective, to
+ Rust-demangle the symbol. That's because Rust demangling
+ happens in place, so we need to be sure that the storage
+ it is happening in is actually owned by us, and non-const.
+ In this case, the value returned by ML_(cplus_demangle)
+ does have that property. */
+ if (rust_is_mangled(demangled)) {
+ rust_demangle_sym(demangled);
+ }
+ *result = demangled;
+ } else {
+ *result = orig;
+ }
+
} else {
*result = orig;
}
@@ -356,6 +407,297 @@
}
+/*------------------------------------------------------------*/
+/*--- DEMANGLE RUST NAMES ---*/
+/*------------------------------------------------------------*/
+
+/*
+ * Mangled Rust symbols look like this:
+ *
+ * _$LT$std..sys..fd..FileDesc$u20$as$u20$core..ops..Drop$GT$::drop::hc68340e1baa4987a
+ *
+ * The original symbol is:
+ *
+ * <std::sys::fd::FileDesc as core::ops::Drop>::drop
+ *
+ * The last component of the path is a 64-bit hash in lowercase hex, prefixed
+ * with "h". Rust does not have a global namespace between crates, an illusion
+ * which Rust maintains by using the hash to distinguish things that would
+ * otherwise have the same symbol.
+ *
+ * Any path component not starting with a XID_Start character is prefixed with
+ * "_".
+ *
+ * The following escape sequences are used:
+ *
+ * "," => $C$
+ * "@" => $SP$
+ * "*" => $BP$
+ * "&" => $RF$
+ * "<" => $LT$
+ * ">" => $GT$
+ * "(" => $LP$
+ * ")" => $RP$
+ * " " => $u20$
+ * "\"" => $u22$
+ * "'" => $u27$
+ * "+" => $u2b$
+ * ";" => $u3b$
+ * "[" => $u5b$
+ * "]" => $u5d$
+ * "{" => $u7b$
+ * "}" => $u7d$
+ * "~" => $u7e$
+ *
+ * A double ".." means "::" and a single "." means "-".
+ *
+ * The only characters allowed in the mangled symbol are a-zA-Z0-9 and _.:$
+ */
+
+static const HChar *hash_prefix = "::h";
+static const SizeT hash_prefix_len = 3;
+static const SizeT hash_len = 16;
+
+static Bool is_prefixed_hash(const HChar *start);
+static Bool looks_like_rust(const HChar *sym, SizeT len);
+static Bool unescape(const HChar **in, HChar **out,
+ const HChar *seq, HChar value);
+
+/*
+ * INPUT:
+ * sym: symbol that has been through BFD-demangling
+ *
+ * This function looks for the following indicators:
+ *
+ * 1. The hash must consist of "h" followed by 16 lowercase hex digits.
+ *
+ * 2. As a sanity check, the hash must use between 5 and 15 of the 16 possible
+ * hex digits. This is true of 99.9998% of hashes so once in your life you
+ * may see a false negative. The point is to notice path components that
+ * could be Rust hashes but are probably not, like "haaaaaaaaaaaaaaaa". In
+ * this case a false positive (non-Rust symbol has an important path
+ * component removed because it looks like a Rust hash) is worse than a
+ * false negative (the rare Rust symbol is not demangled) so this sets the
+ * balance in favor of false negatives.
+ *
+ * 3. There must be no characters other than a-zA-Z0-9 and _.:$
+ *
+ * 4. There must be no unrecognized $-sign sequences.
+ *
+ * 5. There must be no sequence of three or more dots in a row ("...").
+ */
+static Bool rust_is_mangled(const HChar *sym)
+{
+ SizeT len, len_without_hash;
+
+ if (!sym)
+ return False;
+
+ len = VG_(strlen)(sym);
+ if (len <= hash_prefix_len + hash_len)
+ /* Not long enough to contain "::h" + hash + something else */
+ return False;
+
+ len_without_hash = len - (hash_prefix_len + hash_len);
+ if (!is_prefixed_hash(sym + len_without_hash))
+ return False;
+
+ return looks_like_rust(sym, len_without_hash);
+}
+
+/*
+ * A hash is the prefix "::h" followed by 16 lowercase hex digits. The hex
+ * digits must comprise between 5 and 15 (inclusive) distinct digits.
+ */
+static Bool is_prefixed_hash(const HChar *str)
+{
+ const HChar *end;
+ Bool seen[16];
+ SizeT i;
+ Int count;
+
+ if (VG_(strncmp)(str, hash_prefix, hash_prefix_len))
+ return False;
+ str += hash_prefix_len;
+
+ VG_(memset)(seen, False, sizeof(seen));
+ for (end = str + hash_len; str < end; str++)
+ if (*str >= '0' && *str <= '9')
+ seen[*str - '0'] = True;
+ else if (*str >= 'a' && *str <= 'f')
+ seen[*str - 'a' + 10] = True;
+ else
+ return False;
+
+ /* Count how many distinct digits seen */
+ count = 0;
+ for (i = 0; i < 16; i++)
+ if (seen[i])
+ count++;
+
+ return count >= 5 && count <= 15;
+}
+
+static Bool looks_like_rust(const HChar *str, SizeT len)
+{
+ const HChar *end = str + len;
+
+ while (str < end) {
+ switch (*str) {
+ case '$':
+ if (!VG_(strncmp)(str, "$C$", 3))
+ str += 3;
+ else if (!VG_(strncmp)(str, "$SP$", 4)
+ || !VG_(strncmp)(str, "$BP$", 4)
+ || !VG_(strncmp)(str, "$RF$", 4)
+ || !VG_(strncmp)(str, "$LT$", 4)
+ || !VG_(strncmp)(str, "$GT$", 4)
+ || !VG_(strncmp)(str, "$LP$", 4)
+ || !VG_(strncmp)(str, "$RP$", 4))
+ str += 4;
+ else if (!VG_(strncmp)(str, "$u20$", 5)
+ || !VG_(strncmp)(str, "$u22$", 5)
+ || !VG_(strncmp)(str, "$u27$", 5)
+ || !VG_(strncmp)(str, "$u2b$", 5)
+ || !VG_(strncmp)(str, "$u3b$", 5)
+ || !VG_(strncmp)(str, "$u5b$", 5)
+ || !VG_(strncmp)(str, "$u5d$", 5)
+ || !VG_(strncmp)(str, "$u7b$", 5)
+ || !VG_(strncmp)(str, "$u7d$", 5)
+ || !VG_(strncmp)(str, "$u7e$", 5))
+ str += 5;
+ else
+ return False;
+ break;
+ case '.':
+ /* Do not allow three or more consecutive dots */
+ if (!VG_(strncmp)(str, "...", 3))
+ return False;
+ /* Fall through */
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ case '0' ... '9':
+ case '_':
+ case ':':
+ str++;
+ break;
+ default:
+ return False;
+ }
+ }
+
+ return True;
+}
+
+/*
+ * INPUT:
+ * sym: symbol for which rust_is_mangled(sym) returns True
+ *
+ * The input is demangled in-place because the mangled name is always longer
+ * than the demangled one.
+ */
+static void rust_demangle_sym(HChar *sym)
+{
+ const HChar *in;
+ HChar *out;
+ const HChar *end;
+
+ if (!sym)
+ return;
+
+ const SizeT sym_len = VG_(strlen)(sym);
+ const HChar* never_after = sym + sym_len;
+
+ in = sym;
+ out = sym;
+ end = sym + sym_len - (hash_prefix_len + hash_len);
+
+ while (in < end) {
+ switch (*in) {
+ case '$':
+ if (!(unescape(&in, &out, "$C$", ',')
+ || unescape(&in, &out, "$SP$", '@')
+ || unescape(&in, &out, "$BP$", '*')
+ || unescape(&in, &out, "$RF$", '&')
+ || unescape(&in, &out, "$LT$", '<')
+ || unescape(&in, &out, "$GT$", '>')
+ || unescape(&in, &out, "$LP$", '(')
+ || unescape(&in, &out, "$RP$", ')')
+ || unescape(&in, &out, "$u20$", ' ')
+ || unescape(&in, &out, "$u22$", '\"')
+ || unescape(&in, &out, "$u27$", '\'')
+ || unescape(&in, &out, "$u2b$", '+')
+ || unescape(&in, &out, "$u3b$", ';')
+ || unescape(&in, &out, "$u5b$", '[')
+ || unescape(&in, &out, "$u5d$", ']')
+ || unescape(&in, &out, "$u7b$", '{')
+ || unescape(&in, &out, "$u7d$", '}')
+ || unescape(&in, &out, "$u7e$", '~'))) {
+ goto fail;
+ }
+ break;
+ case '_':
+ /*
+ * If this is the start of a path component and the next
+ * character is an escape sequence, ignore the
+ * underscore. The mangler inserts an underscore to make
+ * sure the path component begins with a XID_Start
+ * character.
+ */
+ if ((in == sym || in[-1] == ':') && in[1] == '$')
+ in++;
+ else
+ *out++ = *in++;
+ break;
+ case '.':
+ if (in[1] == '.') {
+ /* ".." becomes "::" */
+ *out++ = ':';
+ *out++ = ':';
+ in += 2;
+ } else {
+ /* "." becomes "-" */
+ *out++ = '-';
+ in++;
+ }
+ break;
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ case '0' ... '9':
+ case ':':
+ *out++ = *in++;
+ break;
+ default:
+ goto fail;
+ }
+ }
+ goto done;
+
+ fail:
+ *out++ = '?'; /* This is pretty lame, but it's hard to do better. */
+ done:
+ *out++ = '\0';
+
+ vg_assert(out <= never_after);
+}
+
+static Bool unescape(const HChar **in, HChar **out,
+ const HChar *seq, HChar value)
+{
+ SizeT len = VG_(strlen)(seq);
+
+ if (VG_(strncmp)(*in, seq, len))
+ return False;
+
+ **out = value;
+
+ *in += len;
+ *out += 1;
+
+ return True;
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2016-11-02 22:33:27
|
Author: iraisr
Date: Wed Nov 2 22:33:16 2016
New Revision: 16114
Log:
Move scalar test of lwp_private syscall to platform specific directories
n-i-bz
Added:
trunk/memcheck/tests/amd64-solaris/scalar.c
trunk/memcheck/tests/amd64-solaris/scalar.stderr.exp
trunk/memcheck/tests/amd64-solaris/scalar.stdout.exp
trunk/memcheck/tests/amd64-solaris/scalar.vgtest
Modified:
trunk/memcheck/tests/amd64-solaris/ (props changed)
trunk/memcheck/tests/amd64-solaris/Makefile.am
trunk/memcheck/tests/solaris/scalar.c
trunk/memcheck/tests/solaris/scalar.stderr.exp
trunk/memcheck/tests/x86-solaris/Makefile.am
trunk/memcheck/tests/x86-solaris/scalar.c
trunk/memcheck/tests/x86-solaris/scalar.stderr.exp
Modified: trunk/memcheck/tests/amd64-solaris/Makefile.am
==============================================================================
--- trunk/memcheck/tests/amd64-solaris/Makefile.am (original)
+++ trunk/memcheck/tests/amd64-solaris/Makefile.am Wed Nov 2 22:33:16 2016
@@ -9,7 +9,8 @@
context_rflags.stderr.exp context_rflags.stdout.exp context_rflags.vgtest \
context_rflags2.stderr.exp context_rflags2.stdout.exp context_rflags2.vgtest \
context_sse.stderr.exp context_sse.stdout.exp context_sse.vgtest \
- ldsoexec.stderr.exp ldsoexec.vgtest
+ ldsoexec.stderr.exp ldsoexec.vgtest \
+ scalar.stderr.exp scalar.stdout.exp scalar.vgtest
check_PROGRAMS = \
context_fpu \
@@ -17,9 +18,11 @@
context_rflags \
context_rflags2 \
context_sse \
- ldsoexec
+ ldsoexec \
+ scalar
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
AM_CCASFLAGS += @FLAG_M64@
+scalar_CFLAGS = $(AM_CFLAGS) -I../solaris
Added: trunk/memcheck/tests/amd64-solaris/scalar.c
==============================================================================
--- trunk/memcheck/tests/amd64-solaris/scalar.c (added)
+++ trunk/memcheck/tests/amd64-solaris/scalar.c Wed Nov 2 22:33:16 2016
@@ -0,0 +1,18 @@
+/* Basic syscall test for Solaris/amd64 specific syscalls. */
+
+#include "scalar.h"
+
+#include <sys/lwp.h>
+
+int main(void)
+{
+ /* Uninitialised, but we know px[0] is 0x0. */
+ long *px = malloc(sizeof(long));
+ x0 = px[0];
+
+ /* SYS_lwp_private 166 */
+ GO(SYS_lwp_private, "3s 1m");
+ SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_FSBASE, x0); FAIL;
+
+ return 0;
+}
Added: trunk/memcheck/tests/amd64-solaris/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/amd64-solaris/scalar.stderr.exp (added)
+++ trunk/memcheck/tests/amd64-solaris/scalar.stderr.exp Wed Nov 2 22:33:16 2016
@@ -0,0 +1,16 @@
+---------------------------------------------------------
+166: SYS_lwp_private 3s 1m
+---------------------------------------------------------
+Syscall param lwp_private(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(which) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(base) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(base) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
Added: trunk/memcheck/tests/amd64-solaris/scalar.stdout.exp
==============================================================================
(empty)
Added: trunk/memcheck/tests/amd64-solaris/scalar.vgtest
==============================================================================
--- trunk/memcheck/tests/amd64-solaris/scalar.vgtest (added)
+++ trunk/memcheck/tests/amd64-solaris/scalar.vgtest Wed Nov 2 22:33:16 2016
@@ -0,0 +1,3 @@
+prog: scalar
+vgopts: -q
+stderr_filter_args:
Modified: trunk/memcheck/tests/solaris/scalar.c
==============================================================================
--- trunk/memcheck/tests/solaris/scalar.c (original)
+++ trunk/memcheck/tests/solaris/scalar.c Wed Nov 2 22:33:16 2016
@@ -9,7 +9,6 @@
#include <sys/door.h>
#include <sys/fcntl.h>
#include <sys/fstyp.h>
-#include <sys/lwp.h>
#include <sys/mman.h>
#include <sys/modctl.h>
#include <sys/mount.h>
@@ -2138,14 +2137,7 @@
SY(SYS_lwp_sigmask, x0, x0, x0, x0, x0); FAIL;
/* SYS_lwp_private 166 */
- GO(SYS_lwp_private, "3s 1m");
-#if defined(__i386)
- SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_GSBASE, x0); FAIL;
-#elif defined(__amd64)
- SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_FSBASE, x0); FAIL;
-#else
-#error Unsupported platform
-#endif
+ /* Tested in amd64-solaris/scalar and x86-solaris/scalar */
/* SYS_lwp_wait 167 */
GO(SYS_lwp_wait, "2s 1m");
Modified: trunk/memcheck/tests/solaris/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/solaris/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/solaris/scalar.stderr.exp Wed Nov 2 22:33:16 2016
@@ -2652,22 +2652,6 @@
sigprocmask: unknown 'how' field 0
---------------------------------------------------------
-166: SYS_lwp_private 3s 1m
----------------------------------------------------------
-Syscall param lwp_private(cmd) contains uninitialised byte(s)
- ...
-
-Syscall param lwp_private(which) contains uninitialised byte(s)
- ...
-
-Syscall param lwp_private(base) contains uninitialised byte(s)
- ...
-
-Syscall param lwp_private(base) points to unaddressable byte(s)
- ...
- Address 0x........ is not stack'd, malloc'd or (recently) free'd
-
----------------------------------------------------------
167: SYS_lwp_wait 2s 1m
---------------------------------------------------------
Syscall param lwp_wait(lwpid) contains uninitialised byte(s)
Modified: trunk/memcheck/tests/x86-solaris/Makefile.am
==============================================================================
--- trunk/memcheck/tests/x86-solaris/Makefile.am (original)
+++ trunk/memcheck/tests/x86-solaris/Makefile.am Wed Nov 2 22:33:16 2016
@@ -30,3 +30,4 @@
AM_CXXFLAGS += @FLAG_M32@
AM_CCASFLAGS += @FLAG_M32@
+scalar_CFLAGS = $(AM_CFLAGS) -I../solaris
Modified: trunk/memcheck/tests/x86-solaris/scalar.c
==============================================================================
--- trunk/memcheck/tests/x86-solaris/scalar.c (original)
+++ trunk/memcheck/tests/x86-solaris/scalar.c Wed Nov 2 22:33:16 2016
@@ -1,9 +1,10 @@
/* Basic syscall test for Solaris/x86 specific syscalls. */
-#include "../solaris/scalar.h"
+#include "scalar.h"
#include <string.h>
#include <sys/fcntl.h>
+#include <sys/lwp.h>
#include <sys/statvfs.h>
/* Helper functions. These are necessary if we've got two tests for a single
@@ -63,6 +64,10 @@
sys_openat64();
sys_openat642();
+ /* SYS_lwp_private 166 */
+ GO(SYS_lwp_private, "3s 1m");
+ SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_GSBASE, x0); FAIL;
+
/* SYS_llseek 175 */
GO(SYS_llseek, "4s 0m");
SY(SYS_llseek, x0 - 1, x0, x0, x0); FAILx(EBADF);
Modified: trunk/memcheck/tests/x86-solaris/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/x86-solaris/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/x86-solaris/scalar.stderr.exp Wed Nov 2 22:33:16 2016
@@ -57,6 +57,22 @@
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
+166: SYS_lwp_private 3s 1m
+---------------------------------------------------------
+Syscall param lwp_private(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(which) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(base) contains uninitialised byte(s)
+ ...
+
+Syscall param lwp_private(base) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
175: SYS_llseek 4s 0m
---------------------------------------------------------
Syscall param llseek(fildes) contains uninitialised byte(s)
|
|
From: <sv...@va...> - 2016-11-02 22:07:18
|
Author: iraisr
Date: Wed Nov 2 22:07:11 2016
New Revision: 16113
Log:
Fix compiler warning about unused function on Solaris
Modified:
trunk/tests/libc_test.c
Modified: trunk/tests/libc_test.c
==============================================================================
--- trunk/tests/libc_test.c (original)
+++ trunk/tests/libc_test.c Wed Nov 2 22:07:11 2016
@@ -19,7 +19,7 @@
typedef int Bool;
/* Assumes the versions are x.y.z, with y and z optional. */
-static Bool matches_version(char *min_version) {
+static __attribute__((unused)) Bool matches_version(char *min_version) {
int a1=0, a2=0, a3=0, g1=0, g2=0, g3=0; // 'a' = actual; 'g' = given
const char *aversion;
|
|
From: <sv...@va...> - 2016-11-02 21:50:26
|
Author: iraisr
Date: Wed Nov 2 21:50:19 2016
New Revision: 16112
Log:
Support '%' in symbol Z-encoding.
Fixes BZ #371869.
Modified:
trunk/NEWS
trunk/coregrind/m_demangle/demangle.c
trunk/include/pub_tool_redir.h
trunk/shared/vg_replace_strmem.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Nov 2 21:50:19 2016
@@ -21,7 +21,8 @@
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
where XXXXXX is the bug number as listed below.
-371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
+371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
+371869 support '%' in symbol Z-encoding
Modified: trunk/coregrind/m_demangle/demangle.c
==============================================================================
--- trunk/coregrind/m_demangle/demangle.c (original)
+++ trunk/coregrind/m_demangle/demangle.c Wed Nov 2 21:50:19 2016
@@ -281,6 +281,7 @@
case 'A': EMITSO('@'); break;
case 'D': EMITSO('$'); break;
case 'L': EMITSO('('); break;
+ case 'P': EMITSO('%'); break;
case 'R': EMITSO(')'); break;
case 'S': EMITSO('/'); break;
case 'Z': EMITSO('Z'); break;
@@ -331,7 +332,9 @@
case 'A': EMITFN('@'); break;
case 'D': EMITFN('$'); break;
case 'L': EMITFN('('); break;
+ case 'P': EMITFN('%'); break;
case 'R': EMITFN(')'); break;
+ case 'S': EMITFN('/'); break;
case 'Z': EMITFN('Z'); break;
default: error = True; goto out;
}
Modified: trunk/include/pub_tool_redir.h
==============================================================================
--- trunk/include/pub_tool_redir.h (original)
+++ trunk/include/pub_tool_redir.h Wed Nov 2 21:50:19 2016
@@ -185,9 +185,10 @@
@ --> ZA (at)
$ --> ZD (dollar)
( --> ZL (left)
+ % --> ZP (percent)
) --> ZR (right)
+ / --> ZS (slash)
Z --> ZZ (Z)
- / --> ZS (slash)
Everything else is left unchanged.
*/
Modified: trunk/shared/vg_replace_strmem.c
==============================================================================
--- trunk/shared/vg_replace_strmem.c (original)
+++ trunk/shared/vg_replace_strmem.c Wed Nov 2 21:50:19 2016
@@ -1040,6 +1040,7 @@
#elif defined(VGO_solaris)
MEMCPY(VG_Z_LIBC_SONAME, memcpy)
+ MEMCPY(VG_Z_LIBC_SONAME, memcpyZPZa)
MEMCPY(VG_Z_LD_SO_1, memcpy)
#endif
@@ -1187,9 +1188,9 @@
pointless. */
#define MEMSET(soname, fnname) \
- void* VG_REPLACE_FUNCTION_EZU(20210,soname,fnname) \
+ void* VG_REPLACE_FUNCTION_EZZ(20210,soname,fnname) \
(void *s, Int c, SizeT n); \
- void* VG_REPLACE_FUNCTION_EZU(20210,soname,fnname) \
+ void* VG_REPLACE_FUNCTION_EZZ(20210,soname,fnname) \
(void *s, Int c, SizeT n) \
{ \
if (sizeof(void*) == 8) { \
@@ -1240,6 +1241,7 @@
#elif defined(VGO_solaris)
MEMSET(VG_Z_LIBC_SONAME, memset)
+ MEMSET(VG_Z_LIBC_SONAME, memsetZPZa)
#endif
@@ -1269,6 +1271,7 @@
#elif defined(VGO_solaris)
MEMMOVE(VG_Z_LIBC_SONAME, memmove)
+ MEMMOVE(VG_Z_LIBC_SONAME, memmoveZPZa)
MEMMOVE(VG_Z_LD_SO_1, memmove)
#endif
|
|
From: <sv...@va...> - 2016-11-02 21:00:00
|
Author: philippe
Date: Wed Nov 2 20:59:51 2016
New Revision: 16111
Log:
Some small optimisation+some code reformatting
* Use stack arrays instead of malloc/free
* ensure msghdr_foreachfield does one single call to foreach_func
for consecutive fields
* some small code reformatting or factorisation
Tested on linux, hoping it also works on solaris
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c Wed Nov 2 20:59:51 2016
@@ -79,8 +79,8 @@
assume that sp starts near its highest possible value, and can
only go down to the start of the mmaped segment. */
seg = VG_(am_find_nsegment)(sp);
- if (seg &&
- VG_(am_is_valid_for_client)(sp, 1, VKI_PROT_READ | VKI_PROT_WRITE)) {
+ if (seg
+ && VG_(am_is_valid_for_client)(sp, 1, VKI_PROT_READ | VKI_PROT_WRITE)) {
tst->client_stack_highest_byte = (Addr)VG_PGROUNDUP(sp)-1;
tst->client_stack_szB = tst->client_stack_highest_byte - seg->start + 1;
@@ -328,8 +328,8 @@
old_seg = VG_(am_find_nsegment)( old_addr );
if (old_addr < old_seg->start || old_addr+old_len-1 > old_seg->end)
goto eINVAL;
- if (old_seg->kind != SkAnonC && old_seg->kind != SkFileC &&
- old_seg->kind != SkShmC)
+ if (old_seg->kind != SkAnonC && old_seg->kind != SkFileC
+ && old_seg->kind != SkShmC)
goto eINVAL;
vg_assert(old_len > 0);
@@ -969,38 +969,25 @@
#endif
}
-static
-HChar *strdupcat ( const HChar* cc, const HChar *s1, const HChar *s2,
- ArenaId aid )
-{
- UInt len = VG_(strlen) ( s1 ) + VG_(strlen) ( s2 ) + 1;
- HChar *result = VG_(arena_malloc) ( aid, cc, len );
- VG_(strcpy) ( result, s1 );
- VG_(strcat) ( result, s2 );
- return result;
-}
-
static
void pre_mem_read_sendmsg ( ThreadId tid, Bool read,
const HChar *msg, Addr base, SizeT size )
{
- HChar *outmsg = strdupcat ( "di.syswrap.pmrs.1",
- "sendmsg", msg, VG_AR_CORE );
+ HChar outmsg[VG_(strlen)(msg) + 10]; // large enough
+ VG_(sprintf)(outmsg, "sendmsg%s", msg);
PRE_MEM_READ( outmsg, base, size );
- VG_(free) ( outmsg );
}
static
void pre_mem_write_recvmsg ( ThreadId tid, Bool read,
const HChar *msg, Addr base, SizeT size )
{
- HChar *outmsg = strdupcat ( "di.syswrap.pmwr.1",
- "recvmsg", msg, VG_AR_CORE );
+ HChar outmsg[VG_(strlen)(msg) + 10]; // large enough
+ VG_(sprintf)(outmsg, "recvmsg%s", msg);
if ( read )
PRE_MEM_READ( outmsg, base, size );
else
PRE_MEM_WRITE( outmsg, base, size );
- VG_(free) ( outmsg );
}
static
@@ -1021,21 +1008,36 @@
Bool rekv /* "recv" apparently shadows some header decl on OSX108 */
)
{
- HChar *fieldName;
+ HChar fieldName[VG_(strlen)(name) + 32]; // large enough.
+ Addr a;
+ SizeT s;
if ( !msg )
return;
- fieldName = VG_(malloc) ( "di.syswrap.mfef", VG_(strlen)(name) + 32 );
-
VG_(sprintf) ( fieldName, "(%s)", name );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_name, sizeof( msg->msg_name ) );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_namelen, sizeof( msg->msg_namelen ) );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_iov, sizeof( msg->msg_iov ) );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_iovlen, sizeof( msg->msg_iovlen ) );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_control, sizeof( msg->msg_control ) );
- foreach_func ( tid, True, fieldName, (Addr)&msg->msg_controllen, sizeof( msg->msg_controllen ) );
+ /* FIELDPAIR helps the compiler do one call to foreach_func
+ for consecutive (no holes) fields. */
+#define FIELDPAIR(f1,f2) \
+ if (offsetof(struct vki_msghdr, f1) + sizeof(msg->f1) \
+ == offsetof(struct vki_msghdr, f2)) \
+ s += sizeof(msg->f2); \
+ else { \
+ foreach_func (tid, True, fieldName, a, s); \
+ a = (Addr)&msg->f2; \
+ s = sizeof(msg->f2); \
+ }
+
+ a = (Addr)&msg->msg_name;
+ s = sizeof(msg->msg_name);
+ FIELDPAIR(msg_name, msg_namelen);
+ FIELDPAIR(msg_namelen, msg_iov);
+ FIELDPAIR(msg_iov, msg_iovlen);
+ FIELDPAIR(msg_iovlen, msg_control);
+ FIELDPAIR(msg_control, msg_controllen);
+ foreach_func ( tid, True, fieldName, a, s);
+#undef FIELDPAIR
/* msg_flags is completely ignored for send_mesg, recv_mesg doesn't read
the field, but does write to it. */
@@ -1054,9 +1056,8 @@
struct vki_iovec *iov = msg->msg_iov;
UInt i;
- VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
-
if (ML_(safe_to_deref)(&msg->msg_iovlen, sizeof (UInt))) {
+ VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
foreach_func ( tid, True, fieldName, (Addr)iov,
msg->msg_iovlen * sizeof( struct vki_iovec ) );
@@ -1073,14 +1074,12 @@
}
if ( ML_(safe_to_deref) (&msg->msg_control, sizeof (void *))
- && msg->msg_control )
- {
+ && msg->msg_control ) {
VG_(sprintf) ( fieldName, "(%s.msg_control)", name );
foreach_func ( tid, False, fieldName,
(Addr)msg->msg_control, msg->msg_controllen );
}
- VG_(free) ( fieldName );
}
static void check_cmsg_for_fds(ThreadId tid, struct vki_msghdr *msg)
@@ -1088,8 +1087,8 @@
struct vki_cmsghdr *cm = VKI_CMSG_FIRSTHDR(msg);
while (cm) {
- if (cm->cmsg_level == VKI_SOL_SOCKET &&
- cm->cmsg_type == VKI_SCM_RIGHTS ) {
+ if (cm->cmsg_level == VKI_SOL_SOCKET
+ && cm->cmsg_type == VKI_SCM_RIGHTS ) {
Int *fds = (Int *) VKI_CMSG_DATA(cm);
Int fdc = (cm->cmsg_len - VKI_CMSG_ALIGN(sizeof(struct vki_cmsghdr)))
/ sizeof(int);
@@ -1112,7 +1111,7 @@
const HChar *description,
struct vki_sockaddr *sa, UInt salen )
{
- HChar *outmsg;
+ HChar outmsg[VG_(strlen)( description ) + 30]; // large enough
struct vki_sockaddr_un* saun = (struct vki_sockaddr_un *)sa;
struct vki_sockaddr_in* sin = (struct vki_sockaddr_in *)sa;
struct vki_sockaddr_in6* sin6 = (struct vki_sockaddr_in6 *)sa;
@@ -1126,17 +1125,12 @@
/* NULL/zero-length sockaddrs are legal */
if ( sa == NULL || salen == 0 ) return;
- outmsg = VG_(malloc) ( "di.syswrap.pmr_sockaddr.1",
- VG_(strlen)( description ) + 30 );
-
VG_(sprintf) ( outmsg, description, "sa_family" );
PRE_MEM_READ( outmsg, (Addr) &sa->sa_family, sizeof(vki_sa_family_t));
/* Don't do any extra checking if we cannot determine the sa_family. */
- if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t))) {
- VG_(free) (outmsg);
+ if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t)))
return;
- }
switch (sa->sa_family) {
@@ -1203,8 +1197,6 @@
salen - sizeof(sa->sa_family));
break;
}
-
- VG_(free) ( outmsg );
}
/* Dereference a pointer to a UInt. */
@@ -3684,8 +3676,7 @@
UInt size = _VKI_IOC_SIZE(request);
if (size > 0 && (dir & _VKI_IOC_READ)
&& res == 0
- && arg != (Addr)NULL)
- {
+ && arg != (Addr)NULL) {
POST_MEM_WRITE(arg, size);
}
}
@@ -3836,10 +3827,10 @@
if (grows == VKI_PROT_GROWSDOWN) {
rseg = VG_(am_next_nsegment)( aseg, False/*backwards*/ );
- if (rseg &&
- rseg->kind == SkResvn &&
- rseg->smode == SmUpper &&
- rseg->end+1 == aseg->start) {
+ if (rseg
+ && rseg->kind == SkResvn
+ && rseg->smode == SmUpper
+ && rseg->end+1 == aseg->start) {
Addr end = ARG1 + ARG2;
ARG1 = aseg->start;
ARG2 = end - aseg->start;
@@ -3849,10 +3840,10 @@
}
} else if (grows == VKI_PROT_GROWSUP) {
rseg = VG_(am_next_nsegment)( aseg, True/*forwards*/ );
- if (rseg &&
- rseg->kind == SkResvn &&
- rseg->smode == SmLower &&
- aseg->end+1 == rseg->start) {
+ if (rseg
+ && rseg->kind == SkResvn
+ && rseg->smode == SmLower
+ && aseg->end+1 == rseg->start) {
ARG2 = aseg->end - ARG1 + 1;
ARG3 &= ~VKI_PROT_GROWSUP;
} else {
@@ -3993,10 +3984,8 @@
SysRes sres;
VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
- if (ML_(safe_to_deref)( arg1s, 1 ) &&
- (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/cmdline"))
- )
- {
+ if (ML_(safe_to_deref)( arg1s, 1 )
+ && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/cmdline"))) {
sres = VG_(dup)( VG_(cl_cmdline_fd) );
SET_STATUS_from_SysRes( sres );
if (!sr_isError(sres)) {
@@ -4062,8 +4051,8 @@
&& SimHintiS(SimHint_enable_outer, VG_(clo_sim_hints)))
ok = True;
#if defined(VGO_solaris)
- if (!ok && VG_(vfork_fildes_addr) != NULL &&
- *VG_(vfork_fildes_addr) >= 0 && *VG_(vfork_fildes_addr) == ARG1)
+ if (!ok && VG_(vfork_fildes_addr) != NULL
+ && *VG_(vfork_fildes_addr) >= 0 && *VG_(vfork_fildes_addr) == ARG1)
ok = True;
#endif
if (!ok)
@@ -4139,39 +4128,30 @@
PRE_MEM_RASCIIZ( "readlink(path)", ARG1 );
PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 );
- {
+
#if defined(VGO_linux)
+#define PID_EXEPATH "/proc/%d/exe"
+#define SELF_EXEPATH "/proc/self/exe"
+#define SELF_EXEFD "/proc/self/fd/%d"
+#elif defined(VGO_solaris)
+#define PID_EXEPATH "/proc/%d/path/a.out"
+#define SELF_EXEPATH "/proc/self/path/a.out"
+#define SELF_EXEFD "/proc/self/path/%d"
+#endif
+ {
/*
* Handle the case where readlink is looking at /proc/self/exe or
- * /proc/<pid>/exe.
+ * /proc/<pid>/exe, or equivalent on Solaris.
*/
HChar name[30]; // large enough
HChar* arg1s = (HChar*) ARG1;
- VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
- if (ML_(safe_to_deref)(arg1s, 1) &&
- (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/exe"))
- )
- {
- VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
+ VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)());
+ if (ML_(safe_to_deref)(arg1s, 1)
+ && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) {
+ VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd));
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,
ARG2, ARG3));
- } else
-#elif defined(VGO_solaris)
- /* Same for Solaris, but /proc/self/path/a.out and
- /proc/<pid>/path/a.out. */
- HChar name[30]; // large enough
- HChar* arg1s = (HChar*) ARG1;
- VG_(sprintf)(name, "/proc/%d/path/a.out", VG_(getpid)());
- if (ML_(safe_to_deref)(arg1s, 1) &&
- (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/path/a.out"))
- )
- {
- VG_(sprintf)(name, "/proc/self/path/%d", VG_(cl_exec_fd));
- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,
- ARG2, ARG3));
- } else
-#endif
- {
+ } else {
/* Normal case */
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
}
|
|
From: <sv...@va...> - 2016-11-01 18:28:33
|
Author: petarj
Date: Tue Nov 1 18:28:26 2016
New Revision: 16110
Log:
mips: add POST function to sys_prctl
Add missing POST wrapper for sys_prctl.
This fixes regressions from r15934 (on MIPS32 platforms) and r16003
(on MIPS64 platforms).
Related test: memcheck/tests/threadname
Modified:
trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips32-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips32-linux.c Tue Nov 1 18:28:26 2016
@@ -560,7 +560,7 @@
// We're going to need something like linux/core_os32.h for such
// things, eventually, I think. --njn
-PRE (sys_lstat64)
+PRE(sys_lstat64)
{
PRINT ("sys_lstat64 ( %#lx(%s), %#lx )", ARG1, (HChar *) ARG1, ARG2);
PRE_REG_READ2 (long, "lstat64", char *, file_name, struct stat64 *, buf);
@@ -568,7 +568,7 @@
PRE_MEM_WRITE ("lstat64(buf)", ARG2, sizeof (struct vki_stat64));
}
-POST (sys_lstat64)
+POST(sys_lstat64)
{
vg_assert (SUCCESS);
if (RES == 0)
@@ -577,7 +577,7 @@
}
}
-PRE (sys_stat64)
+PRE(sys_stat64)
{
PRINT ("sys_stat64 ( %#lx(%s), %#lx )", ARG1, (HChar *) ARG1, ARG2);
PRE_REG_READ2 (long, "stat64", char *, file_name, struct stat64 *, buf);
@@ -585,12 +585,12 @@
PRE_MEM_WRITE ("stat64(buf)", ARG2, sizeof (struct vki_stat64));
}
-POST (sys_stat64)
+POST(sys_stat64)
{
POST_MEM_WRITE (ARG2, sizeof (struct vki_stat64));
}
-PRE (sys_fstatat64)
+PRE(sys_fstatat64)
{
// ARG4 = int flags; Flags are or'ed together, therefore writing them
// as a hex constant is more meaningful.
@@ -602,24 +602,24 @@
PRE_MEM_WRITE ("fstatat64(buf)", ARG3, sizeof (struct vki_stat64));
}
-POST (sys_fstatat64)
+POST(sys_fstatat64)
{
POST_MEM_WRITE (ARG3, sizeof (struct vki_stat64));
}
-PRE (sys_fstat64)
+PRE(sys_fstat64)
{
PRINT ("sys_fstat64 ( %lu, %#lx )", SARG1, ARG2);
PRE_REG_READ2 (long, "fstat64", unsigned long, fd, struct stat64 *, buf);
PRE_MEM_WRITE ("fstat64(buf)", ARG2, sizeof (struct vki_stat64));
}
-POST (sys_fstat64)
+POST(sys_fstat64)
{
POST_MEM_WRITE (ARG2, sizeof (struct vki_stat64));
}
-PRE (sys_clone)
+PRE(sys_clone)
{
Bool badarg = False;
UInt cloneflags;
@@ -709,7 +709,7 @@
}
}
-PRE (sys_sigreturn)
+PRE(sys_sigreturn)
{
PRINT ("sys_sigreturn ( )");
vg_assert (VG_ (is_valid_tid) (tid));
@@ -724,7 +724,7 @@
*flags |= SfPollAfter;
}
-PRE (sys_rt_sigreturn)
+PRE(sys_rt_sigreturn)
{
PRINT ("rt_sigreturn ( )");
vg_assert (VG_ (is_valid_tid) (tid));
@@ -740,7 +740,7 @@
*flags |= SfPollAfter;
}
-PRE (sys_set_thread_area)
+PRE(sys_set_thread_area)
{
PRINT ("set_thread_area (%lx)", ARG1);
PRE_REG_READ1(long, "set_thread_area", unsigned long, addr);
@@ -748,7 +748,7 @@
}
/* Very much MIPS specific */
-PRE (sys_cacheflush)
+PRE(sys_cacheflush)
{
PRINT ("cacheflush (%lx, %ld, %ld)", ARG1, SARG2, SARG3);
PRE_REG_READ3(long, "cacheflush", unsigned long, addr,
@@ -785,7 +785,7 @@
}
}
-PRE (sys_prctl)
+PRE(sys_prctl)
{
switch (ARG1) {
case VKI_PR_SET_FP_MODE:
@@ -831,6 +831,11 @@
}
}
+POST(sys_prctl)
+{
+ WRAPPER_POST_NAME(linux, sys_prctl)(tid, arrghs, status);
+}
+
#undef PRE
#undef POST
@@ -1038,7 +1043,7 @@
//..
LINX_ (__NR_setresgid, sys_setresgid), // 190
LINXY (__NR_getresgid, sys_getresgid), // 191
- PLAX_ (__NR_prctl, sys_prctl), // 192
+ PLAXY (__NR_prctl, sys_prctl), // 192
PLAX_ (__NR_rt_sigreturn, sys_rt_sigreturn), // 193
LINXY (__NR_rt_sigaction, sys_rt_sigaction), // 194
LINXY (__NR_rt_sigprocmask, sys_rt_sigprocmask), // 195
Modified: trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips64-linux.c Tue Nov 1 18:28:26 2016
@@ -464,7 +464,7 @@
}
}
-PRE (sys_mmap)
+PRE(sys_mmap)
{
SysRes r;
PRINT("sys_mmap ( %#lx, %lu, %ld, %ld, %ld, %lu )",
@@ -616,7 +616,7 @@
}
}
-PRE (sys_prctl)
+PRE(sys_prctl)
{
switch (ARG1) {
case VKI_PR_SET_FP_MODE:
@@ -662,6 +662,11 @@
}
}
+POST(sys_prctl)
+{
+ WRAPPER_POST_NAME(linux, sys_prctl)(tid, arrghs, status);
+}
+
#undef PRE
#undef POST
@@ -833,7 +838,7 @@
LINX_ (__NR_vhangup, sys_vhangup),
LINX_ (__NR_pivot_root,sys_pivot_root),
LINXY (__NR__sysctl, sys_sysctl),
- PLAX_ (__NR_prctl, sys_prctl),
+ PLAXY (__NR_prctl, sys_prctl),
LINXY (__NR_adjtimex, sys_adjtimex),
GENX_ (__NR_setrlimit, sys_setrlimit),
GENX_ (__NR_chroot, sys_chroot),
|
|
From: <sv...@va...> - 2016-11-01 15:00:56
|
Author: philippe
Date: Tue Nov 1 15:00:45 2016
New Revision: 16109
Log:
371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/priv_syswrap-linux.h
trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
trunk/coregrind/m_syswrap/syswrap-arm-linux.c
trunk/coregrind/m_syswrap/syswrap-arm64-linux.c
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
trunk/coregrind/m_syswrap/syswrap-tilegx-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Nov 1 15:00:45 2016
@@ -21,7 +21,7 @@
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
where XXXXXX is the bug number as listed below.
-
+371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
Modified: trunk/coregrind/m_syswrap/priv_syswrap-linux.h
==============================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-linux.h (original)
+++ trunk/coregrind/m_syswrap/priv_syswrap-linux.h Tue Nov 1 15:00:45 2016
@@ -337,7 +337,7 @@
DECL_TEMPLATE(linux, sys_semctl);
DECL_TEMPLATE(linux, sys_semtimedop);
/* Shared memory */
-DECL_TEMPLATE(linux, wrap_sys_shmat);
+DECL_TEMPLATE(linux, sys_shmat);
DECL_TEMPLATE(linux, sys_shmget);
DECL_TEMPLATE(linux, sys_shmdt);
DECL_TEMPLATE(linux, sys_shmctl);
Modified: trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-amd64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-amd64-linux.c Tue Nov 1 15:00:45 2016
@@ -730,7 +730,7 @@
GENX_(__NR_madvise, sys_madvise), // 28
LINX_(__NR_shmget, sys_shmget), // 29
- LINXY(__NR_shmat, wrap_sys_shmat), // 30
+ LINXY(__NR_shmat, sys_shmat), // 30
LINXY(__NR_shmctl, sys_shmctl), // 31
GENXY(__NR_dup, sys_dup), // 32
GENXY(__NR_dup2, sys_dup2), // 33
Modified: trunk/coregrind/m_syswrap/syswrap-arm-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-arm-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-arm-linux.c Tue Nov 1 15:00:45 2016
@@ -1152,7 +1152,7 @@
LINX_(__NR_readlinkat, sys_readlinkat), //
LINX_(__NR_fchmodat, sys_fchmodat), //
LINX_(__NR_faccessat, sys_faccessat), //
- LINXY(__NR_shmat, wrap_sys_shmat), //305
+ LINXY(__NR_shmat, sys_shmat), //305
LINXY(__NR_shmdt, sys_shmdt), //306
LINX_(__NR_shmget, sys_shmget), //307
LINXY(__NR_shmctl, sys_shmctl), // 308
Modified: trunk/coregrind/m_syswrap/syswrap-arm64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-arm64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-arm64-linux.c Tue Nov 1 15:00:45 2016
@@ -1048,7 +1048,7 @@
LINX_(__NR_semop, sys_semop), // 193
LINX_(__NR_shmget, sys_shmget), // 194
LINXY(__NR_shmctl, sys_shmctl), // 195
- LINXY(__NR_shmat, wrap_sys_shmat), // 196
+ LINXY(__NR_shmat, sys_shmat), // 196
LINXY(__NR_shmdt, sys_shmdt), // 197
LINXY(__NR_socket, sys_socket), // 198
LINXY(__NR_socketpair, sys_socketpair), // 199
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Tue Nov 1 15:00:45 2016
@@ -4004,10 +4004,10 @@
}
}
-PRE(wrap_sys_shmat)
+PRE(sys_shmat)
{
UWord arg2tmp;
- PRINT("wrap_sys_shmat ( %ld, %#lx, %ld )", SARG1, ARG2, SARG3);
+ PRINT("sys_shmat ( %ld, %#lx, %ld )", SARG1, ARG2, SARG3);
PRE_REG_READ3(long, "shmat",
int, shmid, const void *, shmaddr, int, shmflg);
#if defined(VGP_arm_linux)
@@ -4025,7 +4025,7 @@
ARG2 = arg2tmp; // used in POST
}
-POST(wrap_sys_shmat)
+POST(sys_shmat)
{
ML_(generic_POST_sys_shmat)(tid, RES,ARG1,ARG2,ARG3);
}
Modified: trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips64-linux.c Tue Nov 1 15:00:45 2016
@@ -706,7 +706,7 @@
GENXY (__NR_mincore, sys_mincore),
GENX_ (__NR_madvise, sys_madvise),
LINX_ (__NR_shmget, sys_shmget),
- LINXY (__NR_shmat, wrap_sys_shmat),
+ LINXY (__NR_shmat, sys_shmat),
LINXY (__NR_shmctl, sys_shmctl),
GENXY (__NR_dup, sys_dup),
GENXY (__NR_dup2, sys_dup2),
Modified: trunk/coregrind/m_syswrap/syswrap-tilegx-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-tilegx-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-tilegx-linux.c Tue Nov 1 15:00:45 2016
@@ -484,7 +484,7 @@
DECL_TEMPLATE (tilegx_linux, sys_msgsnd);
DECL_TEMPLATE (tilegx_linux, sys_msgctl);
DECL_TEMPLATE (tilegx_linux, sys_shmget);
-DECL_TEMPLATE (tilegx_linux, wrap_sys_shmat);
+DECL_TEMPLATE (tilegx_linux, sys_shmat);
DECL_TEMPLATE (tilegx_linux, sys_shmdt);
DECL_TEMPLATE (tilegx_linux, sys_shmdt);
DECL_TEMPLATE (tilegx_linux, sys_shmctl);
@@ -1026,10 +1026,10 @@
PRE_REG_READ3(long, "shmget", vki_key_t, key, vki_size_t, size, int, shmflg);
}
-PRE(wrap_sys_shmat)
+PRE(sys_shmat)
{
UWord arg2tmp;
- PRINT("wrap_sys_shmat ( %ld, %#lx, %ld )", SARG1, ARG2, SARG3);
+ PRINT("sys_shmat ( %ld, %#lx, %ld )", SARG1, ARG2, SARG3);
PRE_REG_READ3(long, "shmat",
int, shmid, const void *, shmaddr, int, shmflg);
arg2tmp = ML_(generic_PRE_sys_shmat)(tid, ARG1,ARG2,ARG3);
@@ -1038,7 +1038,7 @@
else
ARG2 = arg2tmp; // used in POST
}
-POST(wrap_sys_shmat)
+POST(sys_shmat)
{
ML_(generic_POST_sys_shmat)(tid, RES,ARG1,ARG2,ARG3);
}
@@ -1319,7 +1319,7 @@
PLAX_(__NR_semtimedop, sys_semtimedop), // 192
PLAX_(__NR_semop, sys_semop), // 193
PLAX_(__NR_shmget, sys_shmget), // 194
- PLAXY(__NR_shmat, wrap_sys_shmat), // 196
+ PLAXY(__NR_shmat, sys_shmat), // 196
PLAXY(__NR_shmctl, sys_shmctl), // 195
PLAXY(__NR_shmdt, sys_shmdt), // 197
PLAXY(__NR_socket, sys_socket), // 198
|