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
(32) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(8) |
2
(8) |
3
(15) |
4
(14) |
5
(12) |
6
(40) |
7
(9) |
|
8
(5) |
9
(12) |
10
(9) |
11
(13) |
12
(7) |
13
(7) |
14
(19) |
|
15
(18) |
16
(13) |
17
(16) |
18
(8) |
19
(16) |
20
(16) |
21
(12) |
|
22
(21) |
23
(39) |
24
(27) |
25
(33) |
26
(41) |
27
(17) |
28
(15) |
|
From: Tom H. <th...@cy...> - 2009-02-25 03:45:12
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-02-25 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 == 480 tests, 5 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) |
|
From: Tom H. <th...@cy...> - 2009-02-25 03:32:29
|
Nightly build on mg ( x86_64, Fedora 9 ) started at 2009-02-25 03:10:06 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 == 486 tests, 4 stderr failures, 2 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) memcheck/tests/linux/timerfd-syscall (stdout) none/tests/linux/mremap2 (stdout) |
|
From: Nicholas N. <n.n...@gm...> - 2009-02-25 03:15:07
|
Hi, x86/Linux assembly code and x86/Darwin assembly code appear to be different dialects. Some of the tests in none/tests/x86/ and memcheck/tests/x86/ compile on x86/Darwin, eg. memcheck/tests/bug152022. But some don't, eg. pushfpopf, because x86/Darwin assembler doesn't accept the .type and .size options. The easiest thing to do is move the ones that don't compile on Darwin into an x86-linux/ directory. Anyone have any strong opinons about this, or other insights? Nick |
Author: njn
Date: 2009-02-25 02:57:52 +0000 (Wed, 25 Feb 2009)
New Revision: 9256
Log:
Merge r9255 (CLO cleanups) from the trunk.
Modified:
branches/DARWIN/cachegrind/cg_main.c
branches/DARWIN/callgrind/clo.c
branches/DARWIN/callgrind/sim.c
branches/DARWIN/coregrind/m_debugstub/debugstub-darwin.c
branches/DARWIN/coregrind/m_demangle/vg_libciface.h
branches/DARWIN/coregrind/m_libcbase.c
branches/DARWIN/coregrind/m_libcproc.c
branches/DARWIN/coregrind/m_main.c
branches/DARWIN/coregrind/m_replacemalloc/replacemalloc_core.c
branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c
branches/DARWIN/drd/drd_main.c
branches/DARWIN/exp-ptrcheck/pc_common.c
branches/DARWIN/helgrind/hg_main.c
branches/DARWIN/include/pub_tool_libcbase.h
branches/DARWIN/include/pub_tool_options.h
branches/DARWIN/lackey/lk_main.c
branches/DARWIN/massif/ms_main.c
branches/DARWIN/memcheck/mc_main.c
Modified: branches/DARWIN/cachegrind/cg_main.c
===================================================================
--- branches/DARWIN/cachegrind/cg_main.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/cachegrind/cg_main.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -1645,50 +1645,48 @@
static void parse_cache_opt ( cache_t* cache, Char* opt )
{
- Int i = 0, i2, i3;
+ Long i1, i2, i3;
+ Char* endptr;
- // Option argument looks like "65536,2,64".
- // Find commas, replace with NULs to make three independent
- // strings, then extract numbers, put NULs back. Yuck.
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i2 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i3 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if ('\0' != opt[i]) goto bad;
+ // Option argument looks like "65536,2,64". Extract them.
+ i1 = VG_(strtoll10)(opt, &endptr); if (*endptr != ',') goto bad;
+ i2 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != ',') goto bad;
+ i3 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != '\0') goto bad;
- cache->size = (Int)VG_(atoll)(opt);
- cache->assoc = (Int)VG_(atoll)(opt + i2);
- cache->line_size = (Int)VG_(atoll)(opt + i3);
+ // Check for overflow.
+ cache->size = (Int)i1;
+ cache->assoc = (Int)i2;
+ cache->line_size = (Int)i3;
+ if (cache->size != i1) goto overflow;
+ if (cache->assoc != i2) goto overflow;
+ if (cache->line_size != i3) goto overflow;
- opt[i2-1] = ',';
- opt[i3-1] = ',';
return;
+ overflow:
+ VG_(message)(Vg_UserMsg,
+ "one of the cache parameters was too large and overflowed\n");
bad:
+ // XXX: this omits the "--I1/D1/L2=" part from the message, but that's
+ // not a big deal.
VG_(err_bad_option)(opt);
}
static Bool cg_process_cmd_line_option(Char* arg)
{
+ Char* tmp_str;
+
// 5 is length of "--I1="
- if (VG_CLO_STREQN(5, arg, "--I1="))
- parse_cache_opt(&clo_I1_cache, &arg[5]);
- else if (VG_CLO_STREQN(5, arg, "--D1="))
- parse_cache_opt(&clo_D1_cache, &arg[5]);
- else if (VG_CLO_STREQN(5, arg, "--L2="))
- parse_cache_opt(&clo_L2_cache, &arg[5]);
- else if (VG_CLO_STREQN(22, arg, "--cachegrind-out-file=")) {
- clo_cachegrind_out_file = &arg[22];
- }
- else VG_BOOL_CLO(arg, "--cache-sim", clo_cache_sim)
- else VG_BOOL_CLO(arg, "--branch-sim", clo_branch_sim)
+ if VG_STR_CLO(arg, "--I1", tmp_str)
+ parse_cache_opt(&clo_I1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--D1", tmp_str)
+ parse_cache_opt(&clo_D1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--L2", tmp_str)
+ parse_cache_opt(&clo_L2_cache, tmp_str);
+
+ else if VG_STR_CLO( arg, "--cachegrind-out-file", clo_cachegrind_out_file) {}
+ else if VG_BOOL_CLO(arg, "--cache-sim", clo_cache_sim) {}
+ else if VG_BOOL_CLO(arg, "--branch-sim", clo_branch_sim) {}
else
return False;
Modified: branches/DARWIN/callgrind/clo.c
===================================================================
--- branches/DARWIN/callgrind/clo.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/callgrind/clo.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -395,252 +395,128 @@
/*--- Command line processing ---*/
/*--------------------------------------------------------------------*/
-static Char* getUInt(Char* s, UInt* pn)
-{
- UInt n = 0;
- while((*s >='0') && (*s <='9')) {
- n = 10*n + (*s-'0');
- s++;
- }
- if (pn) *pn = n;
- return s;
-}
-
-__attribute__((unused))
-static UWord getUWord(Char* s)
-{
- UWord n = 0;
- Bool isHex = False;
-
- if ((s[0] == '0') && (s[1] == 'x')) {
- isHex = True;
- s += 2;
- }
-
- if (!isHex) {
- while((*s >='0') && (*s <='9')) {
- n = 10*n + (*s-'0');
- s++;
- }
- }
- else {
- while(1) {
- if ((*s >='0') && (*s <='9')) {
- n = 16*n + (*s-'0');
- s++;
- continue;
- }
- if ((*s >='a') && (*s <='f')) {
- n = 16*n + (*s-'a'+10);
- s++;
- continue;
- }
- if ((*s >='A') && (*s <='F')) {
- n = 16*n + (*s-'A'+10);
- s++;
- continue;
- }
- break;
- }
- }
-
- return n;
-}
-
Bool CLG_(process_cmd_line_option)(Char* arg)
{
- if (0 == VG_(strcmp)(arg, "--skip-plt=yes"))
- CLG_(clo).skip_plt = True;
- else if (0 == VG_(strcmp)(arg, "--skip-plt=no"))
- CLG_(clo).skip_plt = False;
+ Char* tmp_str;
- else if (0 == VG_(strcmp)(arg, "--collect-jumps=yes"))
- CLG_(clo).collect_jumps = True;
- else if (0 == VG_(strcmp)(arg, "--collect-jumps=no"))
- CLG_(clo).collect_jumps = False;
+ if VG_BOOL_CLO(arg, "--skip-plt", CLG_(clo).skip_plt) {}
+
+ else if VG_BOOL_CLO(arg, "--collect-jumps", CLG_(clo).collect_jumps) {}
/* compatibility alias, deprecated option */
- else if (0 == VG_(strcmp)(arg, "--trace-jump=yes"))
- CLG_(clo).collect_jumps = True;
- else if (0 == VG_(strcmp)(arg, "--trace-jump=no"))
- CLG_(clo).collect_jumps = False;
+ else if VG_BOOL_CLO(arg, "--trace-jump", CLG_(clo).collect_jumps) {}
- else if (0 == VG_(strcmp)(arg, "--combine-dumps=yes"))
- CLG_(clo).combine_dumps = True;
- else if (0 == VG_(strcmp)(arg, "--combine-dumps=no"))
- CLG_(clo).combine_dumps = False;
+ else if VG_BOOL_CLO(arg, "--combine-dumps", CLG_(clo).combine_dumps) {}
- else if (0 == VG_(strcmp)(arg, "--collect-atstart=yes"))
- CLG_(clo).collect_atstart = True;
- else if (0 == VG_(strcmp)(arg, "--collect-atstart=no"))
- CLG_(clo).collect_atstart = False;
+ else if VG_BOOL_CLO(arg, "--collect-atstart", CLG_(clo).collect_atstart) {}
- else if (0 == VG_(strcmp)(arg, "--instr-atstart=yes"))
- CLG_(clo).instrument_atstart = True;
- else if (0 == VG_(strcmp)(arg, "--instr-atstart=no"))
- CLG_(clo).instrument_atstart = False;
+ else if VG_BOOL_CLO(arg, "--instr-atstart", CLG_(clo).instrument_atstart) {}
- else if (0 == VG_(strcmp)(arg, "--separate-threads=yes"))
- CLG_(clo).separate_threads = True;
- else if (0 == VG_(strcmp)(arg, "--separate-threads=no"))
- CLG_(clo).separate_threads = False;
+ else if VG_BOOL_CLO(arg, "--separate-threads", CLG_(clo).separate_threads) {}
- else if (0 == VG_(strcmp)(arg, "--compress-strings=yes"))
- CLG_(clo).compress_strings = True;
- else if (0 == VG_(strcmp)(arg, "--compress-strings=no"))
- CLG_(clo).compress_strings = False;
+ else if VG_BOOL_CLO(arg, "--compress-strings", CLG_(clo).compress_strings) {}
+ else if VG_BOOL_CLO(arg, "--compress-mangled", CLG_(clo).compress_mangled) {}
+ else if VG_BOOL_CLO(arg, "--compress-pos", CLG_(clo).compress_pos) {}
- else if (0 == VG_(strcmp)(arg, "--compress-mangled=yes"))
- CLG_(clo).compress_mangled = True;
- else if (0 == VG_(strcmp)(arg, "--compress-mangled=no"))
- CLG_(clo).compress_mangled = False;
-
- else if (0 == VG_(strcmp)(arg, "--compress-pos=yes"))
- CLG_(clo).compress_pos = True;
- else if (0 == VG_(strcmp)(arg, "--compress-pos=no"))
- CLG_(clo).compress_pos = False;
-
- else if (0 == VG_(strncmp)(arg, "--fn-skip=", 10)) {
- fn_config* fnc = get_fnc(arg+10);
+ else if VG_STR_CLO(arg, "--fn-skip", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->skip = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--dump-before=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_STR_CLO(arg, "--dump-before", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->dump_before = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--zero-before=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_STR_CLO(arg, "--zero-before", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->zero_before = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--dump-after=", 13)) {
- fn_config* fnc = get_fnc(arg+13);
+ else if VG_STR_CLO(arg, "--dump-after", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->dump_after = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--toggle-collect=", 17)) {
- fn_config* fnc = get_fnc(arg+17);
+ else if VG_STR_CLO(arg, "--toggle-collect", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->toggle_collect = CONFIG_TRUE;
/* defaults to initial collection off */
CLG_(clo).collect_atstart = False;
}
- else if (0 == VG_(strncmp)(arg, "--separate-recs=", 16))
- CLG_(clo).separate_recursions = (Int)VG_(atoll)(&arg[16]);
+ else if VG_INT_CLO(arg, "--separate-recs", CLG_(clo).separate_recursions) {}
/* change handling of a jump between functions to ret+call */
- else if (0 == VG_(strcmp)(arg, "--pop-on-jump")) {
- CLG_(clo).pop_on_jump = True;
- }
- else if (0 == VG_(strncmp)(arg, "--pop-on-jump=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_XACT_CLO(arg, "--pop-on-jump", CLG_(clo).pop_on_jump, True) {}
+ else if VG_STR_CLO( arg, "--pop-on-jump", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->pop_on_jump = CONFIG_TRUE;
}
#if CLG_ENABLE_DEBUG
- else if (0 == VG_(strncmp)(arg, "--ct-verbose=", 13))
- CLG_(clo).verbose = (Int)VG_(atoll)(&arg[13]);
+ else if VG_INT_CLO(arg, "--ct-verbose", CLG_(clo).verbose) {}
+ else if VG_INT_CLO(arg, "--ct-vstart", CLG_(clo).verbose_start) {}
- else if (0 == VG_(strncmp)(arg, "--ct-vstart=", 12))
- CLG_(clo).verbose_start = (ULong)VG_(atoll)(&arg[12]);
-
- else if (0 == VG_(strncmp)(arg, "--ct-verbose", 12)) {
- UInt n;
+ else if VG_STREQN(12, arg, "--ct-verbose") {
fn_config* fnc;
- Char* s = getUInt(arg+12, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+12, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->verbosity = n;
}
#endif
- else if (0 == VG_(strncmp)(arg, "--separate-callers=", 19)) {
- if (0 == VG_(strcmp)(arg+19, "auto"))
- CLG_(clo).separate_callers = CONFIG_AUTO;
- else
- CLG_(clo).separate_callers = (Int)VG_(atoll)(&arg[19]);
- }
+ else if VG_XACT_CLO(arg, "--separate-callers=auto",
+ CLG_(clo).separate_callers, CONFIG_AUTO) {}
+ else if VG_INT_CLO( arg, "--separate-callers",
+ CLG_(clo).separate_callers) {}
- else if (0 == VG_(strncmp)(arg, "--fn-group", 10)) {
- UInt n;
+ else if VG_STREQN(10, arg, "--fn-group") {
fn_config* fnc;
- Char* s = getUInt(arg+10, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+10, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->group = n;
}
- else if (0 == VG_(strncmp)(arg, "--separate-callers", 18)) {
- UInt n;
+ else if VG_STREQN(18, arg, "--separate-callers") {
fn_config* fnc;
- Char* s = getUInt(arg+18, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+18, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->separate_callers = n;
}
- else if (0 == VG_(strncmp)(arg, "--separate-recs", 15)) {
- UInt n;
+ else if VG_STREQN(15, arg, "--separate-recs") {
fn_config* fnc;
- Char* s = getUInt(arg+15, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+15, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->separate_recursions = n;
}
- else if (0 == VG_(strncmp)(arg, "--callgrind-out-file=", 21))
- CLG_(clo).out_format = VG_(strdup)("cl.clo.pclo.1", arg+21);
+ else if VG_STR_CLO(arg, "--callgrind-out-file", CLG_(clo).out_format) {}
- else if (0 == VG_(strcmp)(arg, "--mangle-names=yes"))
- CLG_(clo).mangle_names = True;
- else if (0 == VG_(strcmp)(arg, "--mangle-names=no"))
- CLG_(clo).mangle_names = False;
+ else if VG_BOOL_CLO(arg, "--mangle-names", CLG_(clo).mangle_names) {}
- else if (0 == VG_(strcmp)(arg, "--skip-direct-rec=yes"))
- CLG_(clo).skip_direct_recursion = True;
- else if (0 == VG_(strcmp)(arg, "--skip-direct-rec=no"))
- CLG_(clo).skip_direct_recursion = False;
+ else if VG_BOOL_CLO(arg, "--skip-direct-rec",
+ CLG_(clo).skip_direct_recursion) {}
- else if (0 == VG_(strcmp)(arg, "--dump-bbs=yes"))
- CLG_(clo).dump_bbs = True;
- else if (0 == VG_(strcmp)(arg, "--dump-bbs=no"))
- CLG_(clo).dump_bbs = False;
+ else if VG_BOOL_CLO(arg, "--dump-bbs", CLG_(clo).dump_bbs) {}
+ else if VG_BOOL_CLO(arg, "--dump-line", CLG_(clo).dump_line) {}
+ else if VG_BOOL_CLO(arg, "--dump-instr", CLG_(clo).dump_instr) {}
+ else if VG_BOOL_CLO(arg, "--dump-bb", CLG_(clo).dump_bb) {}
- else if (0 == VG_(strcmp)(arg, "--dump-line=yes"))
- CLG_(clo).dump_line = True;
- else if (0 == VG_(strcmp)(arg, "--dump-line=no"))
- CLG_(clo).dump_line = False;
+ else if VG_INT_CLO( arg, "--dump-every-bb", CLG_(clo).dump_every_bb) {}
- else if (0 == VG_(strcmp)(arg, "--dump-instr=yes"))
- CLG_(clo).dump_instr = True;
- else if (0 == VG_(strcmp)(arg, "--dump-instr=no"))
- CLG_(clo).dump_instr = False;
+ else if VG_BOOL_CLO(arg, "--collect-alloc", CLG_(clo).collect_alloc) {}
+ else if VG_BOOL_CLO(arg, "--collect-systime", CLG_(clo).collect_systime) {}
+ else if VG_BOOL_CLO(arg, "--simulate-cache", CLG_(clo).simulate_cache) {}
- else if (0 == VG_(strcmp)(arg, "--dump-bb=yes"))
- CLG_(clo).dump_bb = True;
- else if (0 == VG_(strcmp)(arg, "--dump-bb=no"))
- CLG_(clo).dump_bb = False;
-
- else if (0 == VG_(strncmp)(arg, "--dump-every-bb=", 16))
- CLG_(clo).dump_every_bb = (ULong)VG_(atoll)(&arg[16]);
-
-
- else if (0 == VG_(strcmp)(arg, "--collect-alloc=yes"))
- CLG_(clo).collect_alloc = True;
- else if (0 == VG_(strcmp)(arg, "--collect-alloc=no"))
- CLG_(clo).collect_alloc = False;
-
- else if (0 == VG_(strcmp)(arg, "--collect-systime=yes"))
- CLG_(clo).collect_systime = True;
- else if (0 == VG_(strcmp)(arg, "--collect-systime=no"))
- CLG_(clo).collect_systime = False;
-
- else if (0 == VG_(strcmp)(arg, "--simulate-cache=yes"))
- CLG_(clo).simulate_cache = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-cache=no"))
- CLG_(clo).simulate_cache = False;
-
else {
Bool isCachesimOption = (*CLG_(cachesim).parse_opt)(arg);
Modified: branches/DARWIN/callgrind/sim.c
===================================================================
--- branches/DARWIN/callgrind/sim.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/callgrind/sim.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -1601,40 +1601,33 @@
);
}
-static void parse_opt ( cache_t* cache, char* orig_opt, int opt_len )
+static void parse_opt ( cache_t* cache, char* opt )
{
- int i1, i2, i3;
- int i;
- char *opt = VG_(strdup)("cl.sim.po.1", orig_opt);
+ Long i1, i2, i3;
+ Char* endptr;
- i = i1 = opt_len;
+ // Option argument looks like "65536,2,64". Extract them.
+ i1 = VG_(strtoll10)(opt, &endptr); if (*endptr != ',') goto bad;
+ i2 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != ',') goto bad;
+ i3 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != '\0') goto bad;
- /* Option looks like "--I1=65536,2,64".
- * Find commas, replace with NULs to make three independent
- * strings, then extract numbers. Yuck. */
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i2 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i3 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if ('\0' != opt[i]) goto bad;
+ // Check for overflow.
+ cache->size = (Int)i1;
+ cache->assoc = (Int)i2;
+ cache->line_size = (Int)i3;
+ if (cache->size != i1) goto overflow;
+ if (cache->assoc != i2) goto overflow;
+ if (cache->line_size != i3) goto overflow;
- cache->size = (Int)VG_(atoll)(opt + i1);
- cache->assoc = (Int)VG_(atoll)(opt + i2);
- cache->line_size = (Int)VG_(atoll)(opt + i3);
-
- VG_(free)(opt);
-
return;
+ overflow:
+ VG_(message)(Vg_UserMsg,
+ "one of the cache parameters was too large and overflowed\n");
bad:
- VG_(err_bad_option)(orig_opt);
+ // XXX: this omits the "--I1/D1/L2=" part from the message, but that's
+ // not a big deal.
+ VG_(err_bad_option)(opt);
}
/* Check for command line option for cache configuration.
@@ -1644,36 +1637,25 @@
*/
static Bool cachesim_parse_opt(Char* arg)
{
- if (0 == VG_(strcmp)(arg, "--simulate-wb=yes"))
- clo_simulate_writeback = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-wb=no"))
- clo_simulate_writeback = False;
+ Char* tmp_str;
- else if (0 == VG_(strcmp)(arg, "--simulate-hwpref=yes"))
- clo_simulate_hwpref = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-hwpref=no"))
- clo_simulate_hwpref = False;
+ if VG_BOOL_CLO(arg, "--simulate-wb", clo_simulate_writeback) {}
+ else if VG_BOOL_CLO(arg, "--simulate-hwpref", clo_simulate_hwpref) {}
+ else if VG_BOOL_CLO(arg, "--simulate-sectors", clo_simulate_sectors) {}
- else if (0 == VG_(strcmp)(arg, "--simulate-sectors=yes"))
- clo_simulate_sectors = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-sectors=no"))
- clo_simulate_sectors = False;
+ else if VG_BOOL_CLO(arg, "--cacheuse", clo_collect_cacheuse) {
+ if (clo_collect_cacheuse) {
+ /* Use counters only make sense with fine dumping */
+ CLG_(clo).dump_instr = True;
+ }
+ }
- else if (0 == VG_(strcmp)(arg, "--cacheuse=yes")) {
- clo_collect_cacheuse = True;
- /* Use counters only make sense with fine dumping */
- CLG_(clo).dump_instr = True;
- }
- else if (0 == VG_(strcmp)(arg, "--cacheuse=no"))
- clo_collect_cacheuse = False;
-
- /* 5 is length of "--I1=" */
- else if (0 == VG_(strncmp)(arg, "--I1=", 5))
- parse_opt(&clo_I1_cache, arg, 5);
- else if (0 == VG_(strncmp)(arg, "--D1=", 5))
- parse_opt(&clo_D1_cache, arg, 5);
- else if (0 == VG_(strncmp)(arg, "--L2=", 5))
- parse_opt(&clo_L2_cache, arg, 5);
+ else if VG_STR_CLO(arg, "--I1", tmp_str)
+ parse_opt(&clo_I1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--D1", tmp_str)
+ parse_opt(&clo_D1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--L2", tmp_str)
+ parse_opt(&clo_L2_cache, tmp_str);
else
return False;
Modified: branches/DARWIN/coregrind/m_debugstub/debugstub-darwin.c
===================================================================
--- branches/DARWIN/coregrind/m_debugstub/debugstub-darwin.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_debugstub/debugstub-darwin.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -784,13 +784,13 @@
{
Long addr, len;
- addr = VG_(atoll16)(cmd);
+ addr = VG_(strtoll16)(cmd, NULL);
cmd = VG_(strchr)(cmd, ',');
if (!cmd) {
write_command(sock, "E01"); // fixme errno
return;
}
- len = VG_(atoll16)(cmd+1);
+ len = VG_(strtoll16)(cmd+1, NULL);
if (len > (sizeof(outbuf)-1) / 2) len = (sizeof(outbuf)-1) / 2;
if (! VG_(am_is_valid_for_client)((Addr)addr, (SizeT)len, VKI_PROT_READ)) {
@@ -807,14 +807,14 @@
Long addr, len;
unsigned char *inbuf;
- addr = VG_(atoll16)(cmd);
+ addr = VG_(strtoll16)(cmd, NULL);
cmd = VG_(strchr)(cmd, ',');
if (!cmd) {
write_command(sock, "E01"); // fixme errno
return;
}
- len = VG_(atoll16)(cmd+1);
+ len = VG_(strtoll16)(cmd+1, NULL);
if (! VG_(am_is_valid_for_client)((Addr)addr, (SizeT)len, VKI_PROT_READ)) {
write_command(sock, "E14"); // fixme EFAULT
@@ -983,7 +983,7 @@
}
if (cmd[0] == ':') {
// target thread ID
- tid = VG_(atoll16)(cmd+1);
+ tid = VG_(strtoll16)(cmd+1, NULL);
continueOthers = False;
}
@@ -1013,7 +1013,7 @@
{
char rbuf[16];
int rsize;
- Long reg = VG_(atoll16)(cmd);
+ Long reg = VG_(strtoll16)(cmd, NULL);
if (!VG_(is_valid_tid)(query_tid)) {
write_command(sock, "E01"); // fixme errno
} else if (reg < 0 || reg >= rcount) {
@@ -1030,7 +1030,7 @@
uint8_t rbuf[16] = {0};
int rsize;
- Long reg = VG_(atoll16)(cmd);
+ Long reg = VG_(strtoll16)(cmd, NULL);
cmd = VG_(strchr)(cmd, '=');
if (!cmd) {
write_command(sock, "E01");
@@ -1064,7 +1064,7 @@
static void handle_T(Int sock, char *cmd)
{
- Long tid = VG_(atoll16)(cmd);
+ Long tid = VG_(strtoll16)(cmd, NULL);
if (VG_(is_valid_tid)(tid)) {
write_command(sock, "OK");
} else {
@@ -1220,7 +1220,7 @@
else if (cmd[0] == 'H') {
// Hcxx, Hgxx: set thread focus
if (cmd[1] == 'g' || cmd[1] == 'c') {
- ThreadId tid = VG_(atoll16)(cmd+2);
+ ThreadId tid = VG_(strtoll16)(cmd+2, NULL);
// fixme -1
if (tid == 0) {
tid = first_valid_tid();
Modified: branches/DARWIN/coregrind/m_demangle/vg_libciface.h
===================================================================
--- branches/DARWIN/coregrind/m_demangle/vg_libciface.h 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_demangle/vg_libciface.h 2009-02-25 02:57:52 UTC (rev 9256)
@@ -45,7 +45,7 @@
#define abort() vg_assert(0)
-#define atoi(_str) VG_(atoll)((_str))
+#define atoi(_str) VG_(strtoll10)((_str), NULL)
#define free(_pt) VG_(arena_free) (VG_AR_DEMANGLE,(_pt))
#define memcmp(_s1,_s2,_sz) VG_(memcmp)((_s1),(_s2),(_sz))
#define memcpy(_dd,_ss,_sz) VG_(memcpy)((_dd),(_ss),(_sz))
Modified: branches/DARWIN/coregrind/m_libcbase.c
===================================================================
--- branches/DARWIN/coregrind/m_libcbase.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_libcbase.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -155,16 +155,6 @@
return n;
}
-Long VG_(atoll) ( Char* str )
-{
- return VG_(strtoll10)(str, NULL);
-}
-
-Long VG_(atoll16) ( Char* str )
-{
- return VG_(strtoll16)(str, NULL);
-}
-
Char VG_(tolower) ( Char c )
{
if ( c >= 'A' && c <= 'Z' ) {
Modified: branches/DARWIN/coregrind/m_libcproc.c
===================================================================
--- branches/DARWIN/coregrind/m_libcproc.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_libcproc.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -517,8 +517,13 @@
res = VG_(do_syscall3)(__NR_readlink, (UWord)"/proc/self",
(UWord)pid, sizeof(pid));
if (!res.isError && res.res > 0) {
+ Char* s;
pid[res.res] = '\0';
- res.res = VG_(atoll)(pid);
+ res.res = VG_(strtoll10)(pid, &s);
+ if (*s != '\0') {
+ VG_(message)(Vg_DebugMsg,
+ "Warning: invalid file name linked to by /proc/self: %s", pid);
+ }
}
}
Modified: branches/DARWIN/coregrind/m_main.c
===================================================================
--- branches/DARWIN/coregrind/m_main.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_main.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -275,31 +275,25 @@
str = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
vg_assert(str);
- if (VG_STREQ(str, "--version")) {
- // Ensure the version string goes to stdout
- VG_(clo_log_fd) = 1;
+ // Nb: the version string goes to stdout.
+ if VG_XACT_CLO(str, "--version", VG_(clo_log_fd), 1) {
VG_(printf)("valgrind-" VERSION "\n");
VG_(exit)(0);
+ }
+ else if VG_XACT_CLO(str, "--help", *need_help, 1) {}
+ else if VG_XACT_CLO(str, "-h", *need_help, 1) {}
- } else if (VG_CLO_STREQ(str, "--help") ||
- VG_CLO_STREQ(str, "-h")) {
- *need_help = 1;
+ else if VG_XACT_CLO(str, "--help-debug", *need_help, 2) {}
- } else if (VG_CLO_STREQ(str, "--help-debug")) {
- *need_help = 2;
-
// The tool has already been determined, but we need to know the name
// here.
- } else if (VG_CLO_STREQN(7, str, "--tool=")) {
- *tool = &str[7];
+ else if VG_STR_CLO(str, "--tool", *tool) {}
// Set up VG_(clo_max_stackframe) and VG_(clo_main_stacksize).
// These are needed by VG_(ii_create_image), which happens
// before main_process_cmd_line_options().
- }
- else VG_NUM_CLO(str, "--max-stackframe", VG_(clo_max_stackframe))
- else VG_NUM_CLO(str, "--main-stacksize", VG_(clo_main_stacksize));
-
+ else if VG_INT_CLO(str, "--max-stackframe", VG_(clo_max_stackframe)) {}
+ else if VG_INT_CLO(str, "--main-stacksize", VG_(clo_main_stacksize)) {}
}
}
@@ -314,6 +308,7 @@
SysRes sres;
Int i, tmp_log_fd;
Int toolname_len = VG_(strlen)(toolname);
+ Char* tmp_str; // Used in a couple of places.
enum {
VgLogTo_Fd,
VgLogTo_File,
@@ -343,9 +338,9 @@
// in case someone has combined a prefix with a core-specific option,
// eg. "--memcheck:verbose".
if (*colon == ':') {
- if (VG_CLO_STREQN(2, arg, "--") &&
- VG_CLO_STREQN(toolname_len, arg+2, toolname) &&
- VG_CLO_STREQN(1, arg+2+toolname_len, ":"))
+ if (VG_STREQN(2, arg, "--") &&
+ VG_STREQN(toolname_len, arg+2, toolname) &&
+ VG_STREQN(1, arg+2+toolname_len, ":"))
{
// Prefix matches, convert "--toolname:foo" to "--foo".
// Two things to note:
@@ -375,137 +370,128 @@
}
/* Ignore these options - they've already been handled */
- if (VG_CLO_STREQN( 7, arg, "--tool=")) { }
- else if (VG_CLO_STREQN(20, arg, "--command-line-only=")) { }
- else if (VG_CLO_STREQ(arg, "--")) { }
- else if (VG_CLO_STREQ(arg, "-d")) { }
+ if VG_STREQN( 7, arg, "--tool=") {}
+ else if VG_STREQN(20, arg, "--command-line-only=") {}
+ else if VG_STREQ( arg, "--") {}
+ else if VG_STREQ( arg, "-d") {}
+ else if VG_STREQN(16, arg, "--max-stackframe") {}
+ else if VG_STREQN(16, arg, "--main-stacksize") {}
+ else if VG_STREQN(14, arg, "--profile-heap") {}
- else if (VG_CLO_STREQ(arg, "-v") ||
- VG_CLO_STREQ(arg, "--verbose"))
+ // These options are new.
+ else if (VG_STREQ(arg, "-v") ||
+ VG_STREQ(arg, "--verbose"))
VG_(clo_verbosity)++;
- else if (VG_CLO_STREQ(arg, "-q") ||
- VG_CLO_STREQ(arg, "--quiet"))
+ else if (VG_STREQ(arg, "-q") ||
+ VG_STREQ(arg, "--quiet"))
VG_(clo_verbosity)--;
- else VG_BOOL_CLO(arg, "--xml", VG_(clo_xml))
- else VG_BOOL_CLO(arg, "--db-attach", VG_(clo_db_attach))
- else VG_BOOL_CLO(arg, "--db-listen", VG_(clo_db_listen))
- else VG_NUM_CLO (arg, "--db-listen-port", VG_(clo_db_listen_port))
- else VG_BOOL_CLO(arg, "--demangle", VG_(clo_demangle))
- else VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit))
- else VG_NUM_CLO (arg, "--error-exitcode", VG_(clo_error_exitcode))
- else VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns))
+ else if VG_BOOL_CLO(arg, "--xml", VG_(clo_xml)) {}
+ else if VG_BOOL_CLO(arg, "--db-attach", VG_(clo_db_attach)) {}
+ else if VG_BOOL_CLO(arg, "--db-listen", VG_(clo_db_listen)) {}
+ else if VG_INT_CLO (arg, "--db-listen-port", VG_(clo_db_listen_port)) {}
+ else if VG_BOOL_CLO(arg, "--demangle", VG_(clo_demangle)) {}
+ else if VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit)) {}
+ else if VG_INT_CLO (arg, "--error-exitcode", VG_(clo_error_exitcode)) {}
+ else if VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) {}
- /* The next two are already done in
- early_process_cmd_line_options, but we need to redundantly
- handle them again, so they do not get rejected as invalid. */
- else VG_NUM_CLO (arg, "--max-stackframe", VG_(clo_max_stackframe))
- else VG_NUM_CLO (arg, "--main-stacksize", VG_(clo_main_stacksize))
+ else if VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) {}
+ else if VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main)) {}
+ else if VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp)) {}
+ else if VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds)) {}
+ else if VG_BOOL_CLO(arg, "--trace-children", VG_(clo_trace_children)) {}
+ else if VG_BOOL_CLO(arg, "--child-silent-after-fork",
+ VG_(clo_child_silent_after_fork)) {}
+ else if VG_BOOL_CLO(arg, "--trace-sched", VG_(clo_trace_sched)) {}
+ else if VG_BOOL_CLO(arg, "--trace-signals", VG_(clo_trace_signals)) {}
+ else if VG_BOOL_CLO(arg, "--trace-symtab", VG_(clo_trace_symtab)) {}
+ else if VG_STR_CLO (arg, "--trace-symtab-patt", VG_(clo_trace_symtab_patt)) {}
+ else if VG_BOOL_CLO(arg, "--trace-cfi", VG_(clo_trace_cfi)) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=syms", VG_(clo_debug_dump_syms),
+ True) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=line", VG_(clo_debug_dump_line),
+ True) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=frames",
+ VG_(clo_debug_dump_frames), True) {}
+ else if VG_BOOL_CLO(arg, "--trace-redir", VG_(clo_trace_redir)) {}
- else VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres))
- else VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main))
- else VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp))
- else VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds))
- else VG_BOOL_CLO(arg, "--trace-children", VG_(clo_trace_children))
- else VG_BOOL_CLO(arg, "--child-silent-after-fork",
- VG_(clo_child_silent_after_fork))
- else VG_BOOL_CLO(arg, "--trace-sched", VG_(clo_trace_sched))
- else VG_BOOL_CLO(arg, "--trace-signals", VG_(clo_trace_signals))
- else VG_BOOL_CLO(arg, "--trace-symtab", VG_(clo_trace_symtab))
- else VG_STR_CLO (arg, "--trace-symtab-patt", VG_(clo_trace_symtab_patt))
- else VG_BOOL_CLO(arg, "--trace-cfi", VG_(clo_trace_cfi))
- else VG_XACT_CLO(arg, "--debug-dump=syms", VG_(clo_debug_dump_syms))
- else VG_XACT_CLO(arg, "--debug-dump=line", VG_(clo_debug_dump_line))
- else VG_XACT_CLO(arg, "--debug-dump=frames", VG_(clo_debug_dump_frames))
- else VG_BOOL_CLO(arg, "--trace-redir", VG_(clo_trace_redir))
+ else if VG_BOOL_CLO(arg, "--trace-syscalls", VG_(clo_trace_syscalls)) {}
+ else if VG_BOOL_CLO(arg, "--trace-unknown-syscalls",
+ VG_(clo_trace_unknown_syscalls)) {}
+ else if VG_BOOL_CLO(arg, "--wait-for-gdb", VG_(clo_wait_for_gdb)) {}
+ else if VG_STR_CLO (arg, "--db-command", VG_(clo_db_command)) {}
+ else if VG_STR_CLO (arg, "--sim-hints", VG_(clo_sim_hints)) {}
+ else if VG_BOOL_CLO(arg, "--sym-offsets", VG_(clo_sym_offsets)) {}
+ else if VG_BOOL_CLO(arg, "--read-var-info", VG_(clo_read_var_info)) {}
- else VG_BOOL_CLO(arg, "--trace-syscalls", VG_(clo_trace_syscalls))
- else VG_BOOL_CLO(arg, "--trace-unknown-syscalls", VG_(clo_trace_unknown_syscalls))
- else VG_BOOL_CLO(arg, "--wait-for-gdb", VG_(clo_wait_for_gdb))
- else VG_STR_CLO (arg, "--db-command", VG_(clo_db_command))
- else VG_STR_CLO (arg, "--sim-hints", VG_(clo_sim_hints))
- else VG_BOOL_CLO(arg, "--sym-offsets", VG_(clo_sym_offsets))
- else VG_BOOL_CLO(arg, "--read-var-info", VG_(clo_read_var_info))
+ else if VG_INT_CLO (arg, "--dump-error", VG_(clo_dump_error)) {}
+ else if VG_INT_CLO (arg, "--input-fd", VG_(clo_input_fd)) {}
+ else if VG_INT_CLO (arg, "--sanity-level", VG_(clo_sanity_level)) {}
+ else if VG_BINT_CLO(arg, "--num-callers", VG_(clo_backtrace_size), 1,
+ VG_DEEPEST_BACKTRACE) {}
- else VG_NUM_CLO (arg, "--dump-error", VG_(clo_dump_error))
- else VG_NUM_CLO (arg, "--input-fd", VG_(clo_input_fd))
- else VG_NUM_CLO (arg, "--sanity-level", VG_(clo_sanity_level))
- else VG_BNUM_CLO(arg, "--num-callers", VG_(clo_backtrace_size), 1,
- VG_DEEPEST_BACKTRACE)
+ else if VG_XACT_CLO(arg, "--smc-check=none", VG_(clo_smc_check),
+ Vg_SmcNone);
+ else if VG_XACT_CLO(arg, "--smc-check=stack", VG_(clo_smc_check),
+ Vg_SmcStack);
+ else if VG_XACT_CLO(arg, "--smc-check=all", VG_(clo_smc_check),
+ Vg_SmcAll);
- else if (VG_CLO_STREQ(arg, "--smc-check=none"))
- VG_(clo_smc_check) = Vg_SmcNone;
- else if (VG_CLO_STREQ(arg, "--smc-check=stack"))
- VG_(clo_smc_check) = Vg_SmcStack;
- else if (VG_CLO_STREQ(arg, "--smc-check=all"))
- VG_(clo_smc_check) = Vg_SmcAll;
+ else if VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant)) {}
- else if (VG_CLO_STREQ(arg, "--profile-heap=no"))
- ; /* We already handled it right at the top of valgrind_main.
- Just ignore. */
- else if (VG_CLO_STREQ(arg, "--profile-heap=yes"))
- ; /* ditto */
+ else if VG_BINT_CLO(arg, "--vex-iropt-verbosity",
+ VG_(clo_vex_control).iropt_verbosity, 0, 10) {}
+ else if VG_BINT_CLO(arg, "--vex-iropt-level",
+ VG_(clo_vex_control).iropt_level, 0, 2) {}
+ else if VG_BOOL_CLO(arg, "--vex-iropt-precise-memory-exns",
+ VG_(clo_vex_control).iropt_precise_memory_exns) {}
+ else if VG_BINT_CLO(arg, "--vex-iropt-unroll-thresh",
+ VG_(clo_vex_control).iropt_unroll_thresh, 0, 400) {}
+ else if VG_BINT_CLO(arg, "--vex-guest-max-insns",
+ VG_(clo_vex_control).guest_max_insns, 1, 100) {}
+ else if VG_BINT_CLO(arg, "--vex-guest-chase-thresh",
+ VG_(clo_vex_control).guest_chase_thresh, 0, 99) {}
- else VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant))
-
- else VG_BNUM_CLO(arg, "--vex-iropt-verbosity",
- VG_(clo_vex_control).iropt_verbosity, 0, 10)
- else VG_BNUM_CLO(arg, "--vex-iropt-level",
- VG_(clo_vex_control).iropt_level, 0, 2)
- else VG_BOOL_CLO(arg, "--vex-iropt-precise-memory-exns",
- VG_(clo_vex_control).iropt_precise_memory_exns)
- else VG_BNUM_CLO(arg, "--vex-iropt-unroll-thresh",
- VG_(clo_vex_control).iropt_unroll_thresh, 0, 400)
- else VG_BNUM_CLO(arg, "--vex-guest-max-insns",
- VG_(clo_vex_control).guest_max_insns, 1, 100)
- else VG_BNUM_CLO(arg, "--vex-guest-chase-thresh",
- VG_(clo_vex_control).guest_chase_thresh, 0, 99)
-
- else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
- log_to = VgLogTo_Fd;
+ else if VG_INT_CLO(arg, "--log-fd", tmp_log_fd) {
+ log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
- tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}
- else if (VG_CLO_STREQN(11, arg, "--log-file=")) {
- log_to = VgLogTo_File;
- VG_(clo_log_name) = &arg[11];
+ else if VG_STR_CLO(arg, "--log-file", VG_(clo_log_name)) {
+ log_to = VgLogTo_File;
}
- else if (VG_CLO_STREQN(13, arg, "--log-socket=")) {
- log_to = VgLogTo_Socket;
- VG_(clo_log_name) = &arg[13];
+ else if VG_STR_CLO(arg, "--log-socket", VG_(clo_log_name)) {
+ log_to = VgLogTo_Socket;
}
- else if (VG_CLO_STREQN(19, arg, "--xml-user-comment=")) {
- VG_(clo_xml_user_comment) = &arg[19];
- }
+ else if VG_STR_CLO(arg, "--xml-user-comment",
+ VG_(clo_xml_user_comment)) {}
- else if (VG_CLO_STREQN(15, arg, "--suppressions=")) {
+ else if VG_STR_CLO(arg, "--suppressions", tmp_str) {
if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) {
VG_(message)(Vg_UserMsg, "Too many suppression files specified.");
VG_(message)(Vg_UserMsg,
"Increase VG_CLO_MAX_SFILES and recompile.");
VG_(err_bad_option)(arg);
}
- VG_(clo_suppressions)[VG_(clo_n_suppressions)] = &arg[15];
+ VG_(clo_suppressions)[VG_(clo_n_suppressions)] = tmp_str;
VG_(clo_n_suppressions)++;
}
/* "stuvwxyz" --> stuvwxyz (binary) */
- else if (VG_CLO_STREQN(14, arg, "--trace-flags=")) {
+ else if VG_STR_CLO(arg, "--trace-flags", tmp_str) {
Int j;
- char* opt = & arg[14];
- if (8 != VG_(strlen)(opt)) {
+ if (8 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--trace-flags argument must have 8 digits");
VG_(err_bad_option)(arg);
}
for (j = 0; j < 8; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) VG_(clo_trace_flags) |= (1 << (7-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) VG_(clo_trace_flags) |= (1 << (7-j));
else {
VG_(message)(Vg_UserMsg, "--trace-flags argument can only "
"contain 0s and 1s");
@@ -515,18 +501,17 @@
}
/* "stuvwxyz" --> stuvwxyz (binary) */
- else if (VG_CLO_STREQN(16, arg, "--profile-flags=")) {
+ else if VG_STR_CLO(arg, "--profile-flags", tmp_str) {
Int j;
- char* opt = & arg[16];
- if (8 != VG_(strlen)(opt)) {
+ if (8 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--profile-flags argument must have 8 digits");
VG_(err_bad_option)(arg);
}
for (j = 0; j < 8; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) VG_(clo_profile_flags) |= (1 << (7-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) VG_(clo_profile_flags) |= (1 << (7-j));
else {
VG_(message)(Vg_UserMsg, "--profile-flags argument can only "
"contain 0s and 1s");
@@ -535,14 +520,14 @@
}
}
- else VG_NUM_CLO (arg, "--trace-notbelow", VG_(clo_trace_notbelow))
+ else if VG_INT_CLO (arg, "--trace-notbelow", VG_(clo_trace_notbelow)) {}
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=no"))
- VG_(clo_gen_suppressions) = 0;
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=yes"))
- VG_(clo_gen_suppressions) = 1;
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=all"))
- VG_(clo_gen_suppressions) = 2;
+ else if VG_XACT_CLO(arg, "--gen-suppressions=no",
+ VG_(clo_gen_suppressions), 0) {}
+ else if VG_XACT_CLO(arg, "--gen-suppressions=yes",
+ VG_(clo_gen_suppressions), 1) {}
+ else if VG_XACT_CLO(arg, "--gen-suppressions=all",
+ VG_(clo_gen_suppressions), 2) {}
else if ( ! VG_(needs).command_line_options
|| ! VG_TDICT_CALL(tool_process_cmd_line_option, arg) ) {
@@ -1227,19 +1212,15 @@
// p: none
//--------------------------------------------------------------
/* Start the debugging-log system ASAP. First find out how many
- "-d"s were specified. This is a pre-scan of the command line. */
+ "-d"s were specified. This is a pre-scan of the command line. Also
+ get --profile-heap=yes which is needed by the time we start up dynamic
+ memory management. */
loglevel = 0;
for (i = 1; i < argc; i++) {
- if (argv[i][0] != '-')
- break;
- if (VG_STREQ(argv[i], "--"))
- break;
- if (VG_STREQ(argv[i], "-d"))
- loglevel++;
- if (VG_STREQ(argv[i], "--profile-heap=yes"))
- VG_(clo_profile_heap) = True;
- if (VG_STREQ(argv[i], "--profile-heap=no"))
- VG_(clo_profile_heap) = False;
+ if (argv[i][0] != '-') break;
+ if VG_STREQ(argv[i], "--") break;
+ if VG_STREQ(argv[i], "-d") loglevel++;
+ if VG_BOOL_CLO(argv[i], "--profile-heap", VG_(clo_profile_heap)) {}
}
/* ... and start the debug logger. Now we can safely emit logging
@@ -1371,6 +1352,7 @@
//--------------------------------------------------------------
// Start up the dynamic memory manager
// p: address space management
+ // p: getting --profile-heap
// In fact m_mallocfree is self-initialising, so there's no
// initialisation call to do. Instead, try a simple malloc/
// free pair right now to check that nothing is broken.
@@ -1522,7 +1504,9 @@
//--------------------------------------------------------------
// Load client executable, finding in $PATH if necessary
- // p: early_process_cmd_line_options() [for 'exec', 'need_help']
+ // p: early_process_cmd_line_options() [for 'exec', 'need_help',
+ // clo_max_stackframe,
+ // clo_main_stacksize]
// p: layout_remaining_space [so there's space]
//
// Set up client's environment
Modified: branches/DARWIN/coregrind/m_replacemalloc/replacemalloc_core.c
===================================================================
--- branches/DARWIN/coregrind/m_replacemalloc/replacemalloc_core.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_replacemalloc/replacemalloc_core.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -53,13 +53,11 @@
Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg)
{
- if (VG_CLO_STREQN(12, arg, "--alignment=")) {
- VG_(clo_alignment) = (UInt)VG_(atoll)(&arg[12]);
-
- if (VG_(clo_alignment) < VG_MIN_MALLOC_SZB
- || VG_(clo_alignment) > 4096
- || VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */) {
- VG_(message)(Vg_UserMsg, "");
+ if VG_INT_CLO(arg, "--alignment", VG_(clo_alignment)) {
+ if (VG_(clo_alignment) < VG_MIN_MALLOC_SZB ||
+ VG_(clo_alignment) > 4096 ||
+ VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */)
+ {
VG_(message)(Vg_UserMsg,
"Invalid --alignment= setting. "
"Should be a power of 2, >= %d, <= 4096.", VG_MIN_MALLOC_SZB);
@@ -67,7 +65,7 @@
}
}
- else VG_BOOL_CLO(arg, "--trace-malloc", VG_(clo_trace_malloc))
+ else if VG_BOOL_CLO(arg, "--trace-malloc", VG_(clo_trace_malloc)) {}
else
return False;
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -789,11 +789,16 @@
goto out;
if (VG_(strcmp)(d.d_name, ".") && VG_(strcmp)(d.d_name, "..")) {
- Int fno = VG_(atoll)(d.d_name);
-
- if (fno != f.res)
- if (VG_(clo_track_fds))
- ML_(record_fd_open_named)(-1, fno);
+ Char* s;
+ Int fno = VG_(strtoll10)(d.d_name, &s);
+ if (*s == '\0') {
+ if (fno != f.res)
+ if (VG_(clo_track_fds))
+ ML_(record_fd_open_named)(-1, fno);
+ } else {
+ VG_(message)(Vg_DebugMsg,
+ "Warning: invalid file name in /proc/self/fd: %s", d.d_name);
+ }
}
VG_(lseek)(f.res, d.d_off, VKI_SEEK_SET);
Modified: branches/DARWIN/drd/drd_main.c
===================================================================
--- branches/DARWIN/drd/drd_main.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/drd/drd_main.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -83,27 +83,27 @@
int trace_suppression = -1;
Char* trace_address = 0;
- VG_BOOL_CLO (arg, "--check-stack-var", check_stack_accesses)
- else VG_BOOL_CLO(arg, "--drd-stats", DRD_(s_print_stats))
- else VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked)
- else VG_BOOL_CLO(arg, "--segment-merging", segment_merging)
- else VG_BOOL_CLO(arg, "--show-confl-seg", show_confl_seg)
- else VG_BOOL_CLO(arg, "--show-stack-usage", DRD_(s_show_stack_usage))
- else VG_BOOL_CLO(arg, "--trace-barrier", trace_barrier)
- else VG_BOOL_CLO(arg, "--trace-clientobj", trace_clientobj)
- else VG_BOOL_CLO(arg, "--trace-cond", trace_cond)
- else VG_BOOL_CLO(arg, "--trace-conflict-set", trace_conflict_set)
- else VG_BOOL_CLO(arg, "--trace-csw", trace_csw)
- else VG_BOOL_CLO(arg, "--trace-fork-join", trace_fork_join)
- else VG_BOOL_CLO(arg, "--trace-mutex", trace_mutex)
- else VG_BOOL_CLO(arg, "--trace-rwlock", trace_rwlock)
- else VG_BOOL_CLO(arg, "--trace-segment", trace_segment)
- else VG_BOOL_CLO(arg, "--trace-semaphore", trace_semaphore)
- else VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression)
- else VG_BOOL_CLO(arg, "--var-info", DRD_(s_var_info))
- else VG_NUM_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms)
- else VG_NUM_CLO (arg, "--shared-threshold", shared_threshold_ms)
- else VG_STR_CLO (arg, "--trace-addr", trace_address)
+ if VG_BOOL_CLO(arg, "--check-stack-var", check_stack_accesses) {}
+ else if VG_BOOL_CLO(arg, "--drd-stats", DRD_(s_print_stats)) {}
+ else if VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked) {}
+ else if VG_BOOL_CLO(arg, "--segment-merging", segment_merging) {}
+ else if VG_BOOL_CLO(arg, "--show-confl-seg", show_confl_seg) {}
+ else if VG_BOOL_CLO(arg, "--show-stack-usage", DRD_(s_show_stack_usage)) {}
+ else if VG_BOOL_CLO(arg, "--trace-barrier", trace_barrier) {}
+ else if VG_BOOL_CLO(arg, "--trace-clientobj", trace_clientobj) {}
+ else if VG_BOOL_CLO(arg, "--trace-cond", trace_cond) {}
+ else if VG_BOOL_CLO(arg, "--trace-conflict-set", trace_conflict_set) {}
+ else if VG_BOOL_CLO(arg, "--trace-csw", trace_csw) {}
+ else if VG_BOOL_CLO(arg, "--trace-fork-join", trace_fork_join) {}
+ else if VG_BOOL_CLO(arg, "--trace-mutex", trace_mutex) {}
+ else if VG_BOOL_CLO(arg, "--trace-rwlock", trace_rwlock) {}
+ else if VG_BOOL_CLO(arg, "--trace-segment", trace_segment) {}
+ else if VG_BOOL_CLO(arg, "--trace-semaphore", trace_semaphore) {}
+ else if VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression) {}
+ else if VG_BOOL_CLO(arg, "--var-info", DRD_(s_var_info)) {}
+ else if VG_INT_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) {}
+ else if VG_INT_CLO (arg, "--shared-threshold", shared_threshold_ms) {}
+ else if VG_STR_CLO (arg, "--trace-addr", trace_address) {}
else
return VG_(replacement_malloc_process_cmd_line_option)(arg);
Modified: branches/DARWIN/exp-ptrcheck/pc_common.c
===================================================================
--- branches/DARWIN/exp-ptrcheck/pc_common.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/exp-ptrcheck/pc_common.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -64,9 +64,9 @@
Bool pc_process_cmd_line_options(Char* arg)
{
- VG_BOOL_CLO(arg, "--partial-loads-ok", h_clo_partial_loads_ok)
- /* else VG_BOOL_CLO(arg, "--lossage-check", h_clo_lossage_check) */
- else VG_BOOL_CLO(arg, "--enable-sg-checks", sg_clo_enable_sg_checks)
+ if VG_BOOL_CLO(arg, "--partial-loads-ok", h_clo_partial_loads_ok) {}
+ /* else if VG_BOOL_CLO(arg, "--lossage-check", h_clo_lossage_check) {} */
+ else if VG_BOOL_CLO(arg, "--enable-sg-checks", sg_clo_enable_sg_checks) {}
else
return VG_(replacement_malloc_process_cmd_line_option)(arg);
Modified: branches/DARWIN/helgrind/hg_main.c
===================================================================
--- branches/DARWIN/helgrind/hg_main.c 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/helgrind/hg_main.c 2009-02-25 02:57:52 UTC (rev 9256)
@@ -4000,39 +4000,32 @@
static Bool hg_process_cmd_line_option ( Char* arg )
{
- if (VG_CLO_STREQ(arg, "--track-lockorders=no"))
- HG_(clo_track_lockorders) = False;
- else if (VG_CLO_STREQ(arg, "--track-lockorders=yes"))
- HG_(clo_track_lockorders) = True;
+ Char* tmp_str;
- else if (VG_CLO_STREQ(arg, "--cmp-race-err-addrs=no"))
- HG_(clo_cmp_race_err_addrs) = False;
- else if (VG_CLO_STREQ(arg, "--cmp-race-err-addrs=yes"))
- HG_(clo_cmp_race_err_addrs) = True;
+ if VG_BOOL_CLO(arg, "--track-lockorders",
+ HG_(clo_track_lockorders)) {}
+ else if VG_BOOL_CLO(arg, "--cmp-race-err-addrs",
+ HG_(clo_cmp_race_err_addrs)) {}
+ else if VG_BOOL_CLO(arg, "--show-conflicts",
+ HG_(clo_show_conflicts)) {}
- else if (VG_CLO_STREQ(arg, "--show-conflicts=no"))
- HG_(clo_show_conflicts) = False;
- else if (VG_CLO_STREQ(arg, "--show-conflicts=yes"))
- HG_(clo_show_conflicts) = True;
-
/* If you change the 10k/10mill limits, remember to also change
them in assertions at the top of event_map_maybe_GC. */
- else VG_BNUM_CLO(arg, "--conflict-cache-size",
- HG_(clo_conflict_cache_size), 10*1000, 10*1000*1000)
+ else if VG_BINT_CLO(arg, "--conflict-cache-size",
+ HG_(clo_conflict_cache_size), 10*1000, 10*1000*1000) {}
/* "stuvwx" --> stuvwx (binary) */
- else if (VG_CLO_STREQN(18, arg, "--hg-sanity-flags=")) {
+ else if VG_STR_CLO(arg, "--hg-sanity-flags", tmp_str) {
Int j;
- Char* opt = & arg[18];
- if (6 != VG_(strlen)(opt)) {
+ if (6 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--hg-sanity-flags argument must have 6 digits");
return False;
}
for (j = 0; j < 6; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) HG_(clo_sanity_flags) |= (1 << (6-1-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) HG_(clo_sanity_flags) |= (1 << (6-1-j));
else {
VG_(message)(Vg_UserMsg, "--hg-sanity-flags argument can "
"only contain 0s and 1s");
Modified: branches/DARWIN/include/pub_tool_libcbase.h
===================================================================
--- branches/DARWIN/include/pub_tool_libcbase.h 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/include/pub_tool_libcbase.h 2009-02-25 02:57:52 UTC (rev 9256)
@@ -52,36 +52,28 @@
// is set to the start of the string. None of them test that the number
// fits into 64 bits.
//
-// Nb: if you're wondering why we don't just have a single VG_(strtol) which
+// Nb: if you're wondering why we don't just have a single VG_(strtoll) which
// takes a base, it's because I wanted it to assert if it was given a bogus
// base (the standard glibc one sets 'errno' in this case). But
// m_libcbase.c doesn't import any code, not even vg_assert. --njn
-//
-// XXX: probably would be better to just have VG_(strtoll) which accepts a
-// decimal number by default or a hexadecimal number if '0x' or '0X' occurs
-// at the start.
extern Long VG_(strtoll10) ( Char* str, Char** endptr );
extern Long VG_(strtoll16) ( Char* str, Char** endptr );
- // Convert a string to a double. After leading whitespace is ignored, a
- // '+' or '-' is allowed, and then it accepts a non-empty sequence of
- // decimal digits possibly containing a '.'. Hexadecimal floats are not
- // accepted, nor are "fancy" floats (eg. "3.4e-5", "NAN").
+// Convert a string to a double. After leading whitespace is ignored, a
+// '+' or '-' is allowed, and then it accepts a non-empty sequence of
+// decimal digits possibly containing a '.'. Hexadecimal floats are not
+// accepted, nor are "fancy" floats (eg. "3.4e-5", "NAN").
extern double VG_(strtod) ( Char* str, Char** endptr );
- // These are just like their VG_(strtoll*) counterparts, except that you
- // cannot tell if an error occurred (because 0 is returned) or if there
- // is any trailing non-numeric characterws (eg. in "123xyz").
-extern Long VG_(atoll) ( Char* str ); // base 10
-extern Long VG_(atoll16) ( Char* str ); // base 16; leading 0x accepted
-
/* ---------------------------------------------------------------------
String functions and macros
------------------------------------------------------------------ */
-/* Use this for normal null-termination-style string comparison */
+/* Use this for normal null-termination-style string comparison. */
#define VG_STREQ(s1,s2) ( (s1 != NULL && s2 != NULL \
&& VG_(strcmp)((s1),(s2))==0) ? True : False )
+#define VG_STREQN(n,s1,s2) ( (s1 != NULL && s2 != NULL \
+ && VG_(strncmp)((s1),(s2),(n))==0) ? True : False )
extern SizeT VG_(strlen) ( const Char* str );
extern Char* VG_(strcat) ( Char* dest, const Char* src );
Modified: branches/DARWIN/include/pub_tool_options.h
===================================================================
--- branches/DARWIN/include/pub_tool_options.h 2009-02-25 01:01:05 UTC (rev 9255)
+++ branches/DARWIN/include/pub_tool_options.h 2009-02-25 02:57:52 UTC (rev 9256)
@@ -34,72 +34,110 @@
#include "libvex.h" // for VexControl
-/* Use these for recognising tool command line options -- stops comparing
- once whitespace is reached. */
-#define VG_CLO_STREQ(s1,s2) (0==VG_(strcmp_ws)((s1),(s2)))
-#define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
+// Higher-level command-line option recognisers; use in if/else chains.
+// Note that they assign a value to the 'qq_var' argument. So often they
+// can be used like this:
+//
+// if VG_STR_CLO(arg, "--foo", clo_foo) { }
+//
+// But if you want to do further checking or processing, you can do this:
+//
+// if VG_STR_CLO(arg, "--foo", clo_foo) { <further checking or processing> }
+//
+// They use GNU statement expressions to do the qq_var assignment within a
+// conditional expression.
-/* Higher-level command-line option recognisers; use in if/else chains */
-
+// String argument, eg. --foo=yes or --foo=no
#define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQ(qq_arg, qq_option"=yes")) { (qq_var) = True; } \
- else if (VG_CLO_STREQ(qq_arg, qq_option)) { (qq_var) = True; } \
- else if (VG_CLO_STREQ(qq_arg, qq_option"=no")) { (qq_var) = False; }
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
+ if VG_STREQ(val, "yes") (qq_var) = True; \
+ else if VG_STREQ(val, "no") (qq_var) = False; \
+ True; \
+ }) \
+ )
+// String argument, eg. --foo=bar
#define VG_STR_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
- (qq_var) = &qq_arg[ VG_(strlen)(qq_option)+1 ]; \
- }
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
+ (qq_var) = val; \
+ True; \
+ }) \
+ )
-/* Unbounded integer arg */
-#define VG_NUM_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+// Unbounded integer arg, eg. --foo=10
+#define VG_INT_CLO(qq_arg, qq_option, qq_var) \
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
Char* s; \
- Long n = VG_(strtoll10)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+ Long n = VG_(strtoll10)( val, &s ); \
(qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
+ /* Check for non-numeralness, or overflow. */ \
if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- }
+ True; \
+ }) \
+ )
-/* Bounded integer arg */
-#define VG_BNUM_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+// Bounded integer arg, eg. --foo=10 ; if the value exceeds the bounds it
+// causes an abort. 'qq_base' can be 10 or 16.
+#define VG_BINTN_CLO(qq_base, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
Char* s; \
- Long n = VG_(strtoll10)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+ Long n = VG_(strtoll##qq_base)( val, &s ); \
(qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
+ /* Check for non-numeralness, or overflow. */ \
+ /* Nb: it will overflow if qq_var is unsigned and qq_val is negative! */ \
if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
- if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
- }
+ /* Check bounds. */ \
+ if ((qq_var) < (qq_lo) || (qq_var) > (qq_hi)) { \
+ VG_(message)(Vg_UserMsg, \
+ "'%s' argument must be between %lld and %lld", \
+ (qq_option), (Long)(qq_lo), (Long)(qq_hi)); \
+ VG_(err_bad_option)(qq_arg); \
+ } \
+ True; \
+ }) \
+ )
-/* Bounded hexadecimal arg */
+// Bounded decimal integer arg, eg. --foo=100
+#define VG_BINT_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+ VG_BINTN_CLO(10, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
+
+// Bounded hexadecimal integer arg, eg. --foo=0x1fa8
#define VG_BHEX_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
- Char* s; \
- Long n = VG_(strtoll16)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
- (qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
- if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- if ((qq_...
[truncated message content] |
|
From: Nicholas N. <n.n...@gm...> - 2009-02-25 01:14:51
|
Hi, On my Mac, memcheck/tests/vcpu_fnfns fails due to some tiny FP differences (see below). I propose changing the test to omit the +/- at the start of the answers (to remove +0 and -0 differences), to print 12 decimal places rather than 13 (to remove the difference in the 13th decimal place), and possibly to filter the sign of the exponent if its zero (to remove the difference between 1.0000e-00 and 1.0000e+00). Does this sound reasonable? Nick 94,103c94,103 < ceilD(-9.0000000110000e-01) = -0.0000000000000e+00 < ceilD(-8.0000000120000e-01) = -0.0000000000000e+00 < ceilD(-7.0000000130000e-01) = -0.0000000000000e+00 < ceilD(-6.0000000140000e-01) = -0.0000000000000e+00 < ceilD(-5.0000000150000e-01) = -0.0000000000000e+00 < ceilD(-4.0000000160000e-01) = -0.0000000000000e+00 < ceilD(-3.0000000170000e-01) = -0.0000000000000e+00 < ceilD(-2.0000000180000e-01) = -0.0000000000000e+00 < ceilD(-1.0000000190000e-01) = -0.0000000000000e+00 < ceilD(-1.9999992495467e-09) = -0.0000000000000e+00 --- > ceilD(-9.0000000110000e-01) = +0.0000000000000e+00 > ceilD(-8.0000000120000e-01) = +0.0000000000000e+00 > ceilD(-7.0000000130000e-01) = +0.0000000000000e+00 > ceilD(-6.0000000140000e-01) = +0.0000000000000e+00 > ceilD(-5.0000000150000e-01) = +0.0000000000000e+00 > ceilD(-4.0000000160000e-01) = +0.0000000000000e+00 > ceilD(-3.0000000170000e-01) = +0.0000000000000e+00 > ceilD(-2.0000000180000e-01) = +0.0000000000000e+00 > ceilD(-1.0000000190000e-01) = +0.0000000000000e+00 > ceilD(-1.9999992495467e-09) = +0.0000000000000e+00 135,144c135,144 < ceilF( -9.0110e-01) = -0.0000e+00 < ceilF( -8.0120e-01) = -0.0000e+00 < ceilF( -7.0130e-01) = -0.0000e+00 < ceilF( -6.0140e-01) = -0.0000e+00 < ceilF( -5.0150e-01) = -0.0000e+00 < ceilF( -4.0160e-01) = -0.0000e+00 < ceilF( -3.0170e-01) = -0.0000e+00 < ceilF( -2.0180e-01) = -0.0000e+00 < ceilF( -1.0190e-01) = -0.0000e+00 < ceilF( -1.9999e-03) = -0.0000e+00 --- > ceilF( -9.0110e-01) = +0.0000e+00 > ceilF( -8.0120e-01) = +0.0000e+00 > ceilF( -7.0130e-01) = +0.0000e+00 > ceilF( -6.0140e-01) = +0.0000e+00 > ceilF( -5.0150e-01) = +0.0000e+00 > ceilF( -4.0160e-01) = +0.0000e+00 > ceilF( -3.0170e-01) = +0.0000e+00 > ceilF( -2.0180e-01) = +0.0000e+00 > ceilF( -1.0190e-01) = +0.0000e+00 > ceilF( -1.9999e-03) = +0.0000e+00 308c308 < cosF( -1.9999e-03) = +1.0000e-00 --- > cosF( -1.9999e-03) = +1.0000e+00 539c539 < logD(+3.9999999960000e-01) = -9.1629073287415e-01 --- > logD(+3.9999999960000e-01) = -9.1629073287416e-01 620c620 < asinD(-9.0000000010000e-01) = -1.1197695152281e+00 --- > asinD(-9.0000000010000e-01) = -1.1197695152280e+00 |
Author: njn
Date: 2009-02-25 01:01:05 +0000 (Wed, 25 Feb 2009)
New Revision: 9255
Log:
atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it. This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)
It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll). The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:
VG_BOOL_CLO(arg, "--heap", clo_heap)
else VG_BOOL_CLO(arg, "--stacks", clo_stacks)
else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
else VG_NUM_CLO(arg, "--depth", clo_depth)
(This works because they are actually an if-statement, but it looks odd.)
VG_NUM_CLO uses VG_(stroll10). But if you want to do any checking or
processing, you can't use those macros, leading to code like this:
else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}
So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
They're now just expressions (albeit ones with side-effects, setting the
named variable appropriately). Thus they can be used as if-conditions,
and any post-checking or processing can occur in the then-statement. And
malformed numeric arguments (eg. --log-fd=foo) aren't accepted. This also
means you don't have to specify the lengths of any option strings anywhere
(eg. the 9 in the --log-fd example above). The use of a wrong number
caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
for the more esoteric option names (those with numbers in the option
name). This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
the range -- the current silent truncation is likely to cause confusion as
much as anything.
Modified:
trunk/cachegrind/cg_main.c
trunk/callgrind/clo.c
trunk/callgrind/sim.c
trunk/coregrind/m_demangle/vg_libciface.h
trunk/coregrind/m_libcbase.c
trunk/coregrind/m_libcproc.c
trunk/coregrind/m_main.c
trunk/coregrind/m_replacemalloc/replacemalloc_core.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/drd/drd_main.c
trunk/exp-ptrcheck/pc_common.c
trunk/helgrind/hg_main.c
trunk/include/pub_tool_libcbase.h
trunk/include/pub_tool_options.h
trunk/lackey/lk_main.c
trunk/massif/ms_main.c
trunk/memcheck/mc_main.c
Modified: trunk/cachegrind/cg_main.c
===================================================================
--- trunk/cachegrind/cg_main.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/cachegrind/cg_main.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -1645,50 +1645,48 @@
static void parse_cache_opt ( cache_t* cache, Char* opt )
{
- Int i = 0, i2, i3;
+ Long i1, i2, i3;
+ Char* endptr;
- // Option argument looks like "65536,2,64".
- // Find commas, replace with NULs to make three independent
- // strings, then extract numbers, put NULs back. Yuck.
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i2 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i3 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if ('\0' != opt[i]) goto bad;
+ // Option argument looks like "65536,2,64". Extract them.
+ i1 = VG_(strtoll10)(opt, &endptr); if (*endptr != ',') goto bad;
+ i2 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != ',') goto bad;
+ i3 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != '\0') goto bad;
- cache->size = (Int)VG_(atoll)(opt);
- cache->assoc = (Int)VG_(atoll)(opt + i2);
- cache->line_size = (Int)VG_(atoll)(opt + i3);
+ // Check for overflow.
+ cache->size = (Int)i1;
+ cache->assoc = (Int)i2;
+ cache->line_size = (Int)i3;
+ if (cache->size != i1) goto overflow;
+ if (cache->assoc != i2) goto overflow;
+ if (cache->line_size != i3) goto overflow;
- opt[i2-1] = ',';
- opt[i3-1] = ',';
return;
+ overflow:
+ VG_(message)(Vg_UserMsg,
+ "one of the cache parameters was too large and overflowed\n");
bad:
+ // XXX: this omits the "--I1/D1/L2=" part from the message, but that's
+ // not a big deal.
VG_(err_bad_option)(opt);
}
static Bool cg_process_cmd_line_option(Char* arg)
{
+ Char* tmp_str;
+
// 5 is length of "--I1="
- if (VG_CLO_STREQN(5, arg, "--I1="))
- parse_cache_opt(&clo_I1_cache, &arg[5]);
- else if (VG_CLO_STREQN(5, arg, "--D1="))
- parse_cache_opt(&clo_D1_cache, &arg[5]);
- else if (VG_CLO_STREQN(5, arg, "--L2="))
- parse_cache_opt(&clo_L2_cache, &arg[5]);
- else if (VG_CLO_STREQN(22, arg, "--cachegrind-out-file=")) {
- clo_cachegrind_out_file = &arg[22];
- }
- else VG_BOOL_CLO(arg, "--cache-sim", clo_cache_sim)
- else VG_BOOL_CLO(arg, "--branch-sim", clo_branch_sim)
+ if VG_STR_CLO(arg, "--I1", tmp_str)
+ parse_cache_opt(&clo_I1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--D1", tmp_str)
+ parse_cache_opt(&clo_D1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--L2", tmp_str)
+ parse_cache_opt(&clo_L2_cache, tmp_str);
+
+ else if VG_STR_CLO( arg, "--cachegrind-out-file", clo_cachegrind_out_file) {}
+ else if VG_BOOL_CLO(arg, "--cache-sim", clo_cache_sim) {}
+ else if VG_BOOL_CLO(arg, "--branch-sim", clo_branch_sim) {}
else
return False;
Modified: trunk/callgrind/clo.c
===================================================================
--- trunk/callgrind/clo.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/callgrind/clo.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -395,252 +395,128 @@
/*--- Command line processing ---*/
/*--------------------------------------------------------------------*/
-static Char* getUInt(Char* s, UInt* pn)
-{
- UInt n = 0;
- while((*s >='0') && (*s <='9')) {
- n = 10*n + (*s-'0');
- s++;
- }
- if (pn) *pn = n;
- return s;
-}
-
-__attribute__((unused))
-static UWord getUWord(Char* s)
-{
- UWord n = 0;
- Bool isHex = False;
-
- if ((s[0] == '0') && (s[1] == 'x')) {
- isHex = True;
- s += 2;
- }
-
- if (!isHex) {
- while((*s >='0') && (*s <='9')) {
- n = 10*n + (*s-'0');
- s++;
- }
- }
- else {
- while(1) {
- if ((*s >='0') && (*s <='9')) {
- n = 16*n + (*s-'0');
- s++;
- continue;
- }
- if ((*s >='a') && (*s <='f')) {
- n = 16*n + (*s-'a'+10);
- s++;
- continue;
- }
- if ((*s >='A') && (*s <='F')) {
- n = 16*n + (*s-'A'+10);
- s++;
- continue;
- }
- break;
- }
- }
-
- return n;
-}
-
Bool CLG_(process_cmd_line_option)(Char* arg)
{
- if (0 == VG_(strcmp)(arg, "--skip-plt=yes"))
- CLG_(clo).skip_plt = True;
- else if (0 == VG_(strcmp)(arg, "--skip-plt=no"))
- CLG_(clo).skip_plt = False;
+ Char* tmp_str;
- else if (0 == VG_(strcmp)(arg, "--collect-jumps=yes"))
- CLG_(clo).collect_jumps = True;
- else if (0 == VG_(strcmp)(arg, "--collect-jumps=no"))
- CLG_(clo).collect_jumps = False;
+ if VG_BOOL_CLO(arg, "--skip-plt", CLG_(clo).skip_plt) {}
+
+ else if VG_BOOL_CLO(arg, "--collect-jumps", CLG_(clo).collect_jumps) {}
/* compatibility alias, deprecated option */
- else if (0 == VG_(strcmp)(arg, "--trace-jump=yes"))
- CLG_(clo).collect_jumps = True;
- else if (0 == VG_(strcmp)(arg, "--trace-jump=no"))
- CLG_(clo).collect_jumps = False;
+ else if VG_BOOL_CLO(arg, "--trace-jump", CLG_(clo).collect_jumps) {}
- else if (0 == VG_(strcmp)(arg, "--combine-dumps=yes"))
- CLG_(clo).combine_dumps = True;
- else if (0 == VG_(strcmp)(arg, "--combine-dumps=no"))
- CLG_(clo).combine_dumps = False;
+ else if VG_BOOL_CLO(arg, "--combine-dumps", CLG_(clo).combine_dumps) {}
- else if (0 == VG_(strcmp)(arg, "--collect-atstart=yes"))
- CLG_(clo).collect_atstart = True;
- else if (0 == VG_(strcmp)(arg, "--collect-atstart=no"))
- CLG_(clo).collect_atstart = False;
+ else if VG_BOOL_CLO(arg, "--collect-atstart", CLG_(clo).collect_atstart) {}
- else if (0 == VG_(strcmp)(arg, "--instr-atstart=yes"))
- CLG_(clo).instrument_atstart = True;
- else if (0 == VG_(strcmp)(arg, "--instr-atstart=no"))
- CLG_(clo).instrument_atstart = False;
+ else if VG_BOOL_CLO(arg, "--instr-atstart", CLG_(clo).instrument_atstart) {}
- else if (0 == VG_(strcmp)(arg, "--separate-threads=yes"))
- CLG_(clo).separate_threads = True;
- else if (0 == VG_(strcmp)(arg, "--separate-threads=no"))
- CLG_(clo).separate_threads = False;
+ else if VG_BOOL_CLO(arg, "--separate-threads", CLG_(clo).separate_threads) {}
- else if (0 == VG_(strcmp)(arg, "--compress-strings=yes"))
- CLG_(clo).compress_strings = True;
- else if (0 == VG_(strcmp)(arg, "--compress-strings=no"))
- CLG_(clo).compress_strings = False;
+ else if VG_BOOL_CLO(arg, "--compress-strings", CLG_(clo).compress_strings) {}
+ else if VG_BOOL_CLO(arg, "--compress-mangled", CLG_(clo).compress_mangled) {}
+ else if VG_BOOL_CLO(arg, "--compress-pos", CLG_(clo).compress_pos) {}
- else if (0 == VG_(strcmp)(arg, "--compress-mangled=yes"))
- CLG_(clo).compress_mangled = True;
- else if (0 == VG_(strcmp)(arg, "--compress-mangled=no"))
- CLG_(clo).compress_mangled = False;
-
- else if (0 == VG_(strcmp)(arg, "--compress-pos=yes"))
- CLG_(clo).compress_pos = True;
- else if (0 == VG_(strcmp)(arg, "--compress-pos=no"))
- CLG_(clo).compress_pos = False;
-
- else if (0 == VG_(strncmp)(arg, "--fn-skip=", 10)) {
- fn_config* fnc = get_fnc(arg+10);
+ else if VG_STR_CLO(arg, "--fn-skip", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->skip = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--dump-before=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_STR_CLO(arg, "--dump-before", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->dump_before = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--zero-before=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_STR_CLO(arg, "--zero-before", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->zero_before = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--dump-after=", 13)) {
- fn_config* fnc = get_fnc(arg+13);
+ else if VG_STR_CLO(arg, "--dump-after", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->dump_after = CONFIG_TRUE;
}
- else if (0 == VG_(strncmp)(arg, "--toggle-collect=", 17)) {
- fn_config* fnc = get_fnc(arg+17);
+ else if VG_STR_CLO(arg, "--toggle-collect", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->toggle_collect = CONFIG_TRUE;
/* defaults to initial collection off */
CLG_(clo).collect_atstart = False;
}
- else if (0 == VG_(strncmp)(arg, "--separate-recs=", 16))
- CLG_(clo).separate_recursions = (Int)VG_(atoll)(&arg[16]);
+ else if VG_INT_CLO(arg, "--separate-recs", CLG_(clo).separate_recursions) {}
/* change handling of a jump between functions to ret+call */
- else if (0 == VG_(strcmp)(arg, "--pop-on-jump")) {
- CLG_(clo).pop_on_jump = True;
- }
- else if (0 == VG_(strncmp)(arg, "--pop-on-jump=", 14)) {
- fn_config* fnc = get_fnc(arg+14);
+ else if VG_XACT_CLO(arg, "--pop-on-jump", CLG_(clo).pop_on_jump, True) {}
+ else if VG_STR_CLO( arg, "--pop-on-jump", tmp_str) {
+ fn_config* fnc = get_fnc(tmp_str);
fnc->pop_on_jump = CONFIG_TRUE;
}
#if CLG_ENABLE_DEBUG
- else if (0 == VG_(strncmp)(arg, "--ct-verbose=", 13))
- CLG_(clo).verbose = (Int)VG_(atoll)(&arg[13]);
+ else if VG_INT_CLO(arg, "--ct-verbose", CLG_(clo).verbose) {}
+ else if VG_INT_CLO(arg, "--ct-vstart", CLG_(clo).verbose_start) {}
- else if (0 == VG_(strncmp)(arg, "--ct-vstart=", 12))
- CLG_(clo).verbose_start = (ULong)VG_(atoll)(&arg[12]);
-
- else if (0 == VG_(strncmp)(arg, "--ct-verbose", 12)) {
- UInt n;
+ else if VG_STREQN(12, arg, "--ct-verbose") {
fn_config* fnc;
- Char* s = getUInt(arg+12, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+12, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->verbosity = n;
}
#endif
- else if (0 == VG_(strncmp)(arg, "--separate-callers=", 19)) {
- if (0 == VG_(strcmp)(arg+19, "auto"))
- CLG_(clo).separate_callers = CONFIG_AUTO;
- else
- CLG_(clo).separate_callers = (Int)VG_(atoll)(&arg[19]);
- }
+ else if VG_XACT_CLO(arg, "--separate-callers=auto",
+ CLG_(clo).separate_callers, CONFIG_AUTO) {}
+ else if VG_INT_CLO( arg, "--separate-callers",
+ CLG_(clo).separate_callers) {}
- else if (0 == VG_(strncmp)(arg, "--fn-group", 10)) {
- UInt n;
+ else if VG_STREQN(10, arg, "--fn-group") {
fn_config* fnc;
- Char* s = getUInt(arg+10, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+10, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->group = n;
}
- else if (0 == VG_(strncmp)(arg, "--separate-callers", 18)) {
- UInt n;
+ else if VG_STREQN(18, arg, "--separate-callers") {
fn_config* fnc;
- Char* s = getUInt(arg+18, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+18, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->separate_callers = n;
}
- else if (0 == VG_(strncmp)(arg, "--separate-recs", 15)) {
- UInt n;
+ else if VG_STREQN(15, arg, "--separate-recs") {
fn_config* fnc;
- Char* s = getUInt(arg+15, &n);
- if ((n == 0) || *s != '=') return False;
+ Char* s;
+ UInt n = VG_(strtoll10)(arg+15, &s);
+ if ((n <= 0) || *s != '=') return False;
fnc = get_fnc(s+1);
fnc->separate_recursions = n;
}
- else if (0 == VG_(strncmp)(arg, "--callgrind-out-file=", 21))
- CLG_(clo).out_format = VG_(strdup)("cl.clo.pclo.1", arg+21);
+ else if VG_STR_CLO(arg, "--callgrind-out-file", CLG_(clo).out_format) {}
- else if (0 == VG_(strcmp)(arg, "--mangle-names=yes"))
- CLG_(clo).mangle_names = True;
- else if (0 == VG_(strcmp)(arg, "--mangle-names=no"))
- CLG_(clo).mangle_names = False;
+ else if VG_BOOL_CLO(arg, "--mangle-names", CLG_(clo).mangle_names) {}
- else if (0 == VG_(strcmp)(arg, "--skip-direct-rec=yes"))
- CLG_(clo).skip_direct_recursion = True;
- else if (0 == VG_(strcmp)(arg, "--skip-direct-rec=no"))
- CLG_(clo).skip_direct_recursion = False;
+ else if VG_BOOL_CLO(arg, "--skip-direct-rec",
+ CLG_(clo).skip_direct_recursion) {}
- else if (0 == VG_(strcmp)(arg, "--dump-bbs=yes"))
- CLG_(clo).dump_bbs = True;
- else if (0 == VG_(strcmp)(arg, "--dump-bbs=no"))
- CLG_(clo).dump_bbs = False;
+ else if VG_BOOL_CLO(arg, "--dump-bbs", CLG_(clo).dump_bbs) {}
+ else if VG_BOOL_CLO(arg, "--dump-line", CLG_(clo).dump_line) {}
+ else if VG_BOOL_CLO(arg, "--dump-instr", CLG_(clo).dump_instr) {}
+ else if VG_BOOL_CLO(arg, "--dump-bb", CLG_(clo).dump_bb) {}
- else if (0 == VG_(strcmp)(arg, "--dump-line=yes"))
- CLG_(clo).dump_line = True;
- else if (0 == VG_(strcmp)(arg, "--dump-line=no"))
- CLG_(clo).dump_line = False;
+ else if VG_INT_CLO( arg, "--dump-every-bb", CLG_(clo).dump_every_bb) {}
- else if (0 == VG_(strcmp)(arg, "--dump-instr=yes"))
- CLG_(clo).dump_instr = True;
- else if (0 == VG_(strcmp)(arg, "--dump-instr=no"))
- CLG_(clo).dump_instr = False;
+ else if VG_BOOL_CLO(arg, "--collect-alloc", CLG_(clo).collect_alloc) {}
+ else if VG_BOOL_CLO(arg, "--collect-systime", CLG_(clo).collect_systime) {}
+ else if VG_BOOL_CLO(arg, "--simulate-cache", CLG_(clo).simulate_cache) {}
- else if (0 == VG_(strcmp)(arg, "--dump-bb=yes"))
- CLG_(clo).dump_bb = True;
- else if (0 == VG_(strcmp)(arg, "--dump-bb=no"))
- CLG_(clo).dump_bb = False;
-
- else if (0 == VG_(strncmp)(arg, "--dump-every-bb=", 16))
- CLG_(clo).dump_every_bb = (ULong)VG_(atoll)(&arg[16]);
-
-
- else if (0 == VG_(strcmp)(arg, "--collect-alloc=yes"))
- CLG_(clo).collect_alloc = True;
- else if (0 == VG_(strcmp)(arg, "--collect-alloc=no"))
- CLG_(clo).collect_alloc = False;
-
- else if (0 == VG_(strcmp)(arg, "--collect-systime=yes"))
- CLG_(clo).collect_systime = True;
- else if (0 == VG_(strcmp)(arg, "--collect-systime=no"))
- CLG_(clo).collect_systime = False;
-
- else if (0 == VG_(strcmp)(arg, "--simulate-cache=yes"))
- CLG_(clo).simulate_cache = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-cache=no"))
- CLG_(clo).simulate_cache = False;
-
else {
Bool isCachesimOption = (*CLG_(cachesim).parse_opt)(arg);
Modified: trunk/callgrind/sim.c
===================================================================
--- trunk/callgrind/sim.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/callgrind/sim.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -1506,40 +1506,33 @@
);
}
-static void parse_opt ( cache_t* cache, char* orig_opt, int opt_len )
+static void parse_opt ( cache_t* cache, char* opt )
{
- int i1, i2, i3;
- int i;
- char *opt = VG_(strdup)("cl.sim.po.1", orig_opt);
+ Long i1, i2, i3;
+ Char* endptr;
- i = i1 = opt_len;
+ // Option argument looks like "65536,2,64". Extract them.
+ i1 = VG_(strtoll10)(opt, &endptr); if (*endptr != ',') goto bad;
+ i2 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != ',') goto bad;
+ i3 = VG_(strtoll10)(endptr+1, &endptr); if (*endptr != '\0') goto bad;
- /* Option looks like "--I1=65536,2,64".
- * Find commas, replace with NULs to make three independent
- * strings, then extract numbers. Yuck. */
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i2 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if (',' == opt[i]) {
- opt[i++] = '\0';
- i3 = i;
- } else goto bad;
- while (VG_(isdigit)(opt[i])) i++;
- if ('\0' != opt[i]) goto bad;
+ // Check for overflow.
+ cache->size = (Int)i1;
+ cache->assoc = (Int)i2;
+ cache->line_size = (Int)i3;
+ if (cache->size != i1) goto overflow;
+ if (cache->assoc != i2) goto overflow;
+ if (cache->line_size != i3) goto overflow;
- cache->size = (Int)VG_(atoll)(opt + i1);
- cache->assoc = (Int)VG_(atoll)(opt + i2);
- cache->line_size = (Int)VG_(atoll)(opt + i3);
-
- VG_(free)(opt);
-
return;
+ overflow:
+ VG_(message)(Vg_UserMsg,
+ "one of the cache parameters was too large and overflowed\n");
bad:
- VG_(err_bad_option)(orig_opt);
+ // XXX: this omits the "--I1/D1/L2=" part from the message, but that's
+ // not a big deal.
+ VG_(err_bad_option)(opt);
}
/* Check for command line option for cache configuration.
@@ -1549,36 +1542,25 @@
*/
static Bool cachesim_parse_opt(Char* arg)
{
- if (0 == VG_(strcmp)(arg, "--simulate-wb=yes"))
- clo_simulate_writeback = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-wb=no"))
- clo_simulate_writeback = False;
+ Char* tmp_str;
- else if (0 == VG_(strcmp)(arg, "--simulate-hwpref=yes"))
- clo_simulate_hwpref = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-hwpref=no"))
- clo_simulate_hwpref = False;
+ if VG_BOOL_CLO(arg, "--simulate-wb", clo_simulate_writeback) {}
+ else if VG_BOOL_CLO(arg, "--simulate-hwpref", clo_simulate_hwpref) {}
+ else if VG_BOOL_CLO(arg, "--simulate-sectors", clo_simulate_sectors) {}
- else if (0 == VG_(strcmp)(arg, "--simulate-sectors=yes"))
- clo_simulate_sectors = True;
- else if (0 == VG_(strcmp)(arg, "--simulate-sectors=no"))
- clo_simulate_sectors = False;
+ else if VG_BOOL_CLO(arg, "--cacheuse", clo_collect_cacheuse) {
+ if (clo_collect_cacheuse) {
+ /* Use counters only make sense with fine dumping */
+ CLG_(clo).dump_instr = True;
+ }
+ }
- else if (0 == VG_(strcmp)(arg, "--cacheuse=yes")) {
- clo_collect_cacheuse = True;
- /* Use counters only make sense with fine dumping */
- CLG_(clo).dump_instr = True;
- }
- else if (0 == VG_(strcmp)(arg, "--cacheuse=no"))
- clo_collect_cacheuse = False;
-
- /* 5 is length of "--I1=" */
- else if (0 == VG_(strncmp)(arg, "--I1=", 5))
- parse_opt(&clo_I1_cache, arg, 5);
- else if (0 == VG_(strncmp)(arg, "--D1=", 5))
- parse_opt(&clo_D1_cache, arg, 5);
- else if (0 == VG_(strncmp)(arg, "--L2=", 5))
- parse_opt(&clo_L2_cache, arg, 5);
+ else if VG_STR_CLO(arg, "--I1", tmp_str)
+ parse_opt(&clo_I1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--D1", tmp_str)
+ parse_opt(&clo_D1_cache, tmp_str);
+ else if VG_STR_CLO(arg, "--L2", tmp_str)
+ parse_opt(&clo_L2_cache, tmp_str);
else
return False;
Modified: trunk/coregrind/m_demangle/vg_libciface.h
===================================================================
--- trunk/coregrind/m_demangle/vg_libciface.h 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_demangle/vg_libciface.h 2009-02-25 01:01:05 UTC (rev 9255)
@@ -45,7 +45,7 @@
#define abort() vg_assert(0)
-#define atoi(_str) VG_(atoll)((_str))
+#define atoi(_str) VG_(strtoll10)((_str), NULL)
#define free(_pt) VG_(arena_free) (VG_AR_DEMANGLE,(_pt))
#define memcmp(_s1,_s2,_sz) VG_(memcmp)((_s1),(_s2),(_sz))
#define memcpy(_dd,_ss,_sz) VG_(memcpy)((_dd),(_ss),(_sz))
Modified: trunk/coregrind/m_libcbase.c
===================================================================
--- trunk/coregrind/m_libcbase.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_libcbase.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -155,16 +155,6 @@
return n;
}
-Long VG_(atoll) ( Char* str )
-{
- return VG_(strtoll10)(str, NULL);
-}
-
-Long VG_(atoll16) ( Char* str )
-{
- return VG_(strtoll16)(str, NULL);
-}
-
/* ---------------------------------------------------------------------
String functions
------------------------------------------------------------------ */
Modified: trunk/coregrind/m_libcproc.c
===================================================================
--- trunk/coregrind/m_libcproc.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_libcproc.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -401,8 +401,13 @@
res = VG_(do_syscall3)(__NR_readlink, (UWord)"/proc/self",
(UWord)pid, sizeof(pid));
if (!res.isError && res.res > 0) {
+ Char* s;
pid[res.res] = '\0';
- res.res = VG_(atoll)(pid);
+ res.res = VG_(strtoll10)(pid, &s);
+ if (*s != '\0') {
+ VG_(message)(Vg_DebugMsg,
+ "Warning: invalid file name linked to by /proc/self: %s", pid);
+ }
}
}
Modified: trunk/coregrind/m_main.c
===================================================================
--- trunk/coregrind/m_main.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_main.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -273,31 +273,25 @@
str = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
vg_assert(str);
- if (VG_STREQ(str, "--version")) {
- // Ensure the version string goes to stdout
- VG_(clo_log_fd) = 1;
+ // Nb: the version string goes to stdout.
+ if VG_XACT_CLO(str, "--version", VG_(clo_log_fd), 1) {
VG_(printf)("valgrind-" VERSION "\n");
VG_(exit)(0);
+ }
+ else if VG_XACT_CLO(str, "--help", *need_help, 1) {}
+ else if VG_XACT_CLO(str, "-h", *need_help, 1) {}
- } else if (VG_CLO_STREQ(str, "--help") ||
- VG_CLO_STREQ(str, "-h")) {
- *need_help = 1;
+ else if VG_XACT_CLO(str, "--help-debug", *need_help, 2) {}
- } else if (VG_CLO_STREQ(str, "--help-debug")) {
- *need_help = 2;
-
// The tool has already been determined, but we need to know the name
// here.
- } else if (VG_CLO_STREQN(7, str, "--tool=")) {
- *tool = &str[7];
+ else if VG_STR_CLO(str, "--tool", *tool) {}
// Set up VG_(clo_max_stackframe) and VG_(clo_main_stacksize).
// These are needed by VG_(ii_create_image), which happens
// before main_process_cmd_line_options().
- }
- else VG_NUM_CLO(str, "--max-stackframe", VG_(clo_max_stackframe))
- else VG_NUM_CLO(str, "--main-stacksize", VG_(clo_main_stacksize));
-
+ else if VG_INT_CLO(str, "--max-stackframe", VG_(clo_max_stackframe)) {}
+ else if VG_INT_CLO(str, "--main-stacksize", VG_(clo_main_stacksize)) {}
}
}
@@ -312,6 +306,7 @@
SysRes sres;
Int i, tmp_log_fd;
Int toolname_len = VG_(strlen)(toolname);
+ Char* tmp_str; // Used in a couple of places.
enum {
VgLogTo_Fd,
VgLogTo_File,
@@ -341,9 +336,9 @@
// in case someone has combined a prefix with a core-specific option,
// eg. "--memcheck:verbose".
if (*colon == ':') {
- if (VG_CLO_STREQN(2, arg, "--") &&
- VG_CLO_STREQN(toolname_len, arg+2, toolname) &&
- VG_CLO_STREQN(1, arg+2+toolname_len, ":"))
+ if (VG_STREQN(2, arg, "--") &&
+ VG_STREQN(toolname_len, arg+2, toolname) &&
+ VG_STREQN(1, arg+2+toolname_len, ":"))
{
// Prefix matches, convert "--toolname:foo" to "--foo".
// Two things to note:
@@ -373,134 +368,124 @@
}
/* Ignore these options - they've already been handled */
- if (VG_CLO_STREQN( 7, arg, "--tool=")) { }
- else if (VG_CLO_STREQN(20, arg, "--command-line-only=")) { }
- else if (VG_CLO_STREQ(arg, "--")) { }
- else if (VG_CLO_STREQ(arg, "-d")) { }
+ if VG_STREQN( 7, arg, "--tool=") {}
+ else if VG_STREQN(20, arg, "--command-line-only=") {}
+ else if VG_STREQ( arg, "--") {}
+ else if VG_STREQ( arg, "-d") {}
+ else if VG_STREQN(16, arg, "--max-stackframe") {}
+ else if VG_STREQN(16, arg, "--main-stacksize") {}
+ else if VG_STREQN(14, arg, "--profile-heap") {}
- else if (VG_CLO_STREQ(arg, "-v") ||
- VG_CLO_STREQ(arg, "--verbose"))
+ // These options are new.
+ else if (VG_STREQ(arg, "-v") ||
+ VG_STREQ(arg, "--verbose"))
VG_(clo_verbosity)++;
- else if (VG_CLO_STREQ(arg, "-q") ||
- VG_CLO_STREQ(arg, "--quiet"))
+ else if (VG_STREQ(arg, "-q") ||
+ VG_STREQ(arg, "--quiet"))
VG_(clo_verbosity)--;
- else VG_BOOL_CLO(arg, "--xml", VG_(clo_xml))
- else VG_BOOL_CLO(arg, "--db-attach", VG_(clo_db_attach))
- else VG_BOOL_CLO(arg, "--demangle", VG_(clo_demangle))
- else VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit))
- else VG_NUM_CLO (arg, "--error-exitcode", VG_(clo_error_exitcode))
- else VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns))
+ else if VG_BOOL_CLO(arg, "--xml", VG_(clo_xml)) {}
+ else if VG_BOOL_CLO(arg, "--db-attach", VG_(clo_db_attach)) {}
+ else if VG_BOOL_CLO(arg, "--demangle", VG_(clo_demangle)) {}
+ else if VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit)) {}
+ else if VG_INT_CLO (arg, "--error-exitcode", VG_(clo_error_exitcode)) {}
+ else if VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) {}
- /* The next two are already done in
- early_process_cmd_line_options, but we need to redundantly
- handle them again, so they do not get rejected as invalid. */
- else VG_NUM_CLO (arg, "--max-stackframe", VG_(clo_max_stackframe))
- else VG_NUM_CLO (arg, "--main-stacksize", VG_(clo_main_stacksize))
+ else if VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) {}
+ else if VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main)) {}
+ else if VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp)) {}
+ else if VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds)) {}
+ else if VG_BOOL_CLO(arg, "--trace-children", VG_(clo_trace_children)) {}
+ else if VG_BOOL_CLO(arg, "--child-silent-after-fork",
+ VG_(clo_child_silent_after_fork)) {}
+ else if VG_BOOL_CLO(arg, "--trace-sched", VG_(clo_trace_sched)) {}
+ else if VG_BOOL_CLO(arg, "--trace-signals", VG_(clo_trace_signals)) {}
+ else if VG_BOOL_CLO(arg, "--trace-symtab", VG_(clo_trace_symtab)) {}
+ else if VG_STR_CLO (arg, "--trace-symtab-patt", VG_(clo_trace_symtab_patt)) {}
+ else if VG_BOOL_CLO(arg, "--trace-cfi", VG_(clo_trace_cfi)) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=syms", VG_(clo_debug_dump_syms),
+ True) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=line", VG_(clo_debug_dump_line),
+ True) {}
+ else if VG_XACT_CLO(arg, "--debug-dump=frames",
+ VG_(clo_debug_dump_frames), True) {}
+ else if VG_BOOL_CLO(arg, "--trace-redir", VG_(clo_trace_redir)) {}
- else VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres))
- else VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main))
- else VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp))
- else VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds))
- else VG_BOOL_CLO(arg, "--trace-children", VG_(clo_trace_children))
- else VG_BOOL_CLO(arg, "--child-silent-after-fork",
- VG_(clo_child_silent_after_fork))
- else VG_BOOL_CLO(arg, "--trace-sched", VG_(clo_trace_sched))
- else VG_BOOL_CLO(arg, "--trace-signals", VG_(clo_trace_signals))
- else VG_BOOL_CLO(arg, "--trace-symtab", VG_(clo_trace_symtab))
- else VG_STR_CLO (arg, "--trace-symtab-patt", VG_(clo_trace_symtab_patt))
- else VG_BOOL_CLO(arg, "--trace-cfi", VG_(clo_trace_cfi))
- else VG_XACT_CLO(arg, "--debug-dump=syms", VG_(clo_debug_dump_syms))
- else VG_XACT_CLO(arg, "--debug-dump=line", VG_(clo_debug_dump_line))
- else VG_XACT_CLO(arg, "--debug-dump=frames", VG_(clo_debug_dump_frames))
- else VG_BOOL_CLO(arg, "--trace-redir", VG_(clo_trace_redir))
+ else if VG_BOOL_CLO(arg, "--trace-syscalls", VG_(clo_trace_syscalls)) {}
+ else if VG_BOOL_CLO(arg, "--wait-for-gdb", VG_(clo_wait_for_gdb)) {}
+ else if VG_STR_CLO (arg, "--db-command", VG_(clo_db_command)) {}
+ else if VG_STR_CLO (arg, "--sim-hints", VG_(clo_sim_hints)) {}
+ else if VG_BOOL_CLO(arg, "--sym-offsets", VG_(clo_sym_offsets)) {}
+ else if VG_BOOL_CLO(arg, "--read-var-info", VG_(clo_read_var_info)) {}
- else VG_BOOL_CLO(arg, "--trace-syscalls", VG_(clo_trace_syscalls))
- else VG_BOOL_CLO(arg, "--wait-for-gdb", VG_(clo_wait_for_gdb))
- else VG_STR_CLO (arg, "--db-command", VG_(clo_db_command))
- else VG_STR_CLO (arg, "--sim-hints", VG_(clo_sim_hints))
- else VG_BOOL_CLO(arg, "--sym-offsets", VG_(clo_sym_offsets))
- else VG_BOOL_CLO(arg, "--read-var-info", VG_(clo_read_var_info))
+ else if VG_INT_CLO (arg, "--dump-error", VG_(clo_dump_error)) {}
+ else if VG_INT_CLO (arg, "--input-fd", VG_(clo_input_fd)) {}
+ else if VG_INT_CLO (arg, "--sanity-level", VG_(clo_sanity_level)) {}
+ else if VG_BINT_CLO(arg, "--num-callers", VG_(clo_backtrace_size), 1,
+ VG_DEEPEST_BACKTRACE) {}
- else VG_NUM_CLO (arg, "--dump-error", VG_(clo_dump_error))
- else VG_NUM_CLO (arg, "--input-fd", VG_(clo_input_fd))
- else VG_NUM_CLO (arg, "--sanity-level", VG_(clo_sanity_level))
- else VG_BNUM_CLO(arg, "--num-callers", VG_(clo_backtrace_size), 1,
- VG_DEEPEST_BACKTRACE)
+ else if VG_XACT_CLO(arg, "--smc-check=none", VG_(clo_smc_check),
+ Vg_SmcNone);
+ else if VG_XACT_CLO(arg, "--smc-check=stack", VG_(clo_smc_check),
+ Vg_SmcStack);
+ else if VG_XACT_CLO(arg, "--smc-check=all", VG_(clo_smc_check),
+ Vg_SmcAll);
- else if (VG_CLO_STREQ(arg, "--smc-check=none"))
- VG_(clo_smc_check) = Vg_SmcNone;
- else if (VG_CLO_STREQ(arg, "--smc-check=stack"))
- VG_(clo_smc_check) = Vg_SmcStack;
- else if (VG_CLO_STREQ(arg, "--smc-check=all"))
- VG_(clo_smc_check) = Vg_SmcAll;
+ else if VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant)) {}
- else if (VG_CLO_STREQ(arg, "--profile-heap=no"))
- ; /* We already handled it right at the top of valgrind_main.
- Just ignore. */
- else if (VG_CLO_STREQ(arg, "--profile-heap=yes"))
- ; /* ditto */
+ else if VG_BINT_CLO(arg, "--vex-iropt-verbosity",
+ VG_(clo_vex_control).iropt_verbosity, 0, 10) {}
+ else if VG_BINT_CLO(arg, "--vex-iropt-level",
+ VG_(clo_vex_control).iropt_level, 0, 2) {}
+ else if VG_BOOL_CLO(arg, "--vex-iropt-precise-memory-exns",
+ VG_(clo_vex_control).iropt_precise_memory_exns) {}
+ else if VG_BINT_CLO(arg, "--vex-iropt-unroll-thresh",
+ VG_(clo_vex_control).iropt_unroll_thresh, 0, 400) {}
+ else if VG_BINT_CLO(arg, "--vex-guest-max-insns",
+ VG_(clo_vex_control).guest_max_insns, 1, 100) {}
+ else if VG_BINT_CLO(arg, "--vex-guest-chase-thresh",
+ VG_(clo_vex_control).guest_chase_thresh, 0, 99) {}
- else VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant))
-
- else VG_BNUM_CLO(arg, "--vex-iropt-verbosity",
- VG_(clo_vex_control).iropt_verbosity, 0, 10)
- else VG_BNUM_CLO(arg, "--vex-iropt-level",
- VG_(clo_vex_control).iropt_level, 0, 2)
- else VG_BOOL_CLO(arg, "--vex-iropt-precise-memory-exns",
- VG_(clo_vex_control).iropt_precise_memory_exns)
- else VG_BNUM_CLO(arg, "--vex-iropt-unroll-thresh",
- VG_(clo_vex_control).iropt_unroll_thresh, 0, 400)
- else VG_BNUM_CLO(arg, "--vex-guest-max-insns",
- VG_(clo_vex_control).guest_max_insns, 1, 100)
- else VG_BNUM_CLO(arg, "--vex-guest-chase-thresh",
- VG_(clo_vex_control).guest_chase_thresh, 0, 99)
-
- else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
- log_to = VgLogTo_Fd;
+ else if VG_INT_CLO(arg, "--log-fd", tmp_log_fd) {
+ log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
- tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}
- else if (VG_CLO_STREQN(11, arg, "--log-file=")) {
- log_to = VgLogTo_File;
- VG_(clo_log_name) = &arg[11];
+ else if VG_STR_CLO(arg, "--log-file", VG_(clo_log_name)) {
+ log_to = VgLogTo_File;
}
- else if (VG_CLO_STREQN(13, arg, "--log-socket=")) {
- log_to = VgLogTo_Socket;
- VG_(clo_log_name) = &arg[13];
+ else if VG_STR_CLO(arg, "--log-socket", VG_(clo_log_name)) {
+ log_to = VgLogTo_Socket;
}
- else if (VG_CLO_STREQN(19, arg, "--xml-user-comment=")) {
- VG_(clo_xml_user_comment) = &arg[19];
- }
+ else if VG_STR_CLO(arg, "--xml-user-comment",
+ VG_(clo_xml_user_comment)) {}
- else if (VG_CLO_STREQN(15, arg, "--suppressions=")) {
+ else if VG_STR_CLO(arg, "--suppressions", tmp_str) {
if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) {
VG_(message)(Vg_UserMsg, "Too many suppression files specified.");
VG_(message)(Vg_UserMsg,
"Increase VG_CLO_MAX_SFILES and recompile.");
VG_(err_bad_option)(arg);
}
- VG_(clo_suppressions)[VG_(clo_n_suppressions)] = &arg[15];
+ VG_(clo_suppressions)[VG_(clo_n_suppressions)] = tmp_str;
VG_(clo_n_suppressions)++;
}
/* "stuvwxyz" --> stuvwxyz (binary) */
- else if (VG_CLO_STREQN(14, arg, "--trace-flags=")) {
+ else if VG_STR_CLO(arg, "--trace-flags", tmp_str) {
Int j;
- char* opt = & arg[14];
- if (8 != VG_(strlen)(opt)) {
+ if (8 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--trace-flags argument must have 8 digits");
VG_(err_bad_option)(arg);
}
for (j = 0; j < 8; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) VG_(clo_trace_flags) |= (1 << (7-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) VG_(clo_trace_flags) |= (1 << (7-j));
else {
VG_(message)(Vg_UserMsg, "--trace-flags argument can only "
"contain 0s and 1s");
@@ -510,18 +495,17 @@
}
/* "stuvwxyz" --> stuvwxyz (binary) */
- else if (VG_CLO_STREQN(16, arg, "--profile-flags=")) {
+ else if VG_STR_CLO(arg, "--profile-flags", tmp_str) {
Int j;
- char* opt = & arg[16];
- if (8 != VG_(strlen)(opt)) {
+ if (8 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--profile-flags argument must have 8 digits");
VG_(err_bad_option)(arg);
}
for (j = 0; j < 8; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) VG_(clo_profile_flags) |= (1 << (7-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) VG_(clo_profile_flags) |= (1 << (7-j));
else {
VG_(message)(Vg_UserMsg, "--profile-flags argument can only "
"contain 0s and 1s");
@@ -530,14 +514,14 @@
}
}
- else VG_NUM_CLO (arg, "--trace-notbelow", VG_(clo_trace_notbelow))
+ else if VG_INT_CLO (arg, "--trace-notbelow", VG_(clo_trace_notbelow)) {}
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=no"))
- VG_(clo_gen_suppressions) = 0;
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=yes"))
- VG_(clo_gen_suppressions) = 1;
- else if (VG_CLO_STREQ(arg, "--gen-suppressions=all"))
- VG_(clo_gen_suppressions) = 2;
+ else if VG_XACT_CLO(arg, "--gen-suppressions=no",
+ VG_(clo_gen_suppressions), 0) {}
+ else if VG_XACT_CLO(arg, "--gen-suppressions=yes",
+ VG_(clo_gen_suppressions), 1) {}
+ else if VG_XACT_CLO(arg, "--gen-suppressions=all",
+ VG_(clo_gen_suppressions), 2) {}
else if ( ! VG_(needs).command_line_options
|| ! VG_TDICT_CALL(tool_process_cmd_line_option, arg) ) {
@@ -1206,19 +1190,15 @@
// p: none
//--------------------------------------------------------------
/* Start the debugging-log system ASAP. First find out how many
- "-d"s were specified. This is a pre-scan of the command line. */
+ "-d"s were specified. This is a pre-scan of the command line. Also
+ get --profile-heap=yes which is needed by the time we start up dynamic
+ memory management. */
loglevel = 0;
for (i = 1; i < argc; i++) {
- if (argv[i][0] != '-')
- break;
- if (VG_STREQ(argv[i], "--"))
- break;
- if (VG_STREQ(argv[i], "-d"))
- loglevel++;
- if (VG_STREQ(argv[i], "--profile-heap=yes"))
- VG_(clo_profile_heap) = True;
- if (VG_STREQ(argv[i], "--profile-heap=no"))
- VG_(clo_profile_heap) = False;
+ if (argv[i][0] != '-') break;
+ if VG_STREQ(argv[i], "--") break;
+ if VG_STREQ(argv[i], "-d") loglevel++;
+ if VG_BOOL_CLO(argv[i], "--profile-heap", VG_(clo_profile_heap)) {}
}
/* ... and start the debug logger. Now we can safely emit logging
@@ -1330,6 +1310,7 @@
//--------------------------------------------------------------
// Start up the dynamic memory manager
// p: address space management
+ // p: getting --profile-heap
// In fact m_mallocfree is self-initialising, so there's no
// initialisation call to do. Instead, try a simple malloc/
// free pair right now to check that nothing is broken.
@@ -1481,7 +1462,9 @@
//--------------------------------------------------------------
// Load client executable, finding in $PATH if necessary
- // p: early_process_cmd_line_options() [for 'exec', 'need_help']
+ // p: early_process_cmd_line_options() [for 'exec', 'need_help',
+ // clo_max_stackframe,
+ // clo_main_stacksize]
// p: layout_remaining_space [so there's space]
//
// Set up client's environment
Modified: trunk/coregrind/m_replacemalloc/replacemalloc_core.c
===================================================================
--- trunk/coregrind/m_replacemalloc/replacemalloc_core.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_replacemalloc/replacemalloc_core.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -53,13 +53,11 @@
Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg)
{
- if (VG_CLO_STREQN(12, arg, "--alignment=")) {
- VG_(clo_alignment) = (UInt)VG_(atoll)(&arg[12]);
-
- if (VG_(clo_alignment) < VG_MIN_MALLOC_SZB
- || VG_(clo_alignment) > 4096
- || VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */) {
- VG_(message)(Vg_UserMsg, "");
+ if VG_INT_CLO(arg, "--alignment", VG_(clo_alignment)) {
+ if (VG_(clo_alignment) < VG_MIN_MALLOC_SZB ||
+ VG_(clo_alignment) > 4096 ||
+ VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */)
+ {
VG_(message)(Vg_UserMsg,
"Invalid --alignment= setting. "
"Should be a power of 2, >= %d, <= 4096.", VG_MIN_MALLOC_SZB);
@@ -67,7 +65,7 @@
}
}
- else VG_BOOL_CLO(arg, "--trace-malloc", VG_(clo_trace_malloc))
+ else if VG_BOOL_CLO(arg, "--trace-malloc", VG_(clo_trace_malloc)) {}
else
return False;
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -750,11 +750,16 @@
goto out;
if (VG_(strcmp)(d.d_name, ".") && VG_(strcmp)(d.d_name, "..")) {
- Int fno = VG_(atoll)(d.d_name);
-
- if (fno != f.res)
- if (VG_(clo_track_fds))
- ML_(record_fd_open_named)(-1, fno);
+ Char* s;
+ Int fno = VG_(strtoll10)(d.d_name, &s);
+ if (*s == '\0') {
+ if (fno != f.res)
+ if (VG_(clo_track_fds))
+ ML_(record_fd_open_named)(-1, fno);
+ } else {
+ VG_(message)(Vg_DebugMsg,
+ "Warning: invalid file name in /proc/self/fd: %s", d.d_name);
+ }
}
VG_(lseek)(f.res, d.d_off, VKI_SEEK_SET);
Modified: trunk/drd/drd_main.c
===================================================================
--- trunk/drd/drd_main.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/drd/drd_main.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -83,27 +83,27 @@
int trace_suppression = -1;
Char* trace_address = 0;
- VG_BOOL_CLO (arg, "--check-stack-var", check_stack_accesses)
- else VG_BOOL_CLO(arg, "--drd-stats", DRD_(s_print_stats))
- else VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked)
- else VG_BOOL_CLO(arg, "--segment-merging", segment_merging)
- else VG_BOOL_CLO(arg, "--show-confl-seg", show_confl_seg)
- else VG_BOOL_CLO(arg, "--show-stack-usage", DRD_(s_show_stack_usage))
- else VG_BOOL_CLO(arg, "--trace-barrier", trace_barrier)
- else VG_BOOL_CLO(arg, "--trace-clientobj", trace_clientobj)
- else VG_BOOL_CLO(arg, "--trace-cond", trace_cond)
- else VG_BOOL_CLO(arg, "--trace-conflict-set", trace_conflict_set)
- else VG_BOOL_CLO(arg, "--trace-csw", trace_csw)
- else VG_BOOL_CLO(arg, "--trace-fork-join", trace_fork_join)
- else VG_BOOL_CLO(arg, "--trace-mutex", trace_mutex)
- else VG_BOOL_CLO(arg, "--trace-rwlock", trace_rwlock)
- else VG_BOOL_CLO(arg, "--trace-segment", trace_segment)
- else VG_BOOL_CLO(arg, "--trace-semaphore", trace_semaphore)
- else VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression)
- else VG_BOOL_CLO(arg, "--var-info", DRD_(s_var_info))
- else VG_NUM_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms)
- else VG_NUM_CLO (arg, "--shared-threshold", shared_threshold_ms)
- else VG_STR_CLO (arg, "--trace-addr", trace_address)
+ if VG_BOOL_CLO(arg, "--check-stack-var", check_stack_accesses) {}
+ else if VG_BOOL_CLO(arg, "--drd-stats", DRD_(s_print_stats)) {}
+ else if VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked) {}
+ else if VG_BOOL_CLO(arg, "--segment-merging", segment_merging) {}
+ else if VG_BOOL_CLO(arg, "--show-confl-seg", show_confl_seg) {}
+ else if VG_BOOL_CLO(arg, "--show-stack-usage", DRD_(s_show_stack_usage)) {}
+ else if VG_BOOL_CLO(arg, "--trace-barrier", trace_barrier) {}
+ else if VG_BOOL_CLO(arg, "--trace-clientobj", trace_clientobj) {}
+ else if VG_BOOL_CLO(arg, "--trace-cond", trace_cond) {}
+ else if VG_BOOL_CLO(arg, "--trace-conflict-set", trace_conflict_set) {}
+ else if VG_BOOL_CLO(arg, "--trace-csw", trace_csw) {}
+ else if VG_BOOL_CLO(arg, "--trace-fork-join", trace_fork_join) {}
+ else if VG_BOOL_CLO(arg, "--trace-mutex", trace_mutex) {}
+ else if VG_BOOL_CLO(arg, "--trace-rwlock", trace_rwlock) {}
+ else if VG_BOOL_CLO(arg, "--trace-segment", trace_segment) {}
+ else if VG_BOOL_CLO(arg, "--trace-semaphore", trace_semaphore) {}
+ else if VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression) {}
+ else if VG_BOOL_CLO(arg, "--var-info", DRD_(s_var_info)) {}
+ else if VG_INT_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) {}
+ else if VG_INT_CLO (arg, "--shared-threshold", shared_threshold_ms) {}
+ else if VG_STR_CLO (arg, "--trace-addr", trace_address) {}
else
return VG_(replacement_malloc_process_cmd_line_option)(arg);
Modified: trunk/exp-ptrcheck/pc_common.c
===================================================================
--- trunk/exp-ptrcheck/pc_common.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/exp-ptrcheck/pc_common.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -64,9 +64,9 @@
Bool pc_process_cmd_line_options(Char* arg)
{
- VG_BOOL_CLO(arg, "--partial-loads-ok", h_clo_partial_loads_ok)
- /* else VG_BOOL_CLO(arg, "--lossage-check", h_clo_lossage_check) */
- else VG_BOOL_CLO(arg, "--enable-sg-checks", sg_clo_enable_sg_checks)
+ if VG_BOOL_CLO(arg, "--partial-loads-ok", h_clo_partial_loads_ok) {}
+ /* else if VG_BOOL_CLO(arg, "--lossage-check", h_clo_lossage_check) {} */
+ else if VG_BOOL_CLO(arg, "--enable-sg-checks", sg_clo_enable_sg_checks) {}
else
return VG_(replacement_malloc_process_cmd_line_option)(arg);
Modified: trunk/helgrind/hg_main.c
===================================================================
--- trunk/helgrind/hg_main.c 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/helgrind/hg_main.c 2009-02-25 01:01:05 UTC (rev 9255)
@@ -4009,39 +4009,32 @@
static Bool hg_process_cmd_line_option ( Char* arg )
{
- if (VG_CLO_STREQ(arg, "--track-lockorders=no"))
- HG_(clo_track_lockorders) = False;
- else if (VG_CLO_STREQ(arg, "--track-lockorders=yes"))
- HG_(clo_track_lockorders) = True;
+ Char* tmp_str;
- else if (VG_CLO_STREQ(arg, "--cmp-race-err-addrs=no"))
- HG_(clo_cmp_race_err_addrs) = False;
- else if (VG_CLO_STREQ(arg, "--cmp-race-err-addrs=yes"))
- HG_(clo_cmp_race_err_addrs) = True;
+ if VG_BOOL_CLO(arg, "--track-lockorders",
+ HG_(clo_track_lockorders)) {}
+ else if VG_BOOL_CLO(arg, "--cmp-race-err-addrs",
+ HG_(clo_cmp_race_err_addrs)) {}
+ else if VG_BOOL_CLO(arg, "--show-conflicts",
+ HG_(clo_show_conflicts)) {}
- else if (VG_CLO_STREQ(arg, "--show-conflicts=no"))
- HG_(clo_show_conflicts) = False;
- else if (VG_CLO_STREQ(arg, "--show-conflicts=yes"))
- HG_(clo_show_conflicts) = True;
-
/* If you change the 10k/10mill limits, remember to also change
them in assertions at the top of event_map_maybe_GC. */
- else VG_BNUM_CLO(arg, "--conflict-cache-size",
- HG_(clo_conflict_cache_size), 10*1000, 10*1000*1000)
+ else if VG_BINT_CLO(arg, "--conflict-cache-size",
+ HG_(clo_conflict_cache_size), 10*1000, 10*1000*1000) {}
/* "stuvwx" --> stuvwx (binary) */
- else if (VG_CLO_STREQN(18, arg, "--hg-sanity-flags=")) {
+ else if VG_STR_CLO(arg, "--hg-sanity-flags", tmp_str) {
Int j;
- Char* opt = & arg[18];
- if (6 != VG_(strlen)(opt)) {
+ if (6 != VG_(strlen)(tmp_str)) {
VG_(message)(Vg_UserMsg,
"--hg-sanity-flags argument must have 6 digits");
return False;
}
for (j = 0; j < 6; j++) {
- if ('0' == opt[j]) { /* do nothing */ }
- else if ('1' == opt[j]) HG_(clo_sanity_flags) |= (1 << (6-1-j));
+ if ('0' == tmp_str[j]) { /* do nothing */ }
+ else if ('1' == tmp_str[j]) HG_(clo_sanity_flags) |= (1 << (6-1-j));
else {
VG_(message)(Vg_UserMsg, "--hg-sanity-flags argument can "
"only contain 0s and 1s");
Modified: trunk/include/pub_tool_libcbase.h
===================================================================
--- trunk/include/pub_tool_libcbase.h 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/include/pub_tool_libcbase.h 2009-02-25 01:01:05 UTC (rev 9255)
@@ -51,32 +51,33 @@
// is set to the start of the string. None of them test that the number
// fits into 64 bits.
//
-// Nb: if you're wondering why we don't just have a single VG_(strtol) which
+// Nb: if you're wondering why we don't just have a single VG_(strtoll) which
// takes a base, it's because I wanted it to assert if it was given a bogus
// base (the standard glibc one sets 'errno' in this case). But
// m_libcbase.c doesn't import any code, not even vg_assert. --njn
+//
+// Nb: we also don't provide VG_(atoll*); these functions are worse than
+// useless because they don't do any error checking and so accept malformed
+// numbers and non-numbers -- eg. "123xyz" gives 123, and "foo" gives 0!
+// If you really want that behaviour, you can use "VG_(strtoll10)(str, NULL)".
extern Long VG_(strtoll10) ( Char* str, Char** endptr );
extern Long VG_(strtoll16) ( Char* str, Char** endptr );
- // Convert a string to a double. After leading whitespace is ignored, a
- // '+' or '-' is allowed, and then it accepts a non-empty sequence of
- // decimal digits possibly containing a '.'. Hexadecimal floats are not
- // accepted, nor are "fancy" floats (eg. "3.4e-5", "NAN").
+// Convert a string to a double. After leading whitespace is ignored, a
+// '+' or '-' is allowed, and then it accepts a non-empty sequence of
+// decimal digits possibly containing a '.'. Hexadecimal floats are not
+// accepted, nor are "fancy" floats (eg. "3.4e-5", "NAN").
extern double VG_(strtod) ( Char* str, Char** endptr );
- // These are just like their VG_(strtoll*) counterparts, except that you
- // cannot tell if an error occurred (because 0 is returned) or if there
- // is any trailing non-numeric characterws (eg. in "123xyz").
-extern Long VG_(atoll) ( Char* str ); // base 10
-extern Long VG_(atoll16) ( Char* str ); // base 16; leading 0x accepted
-
/* ---------------------------------------------------------------------
String functions and macros
------------------------------------------------------------------ */
-/* Use this for normal null-termination-style string comparison */
+/* Use this for normal null-termination-style string comparison. */
#define VG_STREQ(s1,s2) ( (s1 != NULL && s2 != NULL \
&& VG_(strcmp)((s1),(s2))==0) ? True : False )
+#define VG_STREQN(n,s1,s2) ( (s1 != NULL && s2 != NULL \
+ && VG_(strncmp)((s1),(s2),(n))==0) ? True : False )
extern SizeT VG_(strlen) ( const Char* str );
extern Char* VG_(strcat) ( Char* dest, const Char* src );
Modified: trunk/include/pub_tool_options.h
===================================================================
--- trunk/include/pub_tool_options.h 2009-02-24 23:59:52 UTC (rev 9254)
+++ trunk/include/pub_tool_options.h 2009-02-25 01:01:05 UTC (rev 9255)
@@ -34,71 +34,110 @@
#include "libvex.h" // for VexControl
-/* Use these for recognising tool command line options -- stops comparing
- once whitespace is reached. */
-#define VG_CLO_STREQ(s1,s2) (0==VG_(strcmp_ws)((s1),(s2)))
-#define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
+// Higher-level command-line option recognisers; use in if/else chains.
+// Note that they assign a value to the 'qq_var' argument. So often they
+// can be used like this:
+//
+// if VG_STR_CLO(arg, "--foo", clo_foo) { }
+//
+// But if you want to do further checking or processing, you can do this:
+//
+// if VG_STR_CLO(arg, "--foo", clo_foo) { <further checking or processing> }
+//
+// They use GNU statement expressions to do the qq_var assignment within a
+// conditional expression.
-/* Higher-level command-line option recognisers; use in if/else chains */
-
+// String argument, eg. --foo=yes or --foo=no
#define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQ(qq_arg, qq_option"=yes")) { (qq_var) = True; } \
- else if (VG_CLO_STREQ(qq_arg, qq_option"=no")) { (qq_var) = False; }
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
+ if VG_STREQ(val, "yes") (qq_var) = True; \
+ else if VG_STREQ(val, "no") (qq_var) = False; \
+ True; \
+ }) \
+ )
+// String argument, eg. --foo=bar
#define VG_STR_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
- (qq_var) = &qq_arg[ VG_(strlen)(qq_option)+1 ]; \
- }
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
+ (qq_var) = val; \
+ True; \
+ }) \
+ )
-/* Unbounded integer arg */
-#define VG_NUM_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+// Unbounded integer arg, eg. --foo=10
+#define VG_INT_CLO(qq_arg, qq_option, qq_var) \
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
Char* s; \
- Long n = VG_(strtoll10)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+ Long n = VG_(strtoll10)( val, &s ); \
(qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
+ /* Check for non-numeralness, or overflow. */ \
if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- }
+ True; \
+ }) \
+ )
-/* Bounded integer arg */
-#define VG_BNUM_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+// Bounded integer arg, eg. --foo=10 ; if the value exceeds the bounds it
+// causes an abort. 'qq_base' can be 10 or 16.
+#define VG_BINTN_CLO(qq_base, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
Char* s; \
- Long n = VG_(strtoll10)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+ Long n = VG_(strtoll##qq_base)( val, &s ); \
(qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
+ /* Check for non-numeralness, or overflow. */ \
+ /* Nb: it will overflow if qq_var is unsigned and qq_val is negative! */ \
if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
- if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
- }
+ /* Check bounds. */ \
+ if ((qq_var) < (qq_lo) || (qq_var) > (qq_hi)) { \
+ VG_(message)(Vg_UserMsg, \
+ "'%s' argument must be between %lld and %lld", \
+ (qq_option), (Long)(qq_lo), (Long)(qq_hi)); \
+ VG_(err_bad_option)(qq_arg); \
+ } \
+ True; \
+ }) \
+ )
-/* Bounded hexadecimal arg */
+// Bounded decimal integer arg, eg. --foo=100
+#define VG_BINT_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+ VG_BINTN_CLO(10, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
+
+// Bounded hexadecimal integer arg, eg. --foo=0x1fa8
#define VG_BHEX_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
- Char* s; \
- Long n = VG_(strtoll16)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
- (qq_var) = n; \
- /* Check for non-numeralness, or overflow */ \
- if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
- if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
- if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
- }
+ VG_BINTN_CLO(16, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
-/* Double arg */
+// Double (decimal) arg, eg. --foo=4.6
+// XXX: there's not VG_BDBL_CLO because we don't have a good way of printing
+// floats at the moment!
#define VG_DBL_CLO(qq_arg, qq_option, qq_var) \
- if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \
+ ({ \
+ Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
Char* s; \
- double n = VG_(strtod)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+ double n = VG_(strtod)( val, &s ); \
(qq_var) = n; \
/* Check for non-numeralness */ \
if ('\0' != s[0]) VG_(err_bad_option)(qq_arg); \
- }
+ True; \
+ }) \
+ )
-/* Bool arg whose value is denoted by the exact presence of the given string. */
-#define VG_XACT_CL...
[truncated message content] |
|
From: <sv...@va...> - 2009-02-24 23:59:59
|
Author: njn
Date: 2009-02-24 23:59:52 +0000 (Tue, 24 Feb 2009)
New Revision: 9254
Log:
Merged 9251 (remove unused params from Callgrind) from the trunk.
Modified:
branches/DARWIN/callgrind/bbcc.c
branches/DARWIN/callgrind/callstack.c
branches/DARWIN/callgrind/debug.c
branches/DARWIN/callgrind/dump.c
branches/DARWIN/callgrind/global.h
branches/DARWIN/callgrind/main.c
branches/DARWIN/callgrind/sim.c
branches/DARWIN/callgrind/threads.c
Modified: branches/DARWIN/callgrind/bbcc.c
===================================================================
--- branches/DARWIN/callgrind/bbcc.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/bbcc.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -183,7 +183,7 @@
bbcc, bbcc ? bbcc->tid : 0);
CLG_DEBUGIF(2)
- if (bbcc) CLG_(print_bbcc)(-2,bbcc,False);
+ if (bbcc) CLG_(print_bbcc)(-2,bbcc);
return bbcc;
}
@@ -411,7 +411,7 @@
CLG_DEBUGIF(3)
- CLG_(print_bbcc)(-2, new, False);
+ CLG_(print_bbcc)(-2, new);
CLG_DEBUG(2,"- clone_BBCC(%p, %d) for BB %#lx\n"
" orig %s\n"
@@ -453,7 +453,7 @@
bb->last_bbcc = bbcc;
CLG_DEBUGIF(3)
- CLG_(print_bbcc)(-2, bbcc, False);
+ CLG_(print_bbcc)(-2, bbcc);
}
CLG_DEBUG(3, "- get_bbcc(BB %#lx): BBCC %p\n",
Modified: branches/DARWIN/callgrind/callstack.c
===================================================================
--- branches/DARWIN/callgrind/callstack.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/callstack.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -114,7 +114,7 @@
/* Called when function entered nonrecursive */
-static void function_entered(fn_node* fn, BBCC* to)
+static void function_entered(fn_node* fn)
{
CLG_ASSERT(fn != 0);
@@ -147,7 +147,7 @@
}
/* Called when function left (no recursive level active) */
-static void function_left(fn_node* fn, BBCC* from)
+static void function_left(fn_node* fn)
{
CLG_ASSERT(fn != 0);
@@ -230,7 +230,7 @@
jcc->call_counter++;
CLG_(stat).call_counter++;
- if (*pdepth == 1) function_entered(to_fn, to);
+ if (*pdepth == 1) function_entered(to_fn);
}
/* return address is only is useful with a real call;
@@ -354,7 +354,7 @@
CLG_(current_fn_stack).bottom + lower_entry->fn_sp;
CLG_ASSERT(CLG_(current_state).cxt != 0);
- if (depth == 0) function_left(to_fn, jcc->from);
+ if (depth == 0) function_left(to_fn);
}
/* To allow for an assertion in push_call_stack() */
Modified: branches/DARWIN/callgrind/debug.c
===================================================================
--- branches/DARWIN/callgrind/debug.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/debug.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -112,7 +112,7 @@
}
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool jumpaddr)
+void CLG_(print_bbcc)(int s, BBCC* bbcc)
{
BB* bb;
@@ -129,16 +129,9 @@
bb = bbcc->bb;
CLG_ASSERT(bb!=0);
-#if 0
- if (jumpaddr)
- VG_(printf)("%s +%p=%p, ",
+ VG_(printf)("%s +%#lx=%#lx, ",
bb->obj->name + bb->obj->last_slash_pos,
- bb->jmp_offset, bb_jmpaddr(bb));
- else
-#endif
- VG_(printf)("%s +%#lx=%#lx, ",
- bb->obj->name + bb->obj->last_slash_pos,
- bb->offset, bb_addr(bb));
+ bb->offset, bb_addr(bb));
CLG_(print_cxt)(s+8, bbcc->cxt, bbcc->rec_index);
}
@@ -243,10 +236,10 @@
return;
}
VG_(printf)("JCC %p from ", jcc);
- CLG_(print_bbcc)(s+9, jcc->from, True);
+ CLG_(print_bbcc)(s+9, jcc->from);
print_indent(s+4);
VG_(printf)("to ");
- CLG_(print_bbcc)(s+9, jcc->to, False);
+ CLG_(print_bbcc)(s+9, jcc->to);
print_indent(s+4);
VG_(printf)("Calls %llu\n", jcc->call_counter);
print_indent(s+4);
@@ -334,7 +327,7 @@
bb = bbcc->bb;
CLG_ASSERT(bb!=0);
- CLG_(print_bbcc)(s, bbcc, False);
+ CLG_(print_bbcc)(s, bbcc);
ecounter = bbcc->ecounter_sum;
@@ -440,7 +433,7 @@
void CLG_(print_bbno)(void) {}
void CLG_(print_context)(void) {}
void CLG_(print_jcc)(int s, jCC* jcc) {}
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool b) {}
+void CLG_(print_bbcc)(int s, BBCC* bbcc) {}
void CLG_(print_bbcc_fn)(BBCC* bbcc) {}
void CLG_(print_cost)(int s, EventSet* es, ULong* cost) {}
void CLG_(print_bb)(int s, BB* bb) {}
Modified: branches/DARWIN/callgrind/dump.c
===================================================================
--- branches/DARWIN/callgrind/dump.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/dump.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -787,7 +787,7 @@
CLG_ASSERT(bbcc->cxt != 0);
CLG_DEBUGIF(1) {
VG_(printf)("+ fprint_bbcc (Instr %d): ", bb->instr_count);
- CLG_(print_bbcc)(15, bbcc, False);
+ CLG_(print_bbcc)(15, bbcc);
}
CLG_ASSERT(currSum == 0 || currSum == 1);
@@ -1473,7 +1473,7 @@
}
-static void close_dumpfile(Char buf[BUF_LEN], int fd, int tid)
+static void close_dumpfile(int fd)
{
if (fd <0) return;
@@ -1575,7 +1575,7 @@
p++;
}
- close_dumpfile(print_buf, print_fd, CLG_(current_tid));
+ close_dumpfile(print_fd);
if (array) VG_(free)(array);
/* set counters of last dump */
Modified: branches/DARWIN/callgrind/global.h
===================================================================
--- branches/DARWIN/callgrind/global.h 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/global.h 2009-02-24 23:59:52 UTC (rev 9254)
@@ -855,7 +855,7 @@
void CLG_(print_bbno)(void);
void CLG_(print_context)(void);
void CLG_(print_jcc)(int s, jCC* jcc);
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool);
+void CLG_(print_bbcc)(int s, BBCC* bbcc);
void CLG_(print_bbcc_fn)(BBCC* bbcc);
void CLG_(print_execstate)(int s, exec_state* es);
void CLG_(print_eventset)(int s, EventSet* es);
Modified: branches/DARWIN/callgrind/main.c
===================================================================
--- branches/DARWIN/callgrind/main.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/main.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -389,10 +389,10 @@
}
static
-void collectStatementInfo(IRTypeEnv* tyenv, IRSB* bbOut, IRStmt* st,
+void collectStatementInfo(IRTypeEnv* tyenv, IRStmt* st,
Addr* instrAddr, UInt* instrLen,
IRExpr** loadAddrExpr, IRExpr** storeAddrExpr,
- UInt* dataSize, IRType hWordTy)
+ UInt* dataSize)
{
CLG_ASSERT(isFlatIRStmt(st));
@@ -602,8 +602,8 @@
i++;
stnext = ( i < bbIn->stmts_used ? bbIn->stmts[i] : NULL );
beforeIBoundary = !stnext || (Ist_IMark == stnext->tag);
- collectStatementInfo(bbIn->tyenv, bbOut, st, &instrAddr, &instrLen,
- &loadAddrExpr, &storeAddrExpr, &dataSize, hWordTy);
+ collectStatementInfo(bbIn->tyenv, st, &instrAddr, &instrLen,
+ &loadAddrExpr, &storeAddrExpr, &dataSize);
// instrument a simulator call before conditional jumps
if (st->tag == Ist_Exit) {
Modified: branches/DARWIN/callgrind/sim.c
===================================================================
--- branches/DARWIN/callgrind/sim.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/sim.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -491,7 +491,7 @@
* One stream can be detected per 4k page.
*/
static __inline__
-void prefetch_L2_doref(Addr a, UChar size)
+void prefetch_L2_doref(Addr a)
{
UInt stream = (a >> PF_PAGEBITS) % PF_STREAMS;
UInt block = ( a >> L2.line_size_bits);
@@ -531,7 +531,7 @@
CacheModelResult prefetch_I1_ref(Addr a, UChar size)
{
if ( cachesim_ref( &I1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &L2, a, size) == Hit ) return L2_Hit;
return MemAccess;
}
@@ -540,7 +540,7 @@
CacheModelResult prefetch_D1_ref(Addr a, UChar size)
{
if ( cachesim_ref( &D1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &L2, a, size) == Hit ) return L2_Hit;
return MemAccess;
}
@@ -552,7 +552,7 @@
CacheModelResult prefetch_I1_Read(Addr a, UChar size)
{
if ( cachesim_ref( &I1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
switch( cachesim_ref_wb( &L2, Read, a, size) ) {
case Hit: return L2_Hit;
case Miss: return MemAccess;
@@ -565,7 +565,7 @@
CacheModelResult prefetch_D1_Read(Addr a, UChar size)
{
if ( cachesim_ref( &D1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
switch( cachesim_ref_wb( &L2, Read, a, size) ) {
case Hit: return L2_Hit;
case Miss: return MemAccess;
@@ -577,7 +577,7 @@
static
CacheModelResult prefetch_D1_Write(Addr a, UChar size)
{
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &D1, a, size) == Hit ) {
/* Even for a L1 hit, the write-trough L1 passes
* the write to the L2 to make the L2 line dirty.
Modified: branches/DARWIN/callgrind/threads.c
===================================================================
--- branches/DARWIN/callgrind/threads.c 2009-02-24 16:31:25 UTC (rev 9253)
+++ branches/DARWIN/callgrind/threads.c 2009-02-24 23:59:52 UTC (rev 9254)
@@ -422,7 +422,7 @@
CLG_DEBUGIF(1) {
CLG_DEBUG(1, " cxtinfo_save(sig %d): collect %s, jmps_passed %d\n",
es->sig, es->collect ? "Yes": "No", es->jmps_passed);
- CLG_(print_bbcc)(-9, es->bbcc, False);
+ CLG_(print_bbcc)(-9, es->bbcc);
CLG_(print_cost)(-9, CLG_(sets).full, es->cost);
}
@@ -448,7 +448,7 @@
CLG_DEBUGIF(1) {
CLG_DEBUG(1, " exec_state_restore(sig %d): collect %s, jmps_passed %d\n",
es->sig, es->collect ? "Yes": "No", es->jmps_passed);
- CLG_(print_bbcc)(-9, es->bbcc, False);
+ CLG_(print_bbcc)(-9, es->bbcc);
CLG_(print_cxt)(-9, es->cxt, 0);
CLG_(print_cost)(-9, CLG_(sets).full, es->cost);
}
|
|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 23:29:24
|
On Tue, Feb 10, 2009 at 12:51 AM, Konstantin Serebryany <kon...@gm...> wrote: > > First: I've hit a performance issue in VG_(maybe_record_error). > I was running a test that uses openssl library. > This library has a hand-written assembly file which is not friendly to > valgrind (valgrind produces broken stack traces, see the recent > discussion at http://sourceforge.net/mailarchive/forum.php?thread_name=59e975c10902052331r2bf43900qec86f336cba6e531%40mail.gmail.com&forum_name=valgrind-developers). > This assembly file results in memcheck warnings, like this: > ==27019== Use of uninitialised value of size 8 > ==27019== at 0xBD3214F: bn_mul_mont > ==27019== by 0x7A2C730C750BD1E8: ??? > ==27019== by 0xD075D9E9E5D0101: ??? > ==27019== by 0x4EAF8BD8815341D7: ??? > Since the stack traces are broken, each warning found by memcheck is distinct. > Memcheck boils out after 1000-th report. > > So, I needed to suppress these reports. > { > fun:bn_mul_mont > Memcheck:Value8 > fun:bn_mul_mont > } > > As the result, memcheck is slowed down by >100x (from 1 minute to few hours). > Since all the errors found by memcheck are different, > VG_(maybe_record_error) tries to add each of them to the list > static Error* errors = NULL; > Since all these errors are suppressed, memcheck does not boil out > after 1000-th and goes quadratic. > > The simple fix which seems to work for me is to check > is_suppressible_error before checking the 'errors' list. > [...] > Is there any hidden reason not to do that? Not that I'm aware of. I'll take a look at it some time. > Second: > Right now I often have to write two almost identical suppression > rules, like this: > > { > fun:bn_mul_mont > Memcheck:Value8 <<<<<<<<<<<<<<<< > fun:bn_mul_mont > } > { > fun:bn_mul_mont > Memcheck:Cond <<<<<<<<<<<<<< > fun:bn_mul_mont > } > > Is there any way to tell something like Memcheck:* or Memcheck:All? > { > fun:bn_mul_mont > Memcheck:All <<<<<<<<<<<<<< > fun:bn_mul_mont > } > If no, would you consider a patch that does it? There is no way to do that. AFAIK you're the first person who's asked for it, so it doesn't seem like a high priority... > Third: > In case when a user needs to suppress warnings from a library he > doesn't care about, the better solution for memcheck would be simply > not to generate such warnings. > ThreadSanitizer does this by not instrumenting functions listed in a > text file (http://code.google.com/p/data-race-test/wiki/ThreadSanitizerIgnores). > Would you consider adding something like this to the valgrind core? That's only useful for suppressions where you only care about the first stack entry... that's only a small fraction of suppressions. Nick |
|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 23:24:33
|
On Tue, Feb 24, 2009 at 11:26 PM, Josef Weidendorfer <Jos...@gm...> wrote: > On Tuesday 24 February 2009, Nicholas Nethercote wrote: >> As a follow-up to the recent thread about -Wextra, I went through all >> the warnings found by -Wunused-parameters > > Hmm. There seems to be a bug in the gcc here about warnings: 4.3.2 (OpenSuse 11.1) > gives all those warnings about mismatched signedness even with "-Wunused-parameter" > only; I get flooded with > > main.c:109: warning: pointer targets in passing argument 2 of ‘vgPlain_assert_fail’ differ in signedness > main.c:109: warning: pointer targets in passing argument 3 of ‘vgPlain_assert_fail’ differ in signedness > main.c:109: warning: pointer targets in passing argument 5 of ‘vgPlain_assert_fail’ differ in signedness > ... I actually got the unused parameter warnings by running -Wextra and then grepping for "unused param"... Nick |
|
From: Stefan K. <en...@ho...> - 2009-02-24 19:23:24
|
Bart Van Assche schrieb: > On Mon, Feb 23, 2009 at 5:43 AM, Nicholas Nethercote > <n.n...@gm...> wrote: >> Pretty much every file in Valgrind gets $(WERROR) as part of the >> compile flags. But I can't work out what it's for -- that string >> isn't present in the info pages for automake, autoconf or make, nor is >> it defined in configure.in or any of our generated Makefiles. AFAICT >> it's always empty (at least, on Linux and Darwin where I've checked). >> >> So I'd like to get rid of it, unless someone can identify what it's for. > > My guess is that this flag can be used as follows (I don't use this flag): > > make WERROR=-Werror > > Bart. > but then you can anyway do make CFLAGS=-Werror :) Stefan |
|
From: <sv...@va...> - 2009-02-24 16:31:31
|
Author: sewardj Date: 2009-02-24 16:31:25 +0000 (Tue, 24 Feb 2009) New Revision: 9253 Log: --> 3.4.1.RC1 Modified: branches/VALGRIND_3_4_BRANCH/NEWS branches/VALGRIND_3_4_BRANCH/configure.in Modified: branches/VALGRIND_3_4_BRANCH/NEWS =================================================================== --- branches/VALGRIND_3_4_BRANCH/NEWS 2009-02-24 14:42:57 UTC (rev 9252) +++ branches/VALGRIND_3_4_BRANCH/NEWS 2009-02-24 16:31:25 UTC (rev 9253) @@ -1,4 +1,43 @@ +Release 3.4.1 (XX February 2009) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +3.4.1 is a bug-fix release that fixes some regressions and assertion +failures in debug info reading in 3.4.0, most notably incorrect stack +traces on amd64-linux on older (glibc-2.3 based) systems. Various +other debug info problems are also fixed. A number of bugs in the +exp-ptrcheck tool introduced in 3.4.0 have been fixed. + +In view of the fact that 3.4.0 contains some user-visible regressions +relative to 3.3.x, upgrading to 3.4.1 is recommended. Packagers are +encouraged to ship 3.4.1 in preference to 3.4.0. + +The fixed bugs are as follows. Note that "n-i-bz" stands for "not in +bugzilla" -- that is, a bug that was reported to us but never got a +bugzilla entry. We encourage you to file bugs in bugzilla +(http://bugs.kde.org/enter_valgrind_bug.cgi) rather than mailing the +developers (or mailing lists) directly -- bugs that are not entered +into bugzilla tend to get forgotten about or ignored. + +n-i-bz Fix various bugs reading icc-11 generated debug info +n-i-bz Fix various bugs reading gcc-4.4 generated debug info +n-i-bz Preliminary support for glibc-2.10 / Fedora 11 +179618 exp-ptrcheck crashed / exit prematurely +179624 helgrind: false positive races with pthread_create and + recv/open/close/read +134207 pkg-config output contains @VG_PLATFORM@ +176926 floating point exception at valgrind startup with PPC 440EPX +181594 Bogus warning for empty text segment +173751 amd64->IR: 0x48 0xF 0x6F 0x45 (even more redundant rex prefixes) +181707 Dwarf3 doesn't require enumerations to have name +185038 exp-ptrcheck: "unhandled syscall: 285" (fallocate) on x86_64 +185050 exp-ptrcheck: sg_main.c:727 (add_block_to_GlobalTree): + Assertion '!already_present' failed. +185359 exp-ptrcheck unhandled syscall getresuid() + +(3.4.1.RC1: 24 Feb 2008, vex r1884, valgrind r9253). + + + Release 3.4.0 (2 January 2009) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3.4.0 is a feature release with many significant improvements and the Modified: branches/VALGRIND_3_4_BRANCH/configure.in =================================================================== --- branches/VALGRIND_3_4_BRANCH/configure.in 2009-02-24 14:42:57 UTC (rev 9252) +++ branches/VALGRIND_3_4_BRANCH/configure.in 2009-02-24 16:31:25 UTC (rev 9253) @@ -8,7 +8,7 @@ ##------------------------------------------------------------## # Process this file with autoconf to produce a configure script. -AC_INIT(Valgrind, 3.4.1.SVN, val...@li...) +AC_INIT(Valgrind, 3.4.1.RC1, val...@li...) AC_CONFIG_SRCDIR(coregrind/m_main.c) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE([foreign]) |
|
From: <sv...@va...> - 2009-02-24 14:43:07
|
Author: sewardj
Date: 2009-02-24 14:42:57 +0000 (Tue, 24 Feb 2009)
New Revision: 9252
Log:
Fix undefined references in valgrind.pc.in (Ingmar Vanhassel).
Fixes #134207.
Modified:
branches/VALGRIND_3_4_BRANCH/valgrind.pc.in
Modified: branches/VALGRIND_3_4_BRANCH/valgrind.pc.in
===================================================================
--- branches/VALGRIND_3_4_BRANCH/valgrind.pc.in 2009-02-24 12:26:53 UTC (rev 9251)
+++ branches/VALGRIND_3_4_BRANCH/valgrind.pc.in 2009-02-24 14:42:57 UTC (rev 9252)
@@ -2,7 +2,7 @@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/valgrind
-arch=@VG_ARCH@
+arch=@VG_ARCH_MAX@
os=@VG_OS@
platform=@VG_PLATFORM_PRI@
valt_load_address=@VALT_LOAD_ADDRESS@
@@ -11,6 +11,6 @@
Description: A dynamic binary instrumentation framework
Version: @VERSION@
Requires:
-Libs: -L${libdir}/valgrind/@VG_PLATFORM_PRI@ -lcoregrind -lvex -lgcc
+Libs: -L${libdir}/valgrind/@VG_ARCH_MAX@-@VG_OS@ -lcoregrind -lvex -lgcc
Cflags: -I${includedir}
|
|
From: Tom H. <to...@co...> - 2009-02-24 12:57:20
|
Josef Weidendorfer wrote: > On Tuesday 24 February 2009, Nicholas Nethercote wrote: >> As a follow-up to the recent thread about -Wextra, I went through all >> the warnings found by -Wunused-parameters > > Hmm. There seems to be a bug in the gcc here about warnings: 4.3.2 (OpenSuse 11.1) > gives all those warnings about mismatched signedness even with "-Wunused-parameter" > only; I get flooded with > > main.c:109: warning: pointer targets in passing argument 2 of ‘vgPlain_assert_fail’ differ in signedness > main.c:109: warning: pointer targets in passing argument 3 of ‘vgPlain_assert_fail’ differ in signedness > main.c:109: warning: pointer targets in passing argument 5 of ‘vgPlain_assert_fail’ differ in signedness > ... That's different - that is -Wpointer-sign which is a new warning in recent versions of gcc that is turned on by -Wall. It's not the same as the warnings about signed/unsigned comparisons and the like. Tom -- Tom Hughes (to...@co...) http://www.compton.nu/ |
|
From: Josef W. <Jos...@gm...> - 2009-02-24 12:27:30
|
On Tuesday 24 February 2009, Nicholas Nethercote wrote: > As a follow-up to the recent thread about -Wextra, I went through all > the warnings found by -Wunused-parameters Hmm. There seems to be a bug in the gcc here about warnings: 4.3.2 (OpenSuse 11.1) gives all those warnings about mismatched signedness even with "-Wunused-parameter" only; I get flooded with main.c:109: warning: pointer targets in passing argument 2 of ‘vgPlain_assert_fail’ differ in signedness main.c:109: warning: pointer targets in passing argument 3 of ‘vgPlain_assert_fail’ differ in signedness main.c:109: warning: pointer targets in passing argument 5 of ‘vgPlain_assert_fail’ differ in signedness ... > (one of the flags enabled by > -Wextra). I removed some of the ones found in r9248. The summary is > below. There were a number of strange things that some warnings > highlighted, which I've listed under "removable, probably should be, > or complicated". > > As for whether this warning should be enabled permanently: most of > things it finds aren't important, but there are a couple of oddities > that seem worth investigating. There are also lots of cases where > unused params are unavoidable, but they're also easy to workaround > with __attribute__((unused)) which could be #defined to VG_UNUSED or > similar. Thoughts? Qt just uses the macro #define Q_UNUSED(x) (void)x; to avoid this warning in some circumstances. It's simpler than the attribute. And yes, there are a lot of cases where unused params are unavoidable, so I vote for VG_UNUSED(x). > // Should probably be removed by Josef. > debug.c:115: warning: unused parameter 'jumpaddr' > sim.c:494: warning: unused parameter 'size' > callstack.c:117: warning: unused parameter 'to' > callstack.c:150: warning: unused parameter 'from' > dump.c:1476: warning: unused parameter 'buf' > dump.c:1476: warning: unused parameter 'tid' All could be removed. Thanks, Josef |
|
From: <sv...@va...> - 2009-02-24 12:26:58
|
Author: weidendo
Date: 2009-02-24 12:26:53 +0000 (Tue, 24 Feb 2009)
New Revision: 9251
Log:
Callgrind: fix a few 'unused parameter' warnings
Modified:
trunk/callgrind/bbcc.c
trunk/callgrind/callstack.c
trunk/callgrind/debug.c
trunk/callgrind/dump.c
trunk/callgrind/global.h
trunk/callgrind/main.c
trunk/callgrind/sim.c
trunk/callgrind/threads.c
Modified: trunk/callgrind/bbcc.c
===================================================================
--- trunk/callgrind/bbcc.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/bbcc.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -183,7 +183,7 @@
bbcc, bbcc ? bbcc->tid : 0);
CLG_DEBUGIF(2)
- if (bbcc) CLG_(print_bbcc)(-2,bbcc,False);
+ if (bbcc) CLG_(print_bbcc)(-2,bbcc);
return bbcc;
}
@@ -411,7 +411,7 @@
CLG_DEBUGIF(3)
- CLG_(print_bbcc)(-2, new, False);
+ CLG_(print_bbcc)(-2, new);
CLG_DEBUG(2,"- clone_BBCC(%p, %d) for BB %#lx\n"
" orig %s\n"
@@ -453,7 +453,7 @@
bb->last_bbcc = bbcc;
CLG_DEBUGIF(3)
- CLG_(print_bbcc)(-2, bbcc, False);
+ CLG_(print_bbcc)(-2, bbcc);
}
CLG_DEBUG(3, "- get_bbcc(BB %#lx): BBCC %p\n",
Modified: trunk/callgrind/callstack.c
===================================================================
--- trunk/callgrind/callstack.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/callstack.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -114,7 +114,7 @@
/* Called when function entered nonrecursive */
-static void function_entered(fn_node* fn, BBCC* to)
+static void function_entered(fn_node* fn)
{
CLG_ASSERT(fn != 0);
@@ -147,7 +147,7 @@
}
/* Called when function left (no recursive level active) */
-static void function_left(fn_node* fn, BBCC* from)
+static void function_left(fn_node* fn)
{
CLG_ASSERT(fn != 0);
@@ -230,7 +230,7 @@
jcc->call_counter++;
CLG_(stat).call_counter++;
- if (*pdepth == 1) function_entered(to_fn, to);
+ if (*pdepth == 1) function_entered(to_fn);
}
/* return address is only is useful with a real call;
@@ -354,7 +354,7 @@
CLG_(current_fn_stack).bottom + lower_entry->fn_sp;
CLG_ASSERT(CLG_(current_state).cxt != 0);
- if (depth == 0) function_left(to_fn, jcc->from);
+ if (depth == 0) function_left(to_fn);
}
/* To allow for an assertion in push_call_stack() */
Modified: trunk/callgrind/debug.c
===================================================================
--- trunk/callgrind/debug.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/debug.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -112,7 +112,7 @@
}
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool jumpaddr)
+void CLG_(print_bbcc)(int s, BBCC* bbcc)
{
BB* bb;
@@ -129,16 +129,9 @@
bb = bbcc->bb;
CLG_ASSERT(bb!=0);
-#if 0
- if (jumpaddr)
- VG_(printf)("%s +%p=%p, ",
+ VG_(printf)("%s +%#lx=%#lx, ",
bb->obj->name + bb->obj->last_slash_pos,
- bb->jmp_offset, bb_jmpaddr(bb));
- else
-#endif
- VG_(printf)("%s +%#lx=%#lx, ",
- bb->obj->name + bb->obj->last_slash_pos,
- bb->offset, bb_addr(bb));
+ bb->offset, bb_addr(bb));
CLG_(print_cxt)(s+8, bbcc->cxt, bbcc->rec_index);
}
@@ -243,10 +236,10 @@
return;
}
VG_(printf)("JCC %p from ", jcc);
- CLG_(print_bbcc)(s+9, jcc->from, True);
+ CLG_(print_bbcc)(s+9, jcc->from);
print_indent(s+4);
VG_(printf)("to ");
- CLG_(print_bbcc)(s+9, jcc->to, False);
+ CLG_(print_bbcc)(s+9, jcc->to);
print_indent(s+4);
VG_(printf)("Calls %llu\n", jcc->call_counter);
print_indent(s+4);
@@ -334,7 +327,7 @@
bb = bbcc->bb;
CLG_ASSERT(bb!=0);
- CLG_(print_bbcc)(s, bbcc, False);
+ CLG_(print_bbcc)(s, bbcc);
ecounter = bbcc->ecounter_sum;
@@ -440,7 +433,7 @@
void CLG_(print_bbno)(void) {}
void CLG_(print_context)(void) {}
void CLG_(print_jcc)(int s, jCC* jcc) {}
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool b) {}
+void CLG_(print_bbcc)(int s, BBCC* bbcc) {}
void CLG_(print_bbcc_fn)(BBCC* bbcc) {}
void CLG_(print_cost)(int s, EventSet* es, ULong* cost) {}
void CLG_(print_bb)(int s, BB* bb) {}
Modified: trunk/callgrind/dump.c
===================================================================
--- trunk/callgrind/dump.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/dump.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -787,7 +787,7 @@
CLG_ASSERT(bbcc->cxt != 0);
CLG_DEBUGIF(1) {
VG_(printf)("+ fprint_bbcc (Instr %d): ", bb->instr_count);
- CLG_(print_bbcc)(15, bbcc, False);
+ CLG_(print_bbcc)(15, bbcc);
}
CLG_ASSERT(currSum == 0 || currSum == 1);
@@ -1473,7 +1473,7 @@
}
-static void close_dumpfile(Char buf[BUF_LEN], int fd, int tid)
+static void close_dumpfile(int fd)
{
if (fd <0) return;
@@ -1575,7 +1575,7 @@
p++;
}
- close_dumpfile(print_buf, print_fd, CLG_(current_tid));
+ close_dumpfile(print_fd);
if (array) VG_(free)(array);
/* set counters of last dump */
Modified: trunk/callgrind/global.h
===================================================================
--- trunk/callgrind/global.h 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/global.h 2009-02-24 12:26:53 UTC (rev 9251)
@@ -855,7 +855,7 @@
void CLG_(print_bbno)(void);
void CLG_(print_context)(void);
void CLG_(print_jcc)(int s, jCC* jcc);
-void CLG_(print_bbcc)(int s, BBCC* bbcc, Bool);
+void CLG_(print_bbcc)(int s, BBCC* bbcc);
void CLG_(print_bbcc_fn)(BBCC* bbcc);
void CLG_(print_execstate)(int s, exec_state* es);
void CLG_(print_eventset)(int s, EventSet* es);
Modified: trunk/callgrind/main.c
===================================================================
--- trunk/callgrind/main.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/main.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -389,10 +389,10 @@
}
static
-void collectStatementInfo(IRTypeEnv* tyenv, IRSB* bbOut, IRStmt* st,
+void collectStatementInfo(IRTypeEnv* tyenv, IRStmt* st,
Addr* instrAddr, UInt* instrLen,
IRExpr** loadAddrExpr, IRExpr** storeAddrExpr,
- UInt* dataSize, IRType hWordTy)
+ UInt* dataSize)
{
CLG_ASSERT(isFlatIRStmt(st));
@@ -602,8 +602,8 @@
i++;
stnext = ( i < bbIn->stmts_used ? bbIn->stmts[i] : NULL );
beforeIBoundary = !stnext || (Ist_IMark == stnext->tag);
- collectStatementInfo(bbIn->tyenv, bbOut, st, &instrAddr, &instrLen,
- &loadAddrExpr, &storeAddrExpr, &dataSize, hWordTy);
+ collectStatementInfo(bbIn->tyenv, st, &instrAddr, &instrLen,
+ &loadAddrExpr, &storeAddrExpr, &dataSize);
// instrument a simulator call before conditional jumps
if (st->tag == Ist_Exit) {
Modified: trunk/callgrind/sim.c
===================================================================
--- trunk/callgrind/sim.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/sim.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -491,7 +491,7 @@
* One stream can be detected per 4k page.
*/
static __inline__
-void prefetch_L2_doref(Addr a, UChar size)
+void prefetch_L2_doref(Addr a)
{
UInt stream = (a >> PF_PAGEBITS) % PF_STREAMS;
UInt block = ( a >> L2.line_size_bits);
@@ -531,7 +531,7 @@
CacheModelResult prefetch_I1_ref(Addr a, UChar size)
{
if ( cachesim_ref( &I1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &L2, a, size) == Hit ) return L2_Hit;
return MemAccess;
}
@@ -540,7 +540,7 @@
CacheModelResult prefetch_D1_ref(Addr a, UChar size)
{
if ( cachesim_ref( &D1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &L2, a, size) == Hit ) return L2_Hit;
return MemAccess;
}
@@ -552,7 +552,7 @@
CacheModelResult prefetch_I1_Read(Addr a, UChar size)
{
if ( cachesim_ref( &I1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
switch( cachesim_ref_wb( &L2, Read, a, size) ) {
case Hit: return L2_Hit;
case Miss: return MemAccess;
@@ -565,7 +565,7 @@
CacheModelResult prefetch_D1_Read(Addr a, UChar size)
{
if ( cachesim_ref( &D1, a, size) == Hit ) return L1_Hit;
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
switch( cachesim_ref_wb( &L2, Read, a, size) ) {
case Hit: return L2_Hit;
case Miss: return MemAccess;
@@ -577,7 +577,7 @@
static
CacheModelResult prefetch_D1_Write(Addr a, UChar size)
{
- prefetch_L2_doref(a,size);
+ prefetch_L2_doref(a);
if ( cachesim_ref( &D1, a, size) == Hit ) {
/* Even for a L1 hit, the write-trough L1 passes
* the write to the L2 to make the L2 line dirty.
Modified: trunk/callgrind/threads.c
===================================================================
--- trunk/callgrind/threads.c 2009-02-24 04:42:57 UTC (rev 9250)
+++ trunk/callgrind/threads.c 2009-02-24 12:26:53 UTC (rev 9251)
@@ -422,7 +422,7 @@
CLG_DEBUGIF(1) {
CLG_DEBUG(1, " cxtinfo_save(sig %d): collect %s, jmps_passed %d\n",
es->sig, es->collect ? "Yes": "No", es->jmps_passed);
- CLG_(print_bbcc)(-9, es->bbcc, False);
+ CLG_(print_bbcc)(-9, es->bbcc);
CLG_(print_cost)(-9, CLG_(sets).full, es->cost);
}
@@ -448,7 +448,7 @@
CLG_DEBUGIF(1) {
CLG_DEBUG(1, " exec_state_restore(sig %d): collect %s, jmps_passed %d\n",
es->sig, es->collect ? "Yes": "No", es->jmps_passed);
- CLG_(print_bbcc)(-9, es->bbcc, False);
+ CLG_(print_bbcc)(-9, es->bbcc);
CLG_(print_cxt)(-9, es->cxt, 0);
CLG_(print_cost)(-9, CLG_(sets).full, es->cost);
}
|
|
From: Konstantin S. <kon...@gm...> - 2009-02-24 09:13:58
|
On Tue, Feb 24, 2009 at 11:56 AM, Robert Walsh <rj...@du...> wrote: >> > Hey everyone! Let's rewrite Valgrind in C++! >> +1 > > Oh God, what have I started? Rewriting the entire valgrind is a crazy idea, but we may start using C++ in a new code. That's what I do [outside of valgrind trunk] anyway. --kcc |
|
From: Robert W. <rj...@du...> - 2009-02-24 08:56:11
|
> > > Hey everyone! Let's rewrite Valgrind in C++! > +1 Oh God, what have I started? |
|
From: Konstantin S. <kon...@gm...> - 2009-02-24 08:53:24
|
On Tue, Feb 24, 2009 at 11:50 AM, Robert Walsh <rj...@du...> wrote: > Hey everyone! Let's rewrite Valgrind in C++! +1 http://code.google.com/p/data-race-test/wiki/cpp_vg > <ducks> > :-) > Regards, > Robert. > On Tue, Feb 24, 2009 at 12:44 AM, Tom Hughes <to...@co...> wrote: >> >> Nicholas Nethercote wrote: >>> >>> On Tue, Feb 24, 2009 at 2:39 PM, Robert Walsh <rj...@du...> >>> wrote: >>>> >>>> Can't you just not give them a name? So, instead of: >>>> >>>> foo(int unused) >>>> { >>>> // Don't use unused >>>> } >>>> >>>> you get: >>>> >>>> foo(int) >>>> { >>>> // Don't use unused >>>> } >>>> >>>> I don't know how standard that is, or in what languages it's standard. >>> >>> It doesn't appear to be in C: >>> >>> a.c: In function ‘foo’: >>> a.c:1: error: parameter name omitted >>> >>> which would appear to be a problem. >> >> Indeed. What Robert suggested is valid C++ but not valid C. >> >> Tom >> >> -- >> Tom Hughes (to...@co...) >> http://www.compton.nu/ > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > > |
|
From: Robert W. <rj...@du...> - 2009-02-24 08:50:28
|
Hey everyone! Let's rewrite Valgrind in C++!
<ducks>
:-)
Regards,
Robert.
On Tue, Feb 24, 2009 at 12:44 AM, Tom Hughes <to...@co...> wrote:
> Nicholas Nethercote wrote:
>
>> On Tue, Feb 24, 2009 at 2:39 PM, Robert Walsh <rj...@du...>
>> wrote:
>>
>>> Can't you just not give them a name? So, instead of:
>>>
>>> foo(int unused)
>>> {
>>> // Don't use unused
>>> }
>>>
>>> you get:
>>>
>>> foo(int)
>>> {
>>> // Don't use unused
>>> }
>>>
>>> I don't know how standard that is, or in what languages it's standard.
>>>
>>
>> It doesn't appear to be in C:
>>
>> a.c: In function ‘foo’:
>> a.c:1: error: parameter name omitted
>>
>> which would appear to be a problem.
>>
>
> Indeed. What Robert suggested is valid C++ but not valid C.
>
> Tom
>
> --
> Tom Hughes (to...@co...)
> http://www.compton.nu/
>
|
|
From: Tom H. <to...@co...> - 2009-02-24 08:45:08
|
Nicholas Nethercote wrote:
> On Tue, Feb 24, 2009 at 2:39 PM, Robert Walsh <rj...@du...> wrote:
>> Can't you just not give them a name? So, instead of:
>>
>> foo(int unused)
>> {
>> // Don't use unused
>> }
>>
>> you get:
>>
>> foo(int)
>> {
>> // Don't use unused
>> }
>>
>> I don't know how standard that is, or in what languages it's standard.
>
> It doesn't appear to be in C:
>
> a.c: In function ‘foo’:
> a.c:1: error: parameter name omitted
>
> which would appear to be a problem.
Indeed. What Robert suggested is valid C++ but not valid C.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Bart V. A. <bar...@gm...> - 2009-02-24 08:37:50
|
Nightly build on georgia-tech-cellbuzz-native ( cellbuzz, ppc64, Fedora 7, native ) started at 2009-02-24 02:00:01 EST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 409 tests, 39 stderr failures, 10 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/wrap8 (stderr) memcheck/tests/zeropage (stdout) none/tests/faultstatus (stderr) none/tests/linux/mremap (stderr) none/tests/linux/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 409 tests, 41 stderr failures, 10 stdout failures, 0 post failures == drd/tests/tc20_verifywrap (stderr) drd/tests/tc20_verifywrap2 (stderr) exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/wrap8 (stderr) memcheck/tests/zeropage (stdout) none/tests/faultstatus (stderr) none/tests/linux/mremap (stderr) none/tests/linux/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Feb 24 02:47:35 2009 --- new.short Tue Feb 24 03:37:45 2009 *************** *** 8,12 **** ! == 409 tests, 41 stderr failures, 10 stdout failures, 0 post failures == ! drd/tests/tc20_verifywrap (stderr) ! drd/tests/tc20_verifywrap2 (stderr) exp-ptrcheck/tests/bad_percentify (stderr) --- 8,10 ---- ! == 409 tests, 39 stderr failures, 10 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) |
|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 05:52:42
|
Hi, On Darwin, the first memory page is inaccessible. This is achieved by the system allocating it but marking it as not readable, writable or executable. But Memcheck views this as addressable and doesn't complain if you access it. This is a bit weird. Maybe Memcheck should mark such memory as unaddressable? It's changing the meaning of "unaddressable" slightly, but seems like the best thing we can do without tracking r/w/x individually... Nick |
|
From: <sv...@va...> - 2009-02-24 04:43:01
|
Author: njn
Date: 2009-02-24 04:42:57 +0000 (Tue, 24 Feb 2009)
New Revision: 9250
Log:
Fix a compile error on x86/Linux.
Modified:
branches/DARWIN/callgrind/fn.c
Modified: branches/DARWIN/callgrind/fn.c
===================================================================
--- branches/DARWIN/callgrind/fn.c 2009-02-24 03:17:17 UTC (rev 9249)
+++ branches/DARWIN/callgrind/fn.c 2009-02-24 04:42:57 UTC (rev 9250)
@@ -44,10 +44,10 @@
struct chunk_t chunk[];
};
-#if defined(HAVE_ELF)
/* Scan for a pattern in the code of an ELF object.
* If found, return true and set runtime_resolve_{addr,length}
*/
+__attribute__((unused)) // Possibly; depends on the platform.
static Bool check_code(obj_node* obj,
unsigned char code[], struct pattern* pat)
{
@@ -103,7 +103,6 @@
CLG_DEBUG(1, " found nothing.\n");
return False;
}
-#endif // HAVE_ELF
/* _ld_runtime_resolve, located in ld.so, needs special handling:
|
|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 04:24:08
|
Hi,
atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it. This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)
It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll). The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:
VG_BOOL_CLO(arg, "--heap", clo_heap)
else VG_BOOL_CLO(arg, "--stacks", clo_stacks)
else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
else VG_NUM_CLO(arg, "--depth", clo_depth)
(This works because the macros actually contain an if-statement, but
it looks odd.)
VG_NUM_CLO uses VG_(stroll10). But if you want to do any checking or
processing, you can't use those macros, leading to code like this:
else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}
So this patch:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
They're now just expressions (albeit ones with side-effects, setting the
named variable appropriately). Thus they can be used as if-conditions,
and any post-checking or processing can occur in the then-statement.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
for the more esoteric option names (those with numbers in the option
name). This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
Advantages:
- Uniform CLO handling -- the *_CLO_* macros can be used everywhere. Thus
all options of one type (eg. numbers) are handled the same.
- Malformed numeric arguments (eg. --log-fd="foo") aren't accepted.
- You don't have to specify the lengths of any option strings anywhere (eg.
the 9 in the --log-fd example above). The use of a wrong number caused at
least one bug, in Massif.
- More concise -- removes 130 lines of code
I'd also like to change VG_BINT_CLO and VG_BHEX_CLO to abort if the given
value is outside the range -- the current silent truncation just seems
likely to cause confusion as much as anything. But I haven't done that in
this patch.
Thoughts?
Nick
|
|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 04:19:41
|
On Tue, Feb 24, 2009 at 2:39 PM, Robert Walsh <rj...@du...> wrote:
> Can't you just not give them a name? So, instead of:
>
> foo(int unused)
> {
> // Don't use unused
> }
>
> you get:
>
> foo(int)
> {
> // Don't use unused
> }
>
> I don't know how standard that is, or in what languages it's standard.
It doesn't appear to be in C:
a.c: In function ‘foo’:
a.c:1: error: parameter name omitted
which would appear to be a problem.
Nick
|