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
(14) |
2
(16) |
3
(7) |
|
4
(7) |
5
(9) |
6
(8) |
7
(10) |
8
(16) |
9
(15) |
10
(9) |
|
11
(11) |
12
(13) |
13
(8) |
14
(8) |
15
(10) |
16
(25) |
17
(7) |
|
18
(7) |
19
(13) |
20
(10) |
21
(14) |
22
(11) |
23
(12) |
24
(8) |
|
25
(19) |
26
(10) |
27
(16) |
28
(13) |
|
|
|
|
From: Tom H. <th...@cy...> - 2007-02-27 03:22:57
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2007-02-27 03:15:02 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Last 20 lines of verbose log follow echo /tmp/cc0Iouj1.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc0Iouj1.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 rm insn_mmx.c insn_sse2.c insn_fpu.c insn_mmxext.c insn_sse.c insn_sse3.c insn_cmov.c insn_basic.c make[5]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests/x86' make[4]: *** [check-am] Error 2 make[4]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests/x86' make[3]: *** [check-recursive] Error 1 make[3]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.30568/valgrind/none' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.30568/valgrind' make: *** [check] Error 2 ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Last 20 lines of verbose log follow echo /tmp/ccZAXoX9.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccZAXoX9.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 rm insn_mmx.c insn_sse2.c insn_fpu.c insn_mmxext.c insn_sse.c insn_sse3.c insn_cmov.c insn_basic.c make[5]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests/x86' make[4]: *** [check-am] Error 2 make[4]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests/x86' make[3]: *** [check-recursive] Error 1 make[3]: Leaving directory `/tmp/valgrind.30568/valgrind/none/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.30568/valgrind/none' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.30568/valgrind' make: *** [check] Error 2 ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Feb 27 03:18:58 2007 --- new.short Tue Feb 27 03:22:48 2007 *************** *** 7,16 **** Last 20 lines of verbose log follow echo ! /tmp/ccZAXoX9.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccZAXoX9.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 --- 7,16 ---- Last 20 lines of verbose log follow echo ! /tmp/cc0Iouj1.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc0Iouj1.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 |
|
From: Tom H. <th...@cy...> - 2007-02-27 03:18:51
|
Nightly build on lloyd ( x86_64, Fedora Core 3 ) started at 2007-02-27 03:05:05 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 288 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-02-27 03:14:17
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2007-02-27 03:00:03 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 290 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: <js...@ac...> - 2007-02-27 01:17:22
|
Nightly build on g5 ( SuSE 10.1, ppc970 ) started at 2007-02-27 02:00:01 CET Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 225 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/pointer-trace (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 225 tests, 6 stderr failures, 3 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/pointer-trace (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/res_search (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Feb 27 02:09:04 2007 --- new.short Tue Feb 27 02:17:19 2007 *************** *** 8,10 **** ! == 225 tests, 6 stderr failures, 3 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) --- 8,10 ---- ! == 225 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) *************** *** 17,19 **** none/tests/mremap2 (stdout) - none/tests/res_search (stdout) --- 17,18 ---- |
|
From: Julian S. <js...@ac...> - 2007-02-26 10:26:43
|
> Thanks, this information allowed me to eliminate the false positives. > > By the way, is the first argument passed to unsafeIRDirty_0_N() the > number of register parameters ? This number needs to be 'n' if the function you intend to call is declared with __attribute__((regparm(n))), which is usually wrapped up into the macro VG_REGPARM(n). See eg mc_new_mem_stack_4. If that info is not in the IR, vex cannot generate the correct call sequence on x86. On all other platforms it is ignored. J |
|
From: <js...@ac...> - 2007-02-26 10:02:15
|
Nightly build on minnie ( SuSE 10.0, ppc32 ) started at 2007-02-26 09:00:01 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 219 tests, 10 stderr failures, 6 stdout failures, 0 posttest failures == memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-fp (stderr) none/tests/ppc32/round (stdout) none/tests/ppc32/round (stderr) none/tests/ppc32/test_fx (stdout) none/tests/ppc32/test_fx (stderr) none/tests/ppc32/test_gx (stdout) |
|
From: Bart V. A. <bar...@gm...> - 2007-02-26 09:25:03
|
On 2/25/07, Nicholas Nethercote <nj...@cs...> wrote:
> On Sun, 25 Feb 2007, Julian Seward wrote:
>
> >> track_new_mem_stack before the client accesses stack data. Did I
> >> misunderstand something ?
> >
> > Yes (it may not be documented anywhere :-) If the core calls
> > track_new_mem_stack(x) then the new limit below which the client
> > may not go is x - VG_STACK_REDZONE_SZB. Probably you didn't see
> > this on x86 because VG_STACK_REDZONE_SZB on that platform.
> > Have a look at mc_new_mem_stack_4 et al in mc_main.c.
>
> See also the stuff about "AbiHint" in VEX/pub/libvex_ir.h and
> memcheck/mc_translate.c, and the function helperc_MAKE_STACK_UNINIT in
> mc_main.c.
Thanks, this information allowed me to eliminate the false positives.
By the way, is the first argument passed to unsafeIRDirty_0_N() the
number of register parameters ? If so, why is the first argument of
unsafeIRDirty_0_N() in do_AbiHint (memcheck/mc_translate.c) zero
instead of two ?
>From memcheck/mc_translate.c:
static
void do_AbiHint ( MCEnv* mce, IRExpr* base, Int len )
{
IRDirty* di;
di = unsafeIRDirty_0_N(
0/*regparms*/,
"MC_(helperc_MAKE_STACK_UNINIT)",
VG_(fnptr_to_fnentry)( &MC_(helperc_MAKE_STACK_UNINIT) ),
mkIRExprVec_2( base, mkIRExpr_HWord( (UInt)len) )
);
stmt( mce->bb, IRStmt_Dirty(di) );
}
Regards,
Bart.
|
|
From: <js...@ac...> - 2007-02-26 05:31:37
|
Nightly build on phoenix ( SuSE 10.0 ) started at 2007-02-26 04:55:01 GMT Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 254 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/leak-tree (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-02-26 03:25:55
|
Nightly build on dellow ( x86_64, Fedora Core 6 ) started at 2007-02-26 03:10:11 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 288 tests, 4 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-02-26 03:22:59
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2007-02-26 03:15:01 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Last 20 lines of verbose log follow echo /tmp/ccSNfA37.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/ccSNfA37.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 rm insn_mmx.c insn_sse2.c insn_fpu.c insn_mmxext.c insn_sse.c insn_sse3.c insn_cmov.c insn_basic.c make[5]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests/x86' make[4]: *** [check-am] Error 2 make[4]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests/x86' make[3]: *** [check-recursive] Error 1 make[3]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.15122/valgrind/none' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.15122/valgrind' make: *** [check] Error 2 ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Last 20 lines of verbose log follow echo /tmp/cc17wq8h.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' /tmp/cc17wq8h.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 rm insn_mmx.c insn_sse2.c insn_fpu.c insn_mmxext.c insn_sse.c insn_sse3.c insn_cmov.c insn_basic.c make[5]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests/x86' make[4]: *** [check-am] Error 2 make[4]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests/x86' make[3]: *** [check-recursive] Error 1 make[3]: Leaving directory `/tmp/valgrind.15122/valgrind/none/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.15122/valgrind/none' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.15122/valgrind' make: *** [check] Error 2 ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Mon Feb 26 03:18:47 2007 --- new.short Mon Feb 26 03:22:33 2007 *************** *** 7,16 **** Last 20 lines of verbose log follow echo ! /tmp/cc17wq8h.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/cc17wq8h.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 --- 7,16 ---- Last 20 lines of verbose log follow echo ! /tmp/ccSNfA37.s:4393: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:4513: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:4633: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:4753: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:4873: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:4993: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:5113: Error: no such instruction: `fisttpq -56(%ebp)' ! /tmp/ccSNfA37.s:5233: Error: no such instruction: `fisttpq -56(%ebp)' make[5]: *** [insn_sse3.o] Error 1 |
|
From: Tom H. <th...@cy...> - 2007-02-26 03:19:26
|
Nightly build on lloyd ( x86_64, Fedora Core 3 ) started at 2007-02-26 03:05:09 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 288 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-02-26 03:15:47
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2007-02-26 03:00:07 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 290 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/tls (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 290 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Mon Feb 26 03:06:50 2007 --- new.short Mon Feb 26 03:15:34 2007 *************** *** 8,10 **** ! == 290 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) --- 8,10 ---- ! == 290 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/pointer-trace (stderr) *************** *** 16,17 **** --- 16,18 ---- none/tests/mremap2 (stdout) + none/tests/tls (stdout) |
|
From: <js...@ac...> - 2007-02-26 01:17:01
|
Nightly build on g5 ( SuSE 10.1, ppc970 ) started at 2007-02-26 02:00:01 CET Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 225 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/pointer-trace (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: <sv...@va...> - 2007-02-26 00:16:19
|
Author: weidendo
Date: 2007-02-26 00:16:09 +0000 (Mon, 26 Feb 2007)
New Revision: 6618
Log:
Callgrind: Fix potential buffer overruns with user provided strings
This introduces some macros to shorten the code for output of
strings to a file descriptor. I could use this a lot,
but this commit limits itself to the potential buffer overruns
(to ease backporting - provided we want to do this)
Heavy use of the macros probably blows up the code. Perhaps
it would be better to provide e.g. a VG_(write_str3) function
in the tool API.
Modified:
trunk/callgrind/command.c
trunk/callgrind/global.h
Modified: trunk/callgrind/command.c
===================================================================
--- trunk/callgrind/command.c 2007-02-25 17:13:19 UTC (rev 6617)
+++ trunk/callgrind/command.c 2007-02-26 00:16:09 UTC (rev 6618)
@@ -128,41 +128,26 @@
if (fd>=0) {
Char buf[512];
Int i;
+
+ WRITE_STR3(fd,
+ "# This file is generated by Callgrind-" VERSION ".\n"
+ "# It is used to enable controlling the supervision of\n"
+ "# '", VG_(args_the_exename), "'\n"
+ "# by external tools.\n\n");
- VG_(sprintf)(buf,
- "# This file is generated by Callgrind-" VERSION ".\n"
- "# It is used to enable controlling the supervision of\n"
- "# '%s'\n"
- "# by external tools.\n\n",
- VG_(args_the_exename)
- );
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
-
VG_(sprintf)(buf, "version: " COMMAND_VERSION "\n");
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- VG_(sprintf)(buf, "base: %s\n", dir);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
-
- VG_(sprintf)(buf, "dumps: %s\n", dump_filename);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
-
- VG_(sprintf)(buf, "control: %s\n", command_file);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
-
- VG_(sprintf)(buf, "result: %s\n", result_file);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
-
- VG_(strcpy)(buf, "cmd:");
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- VG_(sprintf)(buf, " %s", VG_(args_the_exename));
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
+ WRITE_STR3(fd, "base: ", dir, "\n");
+ WRITE_STR3(fd, "dumps: ", dump_filename, "\n");
+ WRITE_STR3(fd, "control: ", command_file, "\n");
+ WRITE_STR3(fd, "result: ", result_file, "\n");
+
+ WRITE_STR2(fd, "cmd: ", VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* arg = * (HChar**)VG_(indexXA)( VG_(args_for_client), i );
if (!arg) continue;
- tl_assert( VG_(strlen)(arg) < 512-4 ); /* see [512] above */
- VG_(sprintf)(buf, " %s", arg);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
+ WRITE_STR2(fd, " ", arg);
}
VG_(write)(fd, "\n", 1);
VG_(close)(fd);
@@ -224,19 +209,14 @@
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
/* "base:" line */
- VG_(sprintf)(buf, "base: %s\n", dump_base);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
+ WRITE_STR3(fd, "base: ", dump_base, "\n");
/* "cmd:" line */
- VG_(strcpy)(buf, "cmd:");
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- VG_(sprintf)(buf, " %s", VG_(args_the_exename));
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
+ WRITE_STR2(fd, "cmd: ", VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* arg = * (HChar**)VG_(indexXA)( VG_(args_for_client), i );
if (!arg) continue;
- VG_(sprintf)(buf, " %s", arg);
- VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
+ WRITE_STR2(fd, " ", arg);
}
VG_(write)(fd, "\n", 1);
Modified: trunk/callgrind/global.h
===================================================================
--- trunk/callgrind/global.h 2007-02-25 17:13:19 UTC (rev 6617)
+++ trunk/callgrind/global.h 2007-02-26 00:16:09 UTC (rev 6618)
@@ -121,7 +121,44 @@
#define LINE_BUF_LEN 64
+/* Convenience macros */
+/* Use this only when size of sprintf args are known to fit into
+ * given buffer; for strings of unknown length, use WRITE_STR below
+ */
+#define WRITE_SPRINTF(fd, zz_buf, fmt, args...) \
+ do { Int len = VG_(sprintf)(zz_buf, fmt, ## args); \
+ VG_(write)(fd, (void*)zz_buf, len); \
+ } while (0)
+
+#define WRITE_STR(fd, str) \
+ do { if (str) { Int len = VG_(strlen)(str); \
+ VG_(write)(fd, (void*)str, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ } while (0)
+
+#define WRITE_STR2(fd, str1, str2) \
+ do { if (str1) { Int len = VG_(strlen)(str1); \
+ VG_(write)(fd, (void*)str1, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ if (str2) { Int len = VG_(strlen)(str2); \
+ VG_(write)(fd, (void*)str2, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ } while (0)
+
+#define WRITE_STR3(fd, str1, str2, str3) \
+ do { if (str1) { Int len = VG_(strlen)(str1); \
+ VG_(write)(fd, (void*)str1, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ if (str2) { Int len = VG_(strlen)(str2); \
+ VG_(write)(fd, (void*)str2, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ if (str3) { Int len = VG_(strlen)(str3); \
+ VG_(write)(fd, (void*)str3, len); } \
+ else VG_(write)(fd, "(null)", 6); \
+ } while (0)
+
+
/*------------------------------------------------------------*/
/*--- Statistics ---*/
/*------------------------------------------------------------*/
|
|
From: Nicholas N. <nj...@cs...> - 2007-02-25 22:57:24
|
On Sun, 25 Feb 2007, Julian Seward wrote: >> track_new_mem_stack before the client accesses stack data. Did I >> misunderstand something ? > > Yes (it may not be documented anywhere :-) If the core calls > track_new_mem_stack(x) then the new limit below which the client > may not go is x - VG_STACK_REDZONE_SZB. Probably you didn't see > this on x86 because VG_STACK_REDZONE_SZB on that platform. > Have a look at mc_new_mem_stack_4 et al in mc_main.c. See also the stuff about "AbiHint" in VEX/pub/libvex_ir.h and memcheck/mc_translate.c, and the function helperc_MAKE_STACK_UNINIT in mc_main.c. Nick |
|
From: <sv...@va...> - 2007-02-25 17:13:22
|
Author: sewardj
Date: 2007-02-25 17:13:19 +0000 (Sun, 25 Feb 2007)
New Revision: 6617
Log:
Comment-only change.
Modified:
trunk/coregrind/m_debuginfo/readdwarf.c
Modified: trunk/coregrind/m_debuginfo/readdwarf.c
===================================================================
--- trunk/coregrind/m_debuginfo/readdwarf.c 2007-02-25 15:08:24 UTC (rev 6616)
+++ trunk/coregrind/m_debuginfo/readdwarf.c 2007-02-25 17:13:19 UTC (rev 6617)
@@ -1470,7 +1470,7 @@
the CFA].
JRS: on amd64, the dwarf register numbering is, as per
- gdb-6.3/gdb/tdep-amd64.c and also amd64-abi-0.95.pdf:
+ gdb-6.3/gdb/tdep-amd64.c and also amd64-abi-0.98.pdf:
0 1 2 3 4 5 6 7
RAX RDX RCX RBX RSI RDI RBP RSP
@@ -1479,10 +1479,32 @@
R8 ... R15
16 is the return address (RIP)
+ "The table defines Return Address to have a register number,
+ even though the address is stored in 0(%rsp) and not in a
+ physical register."
- This is pretty strange given this not the encoding scheme for
- registers used in amd64 code.
+ 17 ... 24
+ XMM0 ... XMM7
+ 25 ... 32
+ XMM8 ... XMM15
+
+ 33 ... 40
+ ST0 ... ST7
+
+ 41 ... 48
+ MM0 ... MM7
+
+ 49 RFLAGS
+ 50,51,52,53,54,55 ES,CS,SS,DS,FS,GS
+ 58 FS.BASE (what's that?)
+ 59 GS.BASE (what's that?)
+ 62 TR (task register)
+ 63 LDTR (LDT register)
+ 64 MXCSR
+ 65 FCW (x87 control word)
+ 66 FSW (x86 status word)
+
On x86 I cannot find any documentation. It _appears_ to be the
actual instruction encoding, viz:
|
|
From: Julian S. <js...@ac...> - 2007-02-25 15:50:33
|
> track_new_mem_stack before the client accesses stack data. Did I > misunderstand something ? Yes (it may not be documented anywhere :-) If the core calls track_new_mem_stack(x) then the new limit below which the client may not go is x - VG_STACK_REDZONE_SZB. Probably you didn't see this on x86 because VG_STACK_REDZONE_SZB on that platform. Have a look at mc_new_mem_stack_4 et al in mc_main.c. J |
|
From: Julian S. <js...@ac...> - 2007-02-25 15:46:06
|
http://www.x86-64.org/documentation/abi.pdf Up to 128 bytes below rsp can be used. See VG_STACK_REDZONE_SZB in include/pub_tool_machine.h. The ABI says that this area can be trashed across calls (is highly volatile). From which I infer that it is a bug for a program to put something there, do a call and expect it to still be there afterwards. Therefore memcheck marks that area as uninitialised at each call and return, which is expensive, but necessary to make uninitialised value checking for stack variables work right on amd64. I don't know if this is relevant for drd, or not. ppc64-linux has the same disease only worse (288 bytes); x86-linux and ppc32-linux don't have it at all. J On Sunday 25 February 2007 15:23, Bart Van Assche wrote: > Can anyone of the Valgrind developer tell me where I can find more > information about the AMD-64 ABI ? Apparently the false positives > produced by drd on AMD-64 are caused by accesses to stack locations. > The location in the example below (0x4021018, 96 bytes below the > current lowest stack address in use according to Valgrind's core) was > not declared to the drd tool via track_new_mem_stack but is accessed > anyway by the client. I was expecting Valgrind's core to call > track_new_mem_stack before the client accesses stack data. Did I > misunderstand something ? > > Suspicious stack access: > > ==4681== store 0x4021018 size 8 thread_func1[0] (vg 2 / drd 2 / off -96) > ==4681== at 0x4C20DE9: pthread_mutex_unlock (drd_preloaded.c:339) > ==4681== by 0x400EB0: increment_finished_count (pth_detached.c:29) > ==4681== by 0x400F16: thread_func1 (pth_detached.c:45) > ==4681== by 0x4C21B20: vg_thread_wrapper (drd_preloaded.c:148) > ==4681== by 0x4E2A09D: start_thread (in /lib64/libpthread-2.5.so) > ==4681== by 0x51004CC: clone (in /lib64/libc-2.5.so) > > Line 339 in drd_preloaded.c looks as follows: > > VALGRIND_DO_CLIENT_REQUEST(res, -1, > VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK, > mutex, sizeof(*mutex), 0, 0, 0); > > Regards, > > Bart. > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: Bart V. A. <bar...@gm...> - 2007-02-25 15:24:07
|
Can anyone of the Valgrind developer tell me where I can find more
information about the AMD-64 ABI ? Apparently the false positives
produced by drd on AMD-64 are caused by accesses to stack locations.
The location in the example below (0x4021018, 96 bytes below the
current lowest stack address in use according to Valgrind's core) was
not declared to the drd tool via track_new_mem_stack but is accessed
anyway by the client. I was expecting Valgrind's core to call
track_new_mem_stack before the client accesses stack data. Did I
misunderstand something ?
Suspicious stack access:
==4681== store 0x4021018 size 8 thread_func1[0] (vg 2 / drd 2 / off -96)
==4681== at 0x4C20DE9: pthread_mutex_unlock (drd_preloaded.c:339)
==4681== by 0x400EB0: increment_finished_count (pth_detached.c:29)
==4681== by 0x400F16: thread_func1 (pth_detached.c:45)
==4681== by 0x4C21B20: vg_thread_wrapper (drd_preloaded.c:148)
==4681== by 0x4E2A09D: start_thread (in /lib64/libpthread-2.5.so)
==4681== by 0x51004CC: clone (in /lib64/libc-2.5.so)
Line 339 in drd_preloaded.c looks as follows:
VALGRIND_DO_CLIENT_REQUEST(res, -1,
VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK,
mutex, sizeof(*mutex), 0, 0, 0);
Regards,
Bart.
|
|
From: <sv...@va...> - 2007-02-25 15:08:28
|
Author: sewardj
Date: 2007-02-25 15:08:24 +0000 (Sun, 25 Feb 2007)
New Revision: 6616
Log:
Get rid of the type XArrayStrings in m_clientstate and use new generic
equivalents in module m_xarray instead. A suprisingly pervasive
change.
Modified:
trunk/cachegrind/cg_main.c
trunk/callgrind/command.c
trunk/callgrind/dump.c
trunk/callgrind/global.h
trunk/coregrind/m_clientstate.c
trunk/coregrind/m_commandline.c
trunk/coregrind/m_coredump/coredump-elf.c
trunk/coregrind/m_debugger.c
trunk/coregrind/m_initimg/initimg-linux.c
trunk/coregrind/m_libcfile.c
trunk/coregrind/m_libcproc.c
trunk/coregrind/m_main.c
trunk/coregrind/m_redir.c
trunk/coregrind/m_signals.c
trunk/coregrind/m_stacktrace.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/include/Makefile.am
trunk/include/pub_tool_clientstate.h
trunk/massif/ms_main.c
Modified: trunk/cachegrind/cg_main.c
===================================================================
--- trunk/cachegrind/cg_main.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/cachegrind/cg_main.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -42,6 +42,7 @@
#include "pub_tool_options.h"
#include "pub_tool_oset.h"
#include "pub_tool_tooliface.h"
+#include "pub_tool_xarray.h"
#include "pub_tool_clientstate.h"
#include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
@@ -1026,11 +1027,11 @@
VG_(write)(fd, VG_(args_the_exename),
VG_(strlen)( VG_(args_the_exename) ));
}
- for (i = 0; i < VG_(args_for_client).used; i++) {
- if (VG_(args_for_client).strs[i]) {
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
+ if (arg) {
VG_(write)(fd, " ", 1);
- VG_(write)(fd, VG_(args_for_client).strs[i],
- VG_(strlen)(VG_(args_for_client).strs[i]));
+ VG_(write)(fd, arg, VG_(strlen)( arg ));
}
}
// "events:" line
Modified: trunk/callgrind/command.c
===================================================================
--- trunk/callgrind/command.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/callgrind/command.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -157,9 +157,11 @@
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
VG_(sprintf)(buf, " %s", VG_(args_the_exename));
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- for (i = 0; i < VG_(args_for_client).used; i++) {
- if (!VG_(args_for_client).strs[i]) continue;
- VG_(sprintf)(buf, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**)VG_(indexXA)( VG_(args_for_client), i );
+ if (!arg) continue;
+ tl_assert( VG_(strlen)(arg) < 512-4 ); /* see [512] above */
+ VG_(sprintf)(buf, " %s", arg);
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
}
VG_(write)(fd, "\n", 1);
@@ -230,9 +232,10 @@
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
VG_(sprintf)(buf, " %s", VG_(args_the_exename));
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- for (i = 0; i < VG_(args_for_client).used; i++) {
- if (!VG_(args_for_client).strs[i]) continue;
- VG_(sprintf)(buf, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**)VG_(indexXA)( VG_(args_for_client), i );
+ if (!arg) continue;
+ VG_(sprintf)(buf, " %s", arg);
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
}
VG_(write)(fd, "\n", 1);
Modified: trunk/callgrind/dump.c
===================================================================
--- trunk/callgrind/dump.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/callgrind/dump.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -1625,8 +1625,8 @@
if (VG_(args_the_exename))
size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
- for(i = 0; i < VG_(args_for_client).used; i++) {
- argv = VG_(args_for_client).strs[i];
+ for(i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ argv = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
if (!argv) continue;
if ((size>0) && (size < BUF_LEN)) cmdbuf[size++] = ' ';
for(j=0;argv[j]!=0;j++)
@@ -1634,7 +1634,7 @@
}
#else
for(i = 0; i < VG_(client_argc); i++) {
- argv = VG_(client_argv[i]);
+ argv = VG_(client_argv)[i];
if (!argv) continue;
if ((size>0) && (size < BUF_LEN)) cmdbuf[size++] = ' ';
for(j=0;argv[j]!=0;j++)
Modified: trunk/callgrind/global.h
===================================================================
--- trunk/callgrind/global.h 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/callgrind/global.h 2007-02-25 15:08:24 UTC (rev 6616)
@@ -19,6 +19,7 @@
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
#include "pub_tool_tooliface.h"
+#include "pub_tool_xarray.h"
#include "pub_tool_clientstate.h"
#include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
Modified: trunk/coregrind/m_clientstate.c
===================================================================
--- trunk/coregrind/m_clientstate.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_clientstate.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -32,6 +32,7 @@
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
/*-----------------------------------------------------------------*/
@@ -64,10 +65,10 @@
// (the default arena). They are never freed.
/* Args for the client. */
-XArrayStrings VG_(args_for_client) = {0,0,NULL};
+XArray* /* of HChar* */ VG_(args_for_client) = NULL;
/* Args for V (augments, then those from the launcher). */
-XArrayStrings VG_(args_for_valgrind) = {0,0,NULL};
+XArray* /* of HChar* */ VG_(args_for_valgrind) = NULL;
/* How many of the above not to pass on at execve time? */
Int VG_(args_for_valgrind_noexecpass) = 0;
Modified: trunk/coregrind/m_commandline.c
===================================================================
--- trunk/coregrind/m_commandline.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_commandline.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -36,32 +36,16 @@
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
#include "pub_core_mallocfree.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
-#include "pub_core_commandline.h"
+#include "pub_core_commandline.h" /* self */
/* Add a string to an expandable array of strings. */
-static void add_string ( XArrayStrings* xa, HChar* str )
+static void add_string ( XArray* /* of HChar* */xa, HChar* str )
{
- Int i;
- HChar** strs2;
- vg_assert(xa->used >= 0);
- vg_assert(xa->size >= 0);
- vg_assert(xa->used <= xa->size);
- if (xa->strs == NULL) vg_assert(xa->size == 0);
-
- if (xa->used == xa->size) {
- xa->size = xa->size==0 ? 2 : 2*xa->size;
- strs2 = VG_(malloc)( xa->size * sizeof(HChar*) );
- for (i = 0; i < xa->used; i++)
- strs2[i] = xa->strs[i];
- if (xa->strs)
- VG_(free)(xa->strs);
- xa->strs = strs2;
- }
- vg_assert(xa->used < xa->size);
- xa->strs[xa->used++] = str;
+ VG_(addToXA)( xa, (void*)(&str) );
}
@@ -112,7 +96,7 @@
tmp = cp;
while ( !VG_(isspace)(*cp) && *cp != 0 ) cp++;
if ( *cp != 0 ) *cp++ = '\0'; // terminate if not the last
- add_string( &VG_(args_for_valgrind), tmp );
+ add_string( VG_(args_for_valgrind), tmp );
}
}
@@ -163,13 +147,26 @@
Bool augment = True;
static Bool already_called = False;
- XArrayStrings tmp_xarray = {0,0,NULL};
+ XArray* /* of HChar* */ tmp_xarray;
/* This function should be called once, at startup, and then never
again. */
vg_assert(!already_called);
already_called = True;
+ tmp_xarray = VG_(newXA)( VG_(malloc), VG_(free), sizeof(HChar*) );
+ vg_assert(tmp_xarray);
+
+ vg_assert( ! VG_(args_for_valgrind) );
+ VG_(args_for_valgrind)
+ = VG_(newXA)( VG_(malloc), VG_(free), sizeof(HChar*) );
+ vg_assert( VG_(args_for_valgrind) );
+
+ vg_assert( ! VG_(args_for_client) );
+ VG_(args_for_client)
+ = VG_(newXA)( VG_(malloc), VG_(free), sizeof(HChar*) );
+ vg_assert( VG_(args_for_client) );
+
/* Collect up the args-for-V. */
i = 1; /* skip the exe (stage2) name. */
for (; i < argc; i++) {
@@ -182,7 +179,7 @@
augment = False;
if (argv[i][0] != '-')
break;
- add_string( &tmp_xarray, argv[i] );
+ add_string( tmp_xarray, argv[i] );
}
/* Should now be looking at the exe name. */
@@ -195,13 +192,9 @@
/* The rest are args for the client. */
for (; i < argc; i++) {
vg_assert(argv[i]);
- add_string( &VG_(args_for_client), argv[i] );
+ add_string( VG_(args_for_client), argv[i] );
}
- VG_(args_for_valgrind).size = 0;
- VG_(args_for_valgrind).used = 0;
- VG_(args_for_valgrind).strs = NULL;
-
/* Get extra args from ~/.valgrindrc, $VALGRIND_OPTS and
./.valgrindrc into VG_(args_for_valgrind). */
if (augment) {
@@ -219,14 +212,15 @@
}
/* .. and record how many extras we got. */
- VG_(args_for_valgrind_noexecpass) = VG_(args_for_valgrind).used;
+ VG_(args_for_valgrind_noexecpass)
+ = VG_(sizeXA)( VG_(args_for_valgrind) );
/* Finally, copy tmp_xarray onto the end. */
- for (i = 0; i < tmp_xarray.used; i++)
- add_string( &VG_(args_for_valgrind), tmp_xarray.strs[i] );
+ for (i = 0; i < VG_(sizeXA)( tmp_xarray ); i++)
+ add_string( VG_(args_for_valgrind),
+ * (HChar**)VG_(indexXA)( tmp_xarray, i ) );
- if (tmp_xarray.strs)
- VG_(free)(tmp_xarray.strs);
+ VG_(deleteXA)( tmp_xarray );
}
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_coredump/coredump-elf.c
===================================================================
--- trunk/coregrind/m_coredump/coredump-elf.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_coredump/coredump-elf.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -40,6 +40,7 @@
#include "pub_core_libcassert.h" // VG_(exit), vg_assert
#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
#include "pub_core_threadstate.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_options.h"
Modified: trunk/coregrind/m_debugger.c
===================================================================
--- trunk/coregrind/m_debugger.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_debugger.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -31,6 +31,7 @@
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_threadstate.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_debugger.h"
#include "pub_core_libcbase.h"
Modified: trunk/coregrind/m_initimg/initimg-linux.c
===================================================================
--- trunk/coregrind/m_initimg/initimg-linux.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_initimg/initimg-linux.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -37,6 +37,7 @@
#include "pub_core_libcfile.h"
#include "pub_core_libcproc.h"
#include "pub_core_libcprint.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_mallocfree.h"
@@ -438,6 +439,7 @@
Bool have_exename;
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
+ vg_assert( VG_(args_for_client) );
/* use our own auxv as a prototype */
orig_auxv = VG_(find_auxv)(init_sp);
@@ -464,9 +466,11 @@
if (have_exename)
stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
- for (i = 0; i < VG_(args_for_client).used; i++) {
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argc++;
- stringsize += VG_(strlen)( VG_(args_for_client).strs[i] ) + 1;
+ stringsize += VG_(strlen)( * (HChar**)
+ VG_(indexXA)( VG_(args_for_client), i ))
+ + 1;
}
/* ...and the environment */
@@ -604,8 +608,11 @@
if (have_exename)
*ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
- for (i = 0; i < VG_(args_for_client).used; i++) {
- *ptr++ = (Addr)copy_str(&strtab, VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ *ptr++ = (Addr)copy_str(
+ &strtab,
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i )
+ );
}
*ptr++ = 0;
Modified: trunk/coregrind/m_libcfile.c
===================================================================
--- trunk/coregrind/m_libcfile.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_libcfile.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -37,6 +37,7 @@
#include "pub_core_libcfile.h"
#include "pub_core_libcprint.h" // VG_(sprintf)
#include "pub_core_libcproc.h" // VG_(getpid), VG_(getppid)
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h" // VG_(fd_hard_limit)
#include "pub_core_syscall.h"
Modified: trunk/coregrind/m_libcproc.c
===================================================================
--- trunk/coregrind/m_libcproc.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_libcproc.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -38,6 +38,7 @@
#include "pub_core_libcsignal.h"
#include "pub_core_mallocfree.h"
#include "pub_core_syscall.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
/* ---------------------------------------------------------------------
Modified: trunk/coregrind/m_main.c
===================================================================
--- trunk/coregrind/m_main.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_main.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -32,6 +32,7 @@
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
#include "pub_core_threadstate.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_commandline.h"
@@ -245,10 +246,12 @@
UInt i;
HChar* str;
+ vg_assert( VG_(args_for_valgrind) );
+
/* parse the options we have (only the options we care about now) */
- for (i = 0; i < VG_(args_for_valgrind).used; i++) {
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
- str = VG_(args_for_valgrind).strs[i];
+ str = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
vg_assert(str);
if (VG_STREQ(str, "--version")) {
@@ -295,9 +298,11 @@
VG_(err_config_error)("Please use absolute paths in "
"./configure --prefix=... or --libdir=...");
- for (i = 0; i < VG_(args_for_valgrind).used; i++) {
+ vg_assert( VG_(args_for_valgrind) );
- HChar* arg = VG_(args_for_valgrind).strs[i];
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
+
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
HChar* colon = arg;
/* Look for a colon in the switch name */
@@ -494,7 +499,7 @@
VG_(err_bad_option)(arg);
}
skip_arg:
- if (arg != VG_(args_for_valgrind).strs[i]) {
+ if (arg != * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i )) {
VG_(free)(arg);
}
}
@@ -744,6 +749,9 @@
HChar* xpost = VG_(clo_xml) ? "</line>" : "";
Int i;
+ vg_assert( VG_(args_for_client) );
+ vg_assert( VG_(args_for_valgrind) );
+
if (VG_(clo_xml)) {
VG_(message)(Vg_UserMsg, "<?xml version=\"1.0\"?>");
VG_(message)(Vg_UserMsg, "");
@@ -798,8 +806,10 @@
VG_(getpid)(), VG_(getppid)() );
if (VG_(args_the_exename))
VG_(message)(Vg_UserMsg, " %s", VG_(args_the_exename));
- for (i = 0; i < VG_(args_for_client).used; i++)
- VG_(message)(Vg_UserMsg, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++)
+ VG_(message)(Vg_UserMsg,
+ " %s",
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
if (VG_(clo_log_file_qualifier)) {
HChar* val = VG_(getenv)(VG_(clo_log_file_qualifier));
VG_(message)(Vg_UserMsg, "");
@@ -835,10 +845,10 @@
if (VG_(name_of_launcher))
VG_(message)(Vg_UserMsg, " <exe>%t</exe>",
VG_(name_of_launcher));
- for (i = 0; i < VG_(args_for_valgrind).used; i++) {
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
VG_(message)(Vg_UserMsg,
" <arg>%t</arg>",
- VG_(args_for_valgrind).strs[i]);
+ * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ));
}
VG_(message)(Vg_UserMsg, " </vargv>");
@@ -846,9 +856,10 @@
if (VG_(args_the_exename))
VG_(message)(Vg_UserMsg, " <exe>%t</exe>",
VG_(args_the_exename));
- for (i = 0; i < VG_(args_for_client).used; i++) {
- VG_(message)(Vg_UserMsg, " <arg>%t</arg>",
- VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ VG_(message)(Vg_UserMsg,
+ " <arg>%t</arg>",
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
}
VG_(message)(Vg_UserMsg, " </argv>");
@@ -868,12 +879,16 @@
VG_(message)(Vg_DebugMsg, "Command line");
if (VG_(args_the_exename))
VG_(message)(Vg_DebugMsg, " %s", VG_(args_the_exename));
- for (i = 0; i < VG_(args_for_client).used; i++)
- VG_(message)(Vg_DebugMsg, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++)
+ VG_(message)(Vg_DebugMsg,
+ " %s",
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
VG_(message)(Vg_DebugMsg, "Startup, with flags:");
- for (i = 0; i < VG_(args_for_valgrind).used; i++) {
- VG_(message)(Vg_DebugMsg, " %s", VG_(args_for_valgrind).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
+ VG_(message)(Vg_DebugMsg,
+ " %s",
+ * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ));
}
VG_(message)(Vg_DebugMsg, "Contents of /proc/version:");
@@ -1365,12 +1380,20 @@
//--------------------------------------------------------------
VG_(debugLog)(1, "main", "Split up command line\n");
VG_(split_up_argv)( argc, argv );
+ vg_assert( VG_(args_for_valgrind) );
+ vg_assert( VG_(args_for_client) );
if (0) {
- for (i = 0; i < VG_(args_for_valgrind).used; i++)
- VG_(printf)("varg %s\n", VG_(args_for_valgrind).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++)
+ VG_(printf)(
+ "varg %s\n",
+ * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i )
+ );
VG_(printf)(" exe %s\n", VG_(args_the_exename));
- for (i = 0; i < VG_(args_for_client).used; i++)
- VG_(printf)("carg %s\n", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++)
+ VG_(printf)(
+ "carg %s\n",
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i )
+ );
}
//--------------------------------------------------------------
@@ -1482,9 +1505,9 @@
VG_(strlen)( VG_(args_the_exename) ));
VG_(write)(fd, nul, 1);
- for (i = 0; i < VG_(args_for_client).used; i++) {
- VG_(write)(fd, VG_(args_for_client).strs[i],
- VG_(strlen)( VG_(args_for_client).strs[i] ));
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
+ VG_(write)(fd, arg, VG_(strlen)( arg ));
VG_(write)(fd, nul, 1);
}
Modified: trunk/coregrind/m_redir.c
===================================================================
--- trunk/coregrind/m_redir.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_redir.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -45,6 +45,7 @@
#include "pub_core_tooliface.h" // VG_(needs).malloc_replacement
#include "pub_core_machine.h" // VG_(fnptr_to_fnentry)
#include "pub_core_aspacemgr.h" // VG_(am_find_nsegment)
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h" // VG_(client___libc_freeres_wrapper)
#include "pub_core_demangle.h" // VG_(maybe_Z_demangle)
Modified: trunk/coregrind/m_signals.c
===================================================================
--- trunk/coregrind/m_signals.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_signals.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -84,6 +84,7 @@
#include "pub_core_vkiscnums.h"
#include "pub_core_debuglog.h"
#include "pub_core_threadstate.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debugger.h" // For VG_(start_debugger)
Modified: trunk/coregrind/m_stacktrace.c
===================================================================
--- trunk/coregrind/m_stacktrace.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_stacktrace.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -39,6 +39,7 @@
#include "pub_core_machine.h"
#include "pub_core_options.h"
#include "pub_core_stacktrace.h"
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h" // VG_(client__dl_sysinfo_int80)
#include "pub_core_trampoline.h"
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -35,6 +35,7 @@
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_aspacemgr.h"
#include "pub_core_transtab.h" // VG_(discard_translations)
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h" // VG_(brk_base), VG_(brk_limit)
#include "pub_core_debuglog.h"
#include "pub_core_errormgr.h"
@@ -2469,14 +2470,15 @@
if (!VG_(clo_trace_children)) {
argv = (Char**)ARG2;
} else {
+ vg_assert( VG_(args_for_valgrind) );
vg_assert( VG_(args_for_valgrind_noexecpass) >= 0 );
vg_assert( VG_(args_for_valgrind_noexecpass)
- <= VG_(args_for_valgrind).used );
+ <= VG_(sizeXA)( VG_(args_for_valgrind) ) );
/* how many args in total will there be? */
// launcher basename
tot_args = 1;
// V's args
- tot_args += VG_(args_for_valgrind).used;
+ tot_args += VG_(sizeXA)( VG_(args_for_valgrind) );
tot_args -= VG_(args_for_valgrind_noexecpass);
// name of client exe
tot_args++;
@@ -2492,10 +2494,10 @@
// copy
j = 0;
argv[j++] = launcher_basename;
- for (i = 0; i < VG_(args_for_valgrind).used; i++) {
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
if (i < VG_(args_for_valgrind_noexecpass))
continue;
- argv[j++] = VG_(args_for_valgrind).strs[i];
+ argv[j++] = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
}
argv[j++] = (Char*)ARG1;
if (arg2copy && arg2copy[0])
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -35,6 +35,7 @@
#include "pub_core_aspacemgr.h"
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_transtab.h" // VG_(discard_translations)
+#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_debuglog.h"
#include "pub_core_libcbase.h"
Modified: trunk/include/Makefile.am
===================================================================
--- trunk/include/Makefile.am 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/include/Makefile.am 2007-02-25 15:08:24 UTC (rev 6616)
@@ -32,4 +32,5 @@
pub_tool_tooliface.h \
pub_tool_vki.h \
pub_tool_vkiscnums.h \
+ pub_tool_xarray.h \
valgrind.h
Modified: trunk/include/pub_tool_clientstate.h
===================================================================
--- trunk/include/pub_tool_clientstate.h 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/include/pub_tool_clientstate.h 2007-02-25 15:08:24 UTC (rev 6616)
@@ -31,21 +31,14 @@
#ifndef __PUB_TOOL_CLIENTSTATE_H
#define __PUB_TOOL_CLIENTSTATE_H
+/* Note, this header requires pub_{core,tool}_xarray.h to be
+ included ahead of it. */
// Command line pieces, after they have been extracted from argv in
// m_main.main(). These are all NULL-terminated vectors.
-/* Expandable arrays of strings. */
-typedef
- struct {
- Int size;
- Int used;
- HChar** strs;
- }
- XArrayStrings;
-
/* Args for the client. */
-extern XArrayStrings VG_(args_for_client);
+extern XArray* /* of HChar* */ VG_(args_for_client);
/* Args for V. This is the concatenation of the following:
- contents of ~/.valgrindrc
@@ -59,7 +52,7 @@
categories for themselves. Therefore we also record the number of
these no-pass-at-execve arguments -- that is what
VG_(args_for_valgrind_noexecpass) is. */
-extern XArrayStrings VG_(args_for_valgrind);
+extern XArray* /* of HChar* */ VG_(args_for_valgrind);
/* Number of leading args in VG_(args_for_valgrind) not to pass on at
exec time. */
Modified: trunk/massif/ms_main.c
===================================================================
--- trunk/massif/ms_main.c 2007-02-25 15:04:40 UTC (rev 6615)
+++ trunk/massif/ms_main.c 2007-02-25 15:08:24 UTC (rev 6616)
@@ -50,6 +50,7 @@
#include "pub_tool_replacemalloc.h"
#include "pub_tool_stacktrace.h"
#include "pub_tool_tooliface.h"
+#include "pub_tool_xarray.h"
#include "pub_tool_clientstate.h"
#include "valgrind.h" // For {MALLOC,FREE}LIKE_BLOCK
@@ -1296,9 +1297,10 @@
if (VG_(args_the_exename)) {
SPRINTF(buf, "%s", VG_(args_the_exename));
}
- for (i = 0; i < VG_(args_for_client).used; i++) {
- if (VG_(args_for_client).strs[i])
- SPRINTF(buf, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
+ if (arg)
+ SPRINTF(buf, " %s", arg);
}
SPRINTF(buf, /*" (%d ms/sample)\"\n"*/ "\"\n"
"DATE \"\"\n"
@@ -1619,9 +1621,10 @@
if (VG_(args_the_exename)) {
SPRINTF(buf, " %s", VG_(args_the_exename));
}
- for (i = 0; i < VG_(args_for_client).used; i++) {
- if (VG_(args_for_client).strs[i])
- SPRINTF(buf, " %s", VG_(args_for_client).strs[i]);
+ for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
+ if (arg)
+ SPRINTF(buf, " %s", arg);
}
SPRINTF(buf, "\n%s\n", maybe_p);
|
|
From: <sv...@va...> - 2007-02-25 15:04:44
|
Author: sewardj
Date: 2007-02-25 15:04:40 +0000 (Sun, 25 Feb 2007)
New Revision: 6615
Log:
Make all the m_xarray functions tool-visible.
Added:
trunk/include/pub_tool_xarray.h
Modified:
trunk/coregrind/m_xarray.c
trunk/coregrind/pub_core_xarray.h
Modified: trunk/coregrind/m_xarray.c
===================================================================
--- trunk/coregrind/m_xarray.c 2007-02-25 11:51:13 UTC (rev 6614)
+++ trunk/coregrind/m_xarray.c 2007-02-25 15:04:40 UTC (rev 6615)
@@ -35,7 +35,7 @@
#include "pub_core_xarray.h" /* self */
-/* See pub_core_xarray.h for details of what this is all about. */
+/* See pub_tool_xarray.h for details of what this is all about. */
struct _XArray {
void* (*alloc) ( SizeT ); /* alloc fn (nofail) */
Modified: trunk/coregrind/pub_core_xarray.h
===================================================================
--- trunk/coregrind/pub_core_xarray.h 2007-02-25 11:51:13 UTC (rev 6614)
+++ trunk/coregrind/pub_core_xarray.h 2007-02-25 15:04:40 UTC (rev 6615)
@@ -33,61 +33,15 @@
//--------------------------------------------------------------------
// PURPOSE: Provides a simple but useful structure, which is an array
-// in which elements can be added at the end. The array is expanded
-// as needed by multiplying its size by a constant factor (usually 2).
-// This gives amortised O(1) insertion cost, and, following sorting,
-// the usual O(N log N) binary search cost. Arbitrary element sizes
-// are allowed; the comparison function for sort/lookup can be changed
-// at any time, and duplicates (modulo the comparison function) are
-// allowed.
+// in which elements can be added at the end. See pub_tool_xarray.h
+// for further details.
//--------------------------------------------------------------------
+// No core-only exports; everything in this module is visible to both
+// the core and tools.
-/* It's an abstract type. Bwaha. */
-typedef void XArray;
+#include "pub_tool_xarray.h"
-/* Create new XArray, using given allocation and free function, and
- for elements of the specified size. Alloc fn must not fail (that
- is, if it returns it must have succeeded.) */
-extern XArray* VG_(newXA) ( void*(*alloc_fn)(SizeT),
- void(*free_fn)(void*),
- Word elemSzB );
-
-/* Free all memory associated with an XArray. */
-extern void VG_(deleteXA) ( XArray* );
-
-/* Set the comparison function for this XArray. This clears an
- internal 'array is sorted' flag, which means you must call sortXA
- before making further queries with lookupXA. */
-extern void VG_(setCmpFnXA) ( XArray*, Word (*compar)(void*,void*) );
-
-/* Add an element to an XArray. Element is copied into the XArray. */
-extern void VG_(addToXA) ( XArray*, void* elem );
-
-/* Sort an XArray using its comparison function, if set; else bomb.
- Probably not a stable sort w.r.t. equal elements module cmpFn. */
-extern void VG_(sortXA) ( XArray* );
-
-/* Lookup (by binary search) 'key' in the array. Set *first to be the
- index of the first, and *last to be the index of the last matching
- value found. If any values are found, return True, else return
- False, and don't change *first or *last. Bomb if the array is not
- sorted. */
-extern Bool VG_(lookupXA) ( XArray*, void* key,
- /*OUT*/Word* first, /*OUT*/Word* last );
-
-/* How elements are there in this XArray now? */
-extern Word VG_(sizeXA) ( XArray* );
-
-/* Index into the XArray. Checks bounds and bombs if the index is
- invalid. */
-extern void* VG_(indexXA) ( XArray*, Word );
-
-/* Drop the last n elements of an XArray. Bombs if there are less
- than n elements in the array. */
-extern void VG_(dropTailXA) ( XArray*, Word );
-
-
#endif // __PUB_CORE_XARRAY_H
/*--------------------------------------------------------------------*/
Added: trunk/include/pub_tool_xarray.h
===================================================================
--- trunk/include/pub_tool_xarray.h (rev 0)
+++ trunk/include/pub_tool_xarray.h 2007-02-25 15:04:40 UTC (rev 6615)
@@ -0,0 +1,100 @@
+
+/*--------------------------------------------------------------------*/
+/*--- An expandable array implementation. pub_tool_xarray.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2007-2007 OpenWorks LLP
+ in...@op...
+
+ 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
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_TOOL_XARRAY_H
+#define __PUB_TOOL_XARRAY_H
+
+//--------------------------------------------------------------------
+// PURPOSE: Provides a simple but useful structure, which is an array
+// in which elements can be added at the end. The array is expanded
+// as needed by multiplying its size by a constant factor (usually 2).
+// This gives amortised O(1) insertion cost, and, following sorting,
+// the usual O(log N) binary search cost. Arbitrary element sizes
+// are allowed; the comparison function for sort/lookup can be changed
+// at any time, and duplicates (modulo the comparison function) are
+// allowed.
+//--------------------------------------------------------------------
+
+
+/* It's an abstract type. Bwaha. */
+typedef void XArray;
+
+/* Create new XArray, using given allocation and free function, and
+ for elements of the specified size. Alloc fn must not fail (that
+ is, if it returns it must have succeeded.) */
+extern XArray* VG_(newXA) ( void*(*alloc_fn)(SizeT),
+ void(*free_fn)(void*),
+ Word elemSzB );
+
+/* Free all memory associated with an XArray. */
+extern void VG_(deleteXA) ( XArray* );
+
+/* Set the comparison function for this XArray. This clears an
+ internal 'array is sorted' flag, which means you must call sortXA
+ before making further queries with lookupXA. */
+extern void VG_(setCmpFnXA) ( XArray*, Word (*compar)(void*,void*) );
+
+/* Add an element to an XArray. Element is copied into the XArray. */
+extern void VG_(addToXA) ( XArray*, void* elem );
+
+/* Sort an XArray using its comparison function, if set; else bomb.
+ Probably not a stable sort w.r.t. equal elements module cmpFn. */
+extern void VG_(sortXA) ( XArray* );
+
+/* Lookup (by binary search) 'key' in the array. Set *first to be the
+ index of the first, and *last to be the index of the last matching
+ value found. If any values are found, return True, else return
+ False, and don't change *first or *last. Bomb if the array is not
+ sorted. */
+extern Bool VG_(lookupXA) ( XArray*, void* key,
+ /*OUT*/Word* first, /*OUT*/Word* last );
+
+/* How elements are there in this XArray now? */
+extern Word VG_(sizeXA) ( XArray* );
+
+/* Index into the XArray. Checks bounds and bombs if the index is
+ invalid. What this returns is the address of the specified element
+ in the array, not (of course) the element itself. Note that the
+ element may get moved by subsequent addToXAs/sortXAs, so you should
+ copy it out immediately and not regard its address as unchanging.
+ Note also that indexXA will of course not return NULL if it
+ succeeds. */
+extern void* VG_(indexXA) ( XArray*, Word );
+
+/* Drop the last n elements of an XArray. Bombs if there are less
+ than n elements in the array. */
+extern void VG_(dropTailXA) ( XArray*, Word );
+
+
+#endif // __PUB_TOOL_XARRAY_H
+
+/*--------------------------------------------------------------------*/
+/*--- end pub_tool_xarray.h ---*/
+/*--------------------------------------------------------------------*/
|
|
From: Julian S. <js...@ac...> - 2007-02-25 12:54:54
|
> > Expandable arrays of arbitrary element type T are a simple, useful > > abstraction implemented independently in several places in the code > > base (bad!). This commit moves into public view a generic > > implementation of it which has been lurking in readxcoff.c for some > > time. Currently nothing uses it. > > Nice! Yes. Pleasing. > Should that be O(log N) binary search cost? Yes. Duh. J |
|
From: Nicholas N. <nj...@cs...> - 2007-02-25 12:35:45
|
On Sun, 25 Feb 2007 sv...@va... wrote: > Log: > Expandable arrays of arbitrary element type T are a simple, useful > abstraction implemented independently in several places in the code > base (bad!). This commit moves into public view a generic > implementation of it which has been lurking in readxcoff.c for some > time. Currently nothing uses it. Nice! > +//-------------------------------------------------------------------- > +// PURPOSE: Provides a simple but useful structure, which is an array > +// in which elements can be added at the end. The array is expanded > +// as needed by multiplying its size by a constant factor (usually 2). > +// This gives amortised O(1) insertion cost, and, following sorting, > +// the usual O(N log N) binary search cost. Arbitrary element sizes Should that be O(log N) binary search cost? Nick |
|
From: <sv...@va...> - 2007-02-25 11:51:18
|
Author: sewardj
Date: 2007-02-25 11:51:13 +0000 (Sun, 25 Feb 2007)
New Revision: 6614
Log:
Expandable arrays of arbitrary element type T are a simple, useful
abstraction implemented independently in several places in the code
base (bad!). This commit moves into public view a generic
implementation of it which has been lurking in readxcoff.c for some
time. Currently nothing uses it.
Added:
trunk/coregrind/m_xarray.c
trunk/coregrind/pub_core_xarray.h
Modified:
trunk/coregrind/Makefile.am
trunk/coregrind/m_debuginfo/readxcoff.c
Modified: trunk/coregrind/Makefile.am
===================================================================
--- trunk/coregrind/Makefile.am 2007-02-25 00:04:14 UTC (rev 6613)
+++ trunk/coregrind/Makefile.am 2007-02-25 11:51:13 UTC (rev 6614)
@@ -130,6 +130,7 @@
pub_core_ume.h \
pub_core_vki.h \
pub_core_vkiscnums.h \
+ pub_core_xarray.h \
m_coredump/priv_elf.h \
m_debuginfo/priv_storage.h \
m_debuginfo/priv_readstabs.h \
@@ -188,6 +189,7 @@
m_ume.c \
m_vki.c \
m_vkiscnums.c \
+ m_xarray.c \
m_aspacemgr/aspacemgr-common.c \
m_debuginfo/storage.c \
m_debuginfo/debuginfo.c \
Modified: trunk/coregrind/m_debuginfo/readxcoff.c
===================================================================
--- trunk/coregrind/m_debuginfo/readxcoff.c 2007-02-25 00:04:14 UTC (rev 6613)
+++ trunk/coregrind/m_debuginfo/readxcoff.c 2007-02-25 11:51:13 UTC (rev 6614)
@@ -108,253 +108,7 @@
/*--- Read XCOFF format debug info. ---*/
/*------------------------------------------------------------*/
-/////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////
-// priv
-struct _XArray {
- void* (*alloc) ( SizeT );
- void (*free) ( void* );
- Word (*cmpFn) ( void*, void* );
- Word elemSzB;
- void* arr;
- Word usedsize;
- Word totsize;
- Bool sorted;
-};
-
-// public
-typedef void XArray;
-
-/* Create new XArray, using given allocation and free function, and
- for elements of the specified size. Alloc fn must not fail. */
-extern
-XArray* newXA ( void*(*alloc_fn)(SizeT),
- void(*free_fn)(void*),
- Word elemSzB );
-
-/* Free all memory associated with an XArray. */
-void deleteXA ( XArray* );
-
-/* Set the comparison function for this XArray. */
-void setCmpFnXA ( XArray*, Word (*compar)(void*,void*) );
-
-/* Add an element to an XArray. Element is copied into the XArray. */
-void addToXA ( XArray*, void* elem );
-
-/* Sort an XArray using its comparison function, if set; else bomb. */
-void sortXA ( XArray* );
-
-/* Lookup (by binary search) 'key' in the array. Set *first to be the
- index of the first, and *last to be the index of the last matching
- value found. If any values are found, return True, else return
- False, and don't change *first or *last. Bomb if the array is not
- sorted. */
-Bool lookupXA ( XArray*, void* key, Word* first, Word* last );
-
-/* How big is the XArray now? */
-Word sizeXA ( XArray* );
-
-/* Index into the XArray. */
-void* indexXA ( XArray*, Word );
-
-/* Drop the last n elements of an XArray. */
-void dropTailXA ( XArray*, Word );
-
-///////////////////////
-
-XArray* newXA ( void*(*alloc_fn)(SizeT),
- void(*free_fn)(void*),
- Word elemSzB )
-{
- struct _XArray* xa;
- vg_assert(alloc_fn);
- vg_assert(free_fn);
- vg_assert(elemSzB > 0);
- xa = alloc_fn( sizeof(struct _XArray) );
- vg_assert(xa);
- xa->alloc = alloc_fn;
- xa->free = free_fn;
- xa->cmpFn = NULL;
- xa->elemSzB = elemSzB;
- xa->usedsize = 0;
- xa->totsize = 0;
- xa->sorted = False;
- xa->arr = NULL;
- return xa;
-}
-
-void deleteXA ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->free);
- if (xa->arr);
- xa->free(xa->arr);
- xa->free(xa);
-}
-
-void setCmpFnXA ( XArray* xao, Word (*compar)(void*,void*) )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(compar);
- xa->cmpFn = compar;
- xa->sorted = False;
-}
-
-void addToXA ( XArray* xao, void* elem )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(elem);
- vg_assert(xa->totsize >= 0);
- vg_assert(xa->usedsize >= 0 && xa->usedsize <= xa->totsize);
- if (xa->usedsize == xa->totsize) {
- void* tmp;
- Word newsz;
- if (xa->totsize == 0)
- vg_assert(!xa->arr);
- if (xa->totsize > 0)
- vg_assert(xa->arr);
- newsz = xa->totsize==0 ? 2 : 2 * xa->totsize;
- if (0)
- VG_(printf)("addToXA: increasing from %ld to %ld\n",
- xa->totsize, newsz);
- tmp = xa->alloc(newsz * xa->elemSzB);
- vg_assert(tmp);
- if (xa->usedsize > 0)
- VG_(memcpy)(tmp, xa->arr, xa->usedsize * xa->elemSzB);
- if (xa->arr)
- xa->free(xa->arr);
- xa->arr = tmp;
- xa->totsize = newsz;
- }
- vg_assert(xa->usedsize < xa->totsize);
- vg_assert(xa->arr);
- VG_(memcpy)( ((UChar*)xa->arr) + xa->usedsize * xa->elemSzB,
- elem, xa->elemSzB );
- xa->usedsize++;
- xa->sorted = False;
-}
-
-// Generic shell sort. Like stdlib.h's qsort().
-static void ssort( void* base, Word nmemb, Word size,
- Word (*compar)(void*, void*) )
-{
- Int incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
- 9841, 29524, 88573, 265720,
- 797161, 2391484 };
- Int lo = 0;
- Int hi = nmemb-1;
- Int i, j, h, bigN, hp;
-
- bigN = hi - lo + 1; if (bigN < 2) return;
- hp = 0; while (hp < 14 && incs[hp] < bigN) hp++; hp--;
-
- #define SORT \
- for ( ; hp >= 0; hp--) { \
- h = incs[hp]; \
- for (i = lo + h; i <= hi; i++) { \
- ASSIGN(v,0, a,i); \
- j = i; \
- while (COMPAR(a,(j-h), v,0) > 0) { \
- ASSIGN(a,j, a,(j-h)); \
- j = j - h; \
- if (j <= (lo + h - 1)) break; \
- } \
- ASSIGN(a,j, v,0); \
- } \
- }
-
- // General case
- {
- char* a = base;
- char v[size]; // will be at least 'size' bytes
-
- #define ASSIGN(dst, dsti, src, srci) \
- VG_(memcpy)( &dst[size*(dsti)], &src[size*(srci)], size );
-
- #define COMPAR(dst, dsti, src, srci) \
- compar( &dst[size*(dsti)], &src[size*(srci)] )
-
- SORT;
-
- #undef ASSIGN
- #undef COMPAR
- }
- #undef SORT
-}
-
-void sortXA ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->cmpFn);
- ssort( xa->arr, xa->usedsize, xa->elemSzB, xa->cmpFn );
- xa->sorted = True;
-}
-
-Bool lookupXA ( XArray* xao, void* key, Word* first, Word* last )
-{
- Word lo, mid, hi, cres;
- void* midv;
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->cmpFn);
- vg_assert(xa->sorted);
- lo = 0;
- hi = xa->usedsize-1;
- while (True) {
- /* current unsearched space is from lo to hi, inclusive. */
- if (lo > hi) return False; /* not found */
- mid = (lo + hi) / 2;
- midv = indexXA( xa, mid );
- cres = xa->cmpFn( key, midv );
- if (cres < 0) { hi = mid-1; continue; }
- if (cres > 0) { lo = mid+1; continue; }
- /* Found it, at mid. See how far we can expand this. */
- vg_assert(xa->cmpFn( key, indexXA(xa, lo) ) >= 0);
- vg_assert(xa->cmpFn( key, indexXA(xa, hi) ) <= 0);
- *first = *last = mid;
- while (*first > 0
- && 0 == xa->cmpFn( key, indexXA(xa, (*first)-1)))
- (*first)--;
- while (*last < xa->usedsize-1
- && 0 == xa->cmpFn( key, indexXA(xa, (*last)+1)))
- (*last)++;
- return True;
- }
-}
-
-Word sizeXA ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- return xa->usedsize;
-}
-
-void* indexXA ( XArray* xao, Word n )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(n >= 0);
- vg_assert(n < xa->usedsize);
- return ((char*)xa->arr) + n * xa->elemSzB;
-}
-
-void dropTailXA ( XArray* xao, Word n )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(n >= 0);
- vg_assert(n <= xa->usedsize);
- xa->usedsize -= n;
-}
-
-/////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////
-
/* COFF uses a strange way to represent symbol names. A symbol is an
eight-byte field.
Added: trunk/coregrind/m_xarray.c
===================================================================
--- trunk/coregrind/m_xarray.c (rev 0)
+++ trunk/coregrind/m_xarray.c 2007-02-25 11:51:13 UTC (rev 6614)
@@ -0,0 +1,252 @@
+
+/*--------------------------------------------------------------------*/
+/*--- An expandable array implementation. m_xarray.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2007-2007 OpenWorks LLP
+ in...@op...
+
+ 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
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_libcbase.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_libcprint.h"
+#include "pub_core_xarray.h" /* self */
+
+
+/* See pub_core_xarray.h for details of what this is all about. */
+
+struct _XArray {
+ void* (*alloc) ( SizeT ); /* alloc fn (nofail) */
+ void (*free) ( void* ); /* free fn */
+ Word (*cmpFn) ( void*, void* ); /* cmp fn (may be NULL) */
+ Word elemSzB; /* element size in bytes */
+ void* arr; /* pointer to elements */
+ Word usedsizeE; /* # used elements in arr */
+ Word totsizeE; /* max size of arr, in elements */
+ Bool sorted; /* is it sorted? */
+};
+
+
+XArray* VG_(newXA) ( void*(*alloc_fn)(SizeT),
+ void(*free_fn)(void*),
+ Word elemSzB )
+{
+ struct _XArray* xa;
+ /* Implementation relies on Word being signed and (possibly)
+ on SizeT being unsigned. */
+ vg_assert( sizeof(Word) == sizeof(void*) );
+ vg_assert( ((Word)(-1)) < ((Word)(0)) );
+ vg_assert( ((SizeT)(-1)) > ((SizeT)(0)) );
+ /* check user-supplied info .. */
+ vg_assert(alloc_fn);
+ vg_assert(free_fn);
+ vg_assert(elemSzB > 0);
+ xa = alloc_fn( sizeof(struct _XArray) );
+ vg_assert(xa);
+ xa->alloc = alloc_fn;
+ xa->free = free_fn;
+ xa->cmpFn = NULL;
+ xa->elemSzB = elemSzB;
+ xa->usedsizeE = 0;
+ xa->totsizeE = 0;
+ xa->sorted = False;
+ xa->arr = NULL;
+ return xa;
+}
+
+void VG_(deleteXA) ( XArray* xao )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(xa->free);
+ if (xa->arr);
+ xa->free(xa->arr);
+ xa->free(xa);
+}
+
+void VG_(setCmpFnXA) ( XArray* xao, Word (*compar)(void*,void*) )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(compar);
+ xa->cmpFn = compar;
+ xa->sorted = False;
+}
+
+inline void* VG_(indexXA) ( XArray* xao, Word n )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(n >= 0);
+ vg_assert(n < xa->usedsizeE);
+ return ((char*)xa->arr) + n * xa->elemSzB;
+}
+
+void VG_(addToXA) ( XArray* xao, void* elem )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(elem);
+ vg_assert(xa->totsizeE >= 0);
+ vg_assert(xa->usedsizeE >= 0 && xa->usedsizeE <= xa->totsizeE);
+ if (xa->usedsizeE == xa->totsizeE) {
+ void* tmp;
+ Word newsz;
+ if (xa->totsizeE == 0)
+ vg_assert(!xa->arr);
+ if (xa->totsizeE > 0)
+ vg_assert(xa->arr);
+ newsz = xa->totsizeE==0 ? 2 : 2 * xa->totsizeE;
+ if (0)
+ VG_(printf)("addToXA: increasing from %ld to %ld\n",
+ xa->totsizeE, newsz);
+ tmp = xa->alloc(newsz * xa->elemSzB);
+ vg_assert(tmp);
+ if (xa->usedsizeE > 0)
+ VG_(memcpy)(tmp, xa->arr, xa->usedsizeE * xa->elemSzB);
+ if (xa->arr)
+ xa->free(xa->arr);
+ xa->arr = tmp;
+ xa->totsizeE = newsz;
+ }
+ vg_assert(xa->usedsizeE < xa->totsizeE);
+ vg_assert(xa->arr);
+ VG_(memcpy)( ((UChar*)xa->arr) + xa->usedsizeE * xa->elemSzB,
+ elem, xa->elemSzB );
+ xa->usedsizeE++;
+ xa->sorted = False;
+}
+
+// Generic shell sort. Like stdlib.h's qsort().
+static void ssort( void* base, Word nmemb, Word size,
+ Word (*compar)(void*, void*) )
+{
+ Int incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
+ 9841, 29524, 88573, 265720,
+ 797161, 2391484 };
+ Int lo = 0;
+ Int hi = nmemb-1;
+ Int i, j, h, bigN, hp;
+
+ bigN = hi - lo + 1; if (bigN < 2) return;
+ hp = 0; while (hp < 14 && incs[hp] < bigN) hp++; hp--;
+
+ #define SORT \
+ for ( ; hp >= 0; hp--) { \
+ h = incs[hp]; \
+ for (i = lo + h; i <= hi; i++) { \
+ ASSIGN(v,0, a,i); \
+ j = i; \
+ while (COMPAR(a,(j-h), v,0) > 0) { \
+ ASSIGN(a,j, a,(j-h)); \
+ j = j - h; \
+ if (j <= (lo + h - 1)) break; \
+ } \
+ ASSIGN(a,j, v,0); \
+ } \
+ }
+
+ // General case
+ {
+ char* a = base;
+ char v[size]; // will be at least 'size' bytes
+
+ #define ASSIGN(dst, dsti, src, srci) \
+ VG_(memcpy)( &dst[size*(dsti)], &src[size*(srci)], size );
+
+ #define COMPAR(dst, dsti, src, srci) \
+ compar( &dst[size*(dsti)], &src[size*(srci)] )
+
+ SORT;
+
+ #undef ASSIGN
+ #undef COMPAR
+ }
+ #undef SORT
+}
+
+void VG_(sortXA) ( XArray* xao )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(xa->cmpFn);
+ ssort( xa->arr, xa->usedsizeE, xa->elemSzB, xa->cmpFn );
+ xa->sorted = True;
+}
+
+Bool VG_(lookupXA) ( XArray* xao, void* key, Word* first, Word* last )
+{
+ Word lo, mid, hi, cres;
+ void* midv;
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(xa->cmpFn);
+ vg_assert(xa->sorted);
+ vg_assert(first);
+ vg_assert(last);
+ lo = 0;
+ hi = xa->usedsizeE-1;
+ while (True) {
+ /* current unsearched space is from lo to hi, inclusive. */
+ if (lo > hi) return False; /* not found */
+ mid = (lo + hi) / 2;
+ midv = VG_(indexXA)( xa, mid );
+ cres = xa->cmpFn( key, midv );
+ if (cres < 0) { hi = mid-1; continue; }
+ if (cres > 0) { lo = mid+1; continue; }
+ /* Found it, at mid. See how far we can expand this. */
+ vg_assert(xa->cmpFn( key, VG_(indexXA)(xa, lo) ) >= 0);
+ vg_assert(xa->cmpFn( key, VG_(indexXA)(xa, hi) ) <= 0);
+ *first = *last = mid;
+ while (*first > 0
+ && 0 == xa->cmpFn( key, VG_(indexXA)(xa, (*first)-1)))
+ (*first)--;
+ while (*last < xa->usedsizeE-1
+ && 0 == xa->cmpFn( key, VG_(indexXA)(xa, (*last)+1)))
+ (*last)++;
+ return True;
+ }
+}
+
+Word VG_(sizeXA) ( XArray* xao )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ return xa->usedsizeE;
+}
+
+void VG_(dropTailXA) ( XArray* xao, Word n )
+{
+ struct _XArray* xa = (struct _XArray*)xao;
+ vg_assert(xa);
+ vg_assert(n >= 0);
+ vg_assert(n <= xa->usedsizeE);
+ xa->usedsizeE -= n;
+}
+
+
+/*--------------------------------------------------------------------*/
+/*--- end m_xarray.c ---*/
+/*--------------------------------------------------------------------*/
Added: trunk/coregrind/pub_core_xarray.h
===================================================================
--- trunk/coregrind/pub_core_xarray.h (rev 0)
+++ trunk/coregrind/pub_core_xarray.h 2007-02-25 11:51:13 UTC (rev 6614)
@@ -0,0 +1,95 @@
+
+/*--------------------------------------------------------------------*/
+/*--- An expandable array implementation. pub_core_xarray.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2007-2007 OpenWorks LLP
+ in...@op...
+
+ 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
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_CORE_XARRAY_H
+#define __PUB_CORE_XARRAY_H
+
+//--------------------------------------------------------------------
+// PURPOSE: Provides a simple but useful structure, which is an array
+// in which elements can be added at the end. The array is expanded
+// as needed by multiplying its size by a constant factor (usually 2).
+// This gives amortised O(1) insertion cost, and, following sorting,
+// the usual O(N log N) binary search cost. Arbitrary element sizes
+// are allowed; the comparison function for sort/lookup can be changed
+// at any time, and duplicates (modulo the comparison function) are
+// allowed.
+//--------------------------------------------------------------------
+
+
+/* It's an abstract type. Bwaha. */
+typedef void XArray;
+
+/* Create new XArray, using given allocation and free function, and
+ for elements of the specified size. Alloc fn must not fail (that
+ is, if it returns it must have succeeded.) */
+extern XArray* VG_(newXA) ( void*(*alloc_fn)(SizeT),
+ void(*free_fn)(void*),
+ Word elemSzB );
+
+/* Free all memory associated with an XArray. */
+extern void VG_(deleteXA) ( XArray* );
+
+/* Set the comparison function for this XArray. This clears an
+ internal 'array is sorted' flag, which means you must call sortXA
+ before making further queries with lookupXA. */
+extern void VG_(setCmpFnXA) ( XArray*, Word (*compar)(void*,void*) );
+
+/* Add an element to an XArray. Element is copied into the XArray. */
+extern void VG_(addToXA) ( XArray*, void* elem );
+
+/* Sort an XArray using its comparison function, if set; else bomb.
+ Probably not a stable sort w.r.t. equal elements module cmpFn. */
+extern void VG_(sortXA) ( XArray* );
+
+/* Lookup (by binary search) 'key' in the array. Set *first to be the
+ index of the first, and *last to be the index of the last matching
+ value found. If any values are found, return True, else return
+ False, and don't change *first or *last. Bomb if the array is not
+ sorted. */
+extern Bool VG_(lookupXA) ( XArray*, void* key,
+ /*OUT*/Word* first, /*OUT*/Word* last );
+
+/* How elements are there in this XArray now? */
+extern Word VG_(sizeXA) ( XArray* );
+
+/* Index into the XArray. Checks bounds and bombs if the index is
+ invalid. */
+extern void* VG_(indexXA) ( XArray*, Word );
+
+/* Drop the last n elements of an XArray. Bombs if there are less
+ than n elements in the array. */
+extern void VG_(dropTailXA) ( XArray*, Word );
+
+
+#endif // __PUB_CORE_XARRAY_H
+
+/*--------------------------------------------------------------------*/
+/*--- end pub_core_xarray.h ---*/
+/*--------------------------------------------------------------------*/
|
|
From: <js...@ac...> - 2007-02-25 09:58:01
|
Nightly build on minnie ( SuSE 10.0, ppc32 ) started at 2007-02-25 09:00:02 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 219 tests, 10 stderr failures, 6 stdout failures, 0 posttest failures == memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-fp (stderr) none/tests/ppc32/round (stdout) none/tests/ppc32/round (stderr) none/tests/ppc32/test_fx (stdout) none/tests/ppc32/test_fx (stderr) none/tests/ppc32/test_gx (stdout) |