You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(12) |
2
(11) |
3
(8) |
|
4
(9) |
5
(10) |
6
(18) |
7
(8) |
8
(12) |
9
(23) |
10
(14) |
|
11
(15) |
12
(31) |
13
(45) |
14
(28) |
15
(20) |
16
(16) |
17
(9) |
|
18
(18) |
19
(26) |
20
(49) |
21
(14) |
22
(18) |
23
(24) |
24
(28) |
|
25
(39) |
26
(17) |
27
(27) |
28
(27) |
29
(14) |
30
(44) |
|
|
From: Tom H. <to...@co...> - 2005-09-24 23:34:14
|
In message <200...@ac...>
Julian Seward <js...@ac...> wrote:
> > > Yes. The least worst thing I can think of is to create a file
> > > /tmp/valgrind_fake_proc_self_cmdline_<pid> at startup, and intercept
> > > any attempts to open /proc/self/cmdline and reroute it to said
> > > file instead. Problem is the need to delete the file at the end,
> > > given all the multifarious crashing-out exit points there are.
> >
> > Create it then delete it but hang on to the file handle and when
> > the client asks to open /proc/self/cmdline give them a dup of the
> > handle you are hanging on to.
>
> That sounds great, but you mean there is some kind of filesystem magic
> which keeps the file alive (in a garbage-collection sense) until all
> fds which refer to it disappear? I guess so; I've always wondered
> how those online-update things work, replacing this.so and that.so
> whilst surely some process is still referencing them.
Absolutely - on unix a file is represented by an inode which is
entirely separate to any directory entries which may happen to
point at that inode. That's how hard links work - a directory
entry is basically just a name and an inode number and if multiple
directories point at the same inode you have hard links.
An inode is only deleted when there are no directory entries
referring to it and no open file descriptors for it so a file
will continue to exist (but not appear in the filesystem) if
it has been deleted but there are still open descriptors on it.
It is also why you can overwrite a running program - the process
that has the old version mapped continues to see that version but
any new process get the new version as that is where the directory
entry now points.
It's all so much nicer than Windows where overwriting or deleting
an open file will give you a nasty error ;-)
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Nicholas N. <nj...@cs...> - 2005-09-24 23:25:45
|
On Sun, 25 Sep 2005, Julian Seward wrote: > That sounds great, but you mean there is some kind of filesystem magic > which keeps the file alive (in a garbage-collection sense) until all > fds which refer to it disappear? I guess so; I've always wondered > how those online-update things work, replacing this.so and that.so > whilst surely some process is still referencing them. I believe that's the reason why you have to reboot Windows machines so often after installing new software, as opposed to Unix machines -- Windows doesn't automatically hang onto file handles when the corresponding file is deleted, so a program using a deleted file will have the rug pulled out from underneath it. I think Unix uses reference counting in the implementation. N |
|
From: Julian S. <js...@ac...> - 2005-09-24 23:21:32
|
> > Yes. The least worst thing I can think of is to create a file > > /tmp/valgrind_fake_proc_self_cmdline_<pid> at startup, and intercept > > any attempts to open /proc/self/cmdline and reroute it to said > > file instead. Problem is the need to delete the file at the end, > > given all the multifarious crashing-out exit points there are. > > Create it then delete it but hang on to the file handle and when > the client asks to open /proc/self/cmdline give them a dup of the > handle you are hanging on to. That sounds great, but you mean there is some kind of filesystem magic which keeps the file alive (in a garbage-collection sense) until all fds which refer to it disappear? I guess so; I've always wondered how those online-update things work, replacing this.so and that.so whilst surely some process is still referencing them. Will try it. Would get us out of a hole if it works. J |
|
From: <sv...@va...> - 2005-09-24 22:01:27
|
Author: njn
Date: 2005-09-24 23:01:24 +0100 (Sat, 24 Sep 2005)
New Revision: 4753
Log:
Futzed around with startup: made debugging be more verbose, broke up the
huge process_cmd_line_options a bit, and did some order changes.
Modified:
branches/ASPACEM/coregrind/m_main.c
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-24 21:05:29 UTC (rev 4752=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 22:01:24 UTC (rev 4753=
)
@@ -1022,7 +1022,7 @@
}
}
=20
-static void process_cmd_line_options( UInt* client_auxv, const char* too=
lname )
+static Bool process_cmd_line_options( UInt* client_auxv, const char* too=
lname )
{
SysRes sres;
Int i, eventually_log_fd;
@@ -1465,11 +1465,34 @@
VG_(fcntl)(VG_(clo_log_fd), VKI_F_SETFD, VKI_FD_CLOEXEC);
}
=20
- /* Ok, the logging sink is running now. Print a suitable preamble.
- If logging to file or a socket, write details of parent PID and
- command line args, to help people trying to interpret the
- results of a run which encompasses multiple processes. */
+ if (VG_(clo_n_suppressions) < VG_CLO_MAX_SFILES-1 &&
+ (VG_(needs).core_errors || VG_(needs).tool_errors)) {
+ /* If we haven't reached the max number of suppressions, load
+ the default one. */
+ static const Char default_supp[] =3D "default.supp";
+ Int len =3D VG_(strlen)(VG_(libdir)) + 1 + sizeof(default_supp);
+ Char *buf =3D VG_(arena_malloc)(VG_AR_CORE, len);
+ VG_(sprintf)(buf, "%s/%s", VG_(libdir), default_supp);
+ VG_(clo_suppressions)[VG_(clo_n_suppressions)] =3D buf;
+ VG_(clo_n_suppressions)++;
+ }
=20
+ return (log_to =3D=3D VgLogTo_Fd);
+}
+
+
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/*=3D=3D=3D Printing the preamble =
=3D=3D=3D*/
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+
+/* Ok, the logging sink is running now. Print a suitable preamble.
+ If logging to file or a socket, write details of parent PID and
+ command line args, to help people trying to interpret the
+ results of a run which encompasses multiple processes. */
+static void print_preamble(Bool logging_to_fd, const char* toolname)
+{
+ Int i;
+ =20
if (VG_(clo_xml)) {
VG_(message)(Vg_UserMsg, "<?xml version=3D\"1.0\"?>");
VG_(message)(Vg_UserMsg, "");
@@ -1520,7 +1543,7 @@
VG_(message)(Vg_UserMsg, "</preamble>");
}
=20
- if (!VG_(clo_xml) && VG_(clo_verbosity) > 0 && log_to !=3D VgLogTo_Fd=
) {
+ if (!VG_(clo_xml) && VG_(clo_verbosity) > 0 && !logging_to_fd) {
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg,=20
"My PID =3D %d, parent PID =3D %d. Prog and args are:",
@@ -1588,7 +1611,7 @@
=20
if (VG_(clo_verbosity) > 1) {
SysRes fd;
- if (log_to !=3D VgLogTo_Fd)
+ if (!logging_to_fd)
VG_(message)(Vg_DebugMsg, "");
VG_(message)(Vg_DebugMsg, "Valgrind library directory: %s", VG_(li=
bdir));
=20
@@ -1622,18 +1645,6 @@
# undef BUF_LEN
}
}
-
- if (VG_(clo_n_suppressions) < VG_CLO_MAX_SFILES-1 &&
- (VG_(needs).core_errors || VG_(needs).tool_errors)) {
- /* If we haven't reached the max number of suppressions, load
- the default one. */
- static const Char default_supp[] =3D "default.supp";
- Int len =3D VG_(strlen)(VG_(libdir)) + 1 + sizeof(default_supp);
- Char *buf =3D VG_(arena_malloc)(VG_AR_CORE, len);
- VG_(sprintf)(buf, "%s/%s", VG_(libdir), default_supp);
- VG_(clo_suppressions)[VG_(clo_n_suppressions)] =3D buf;
- VG_(clo_n_suppressions)++;
- }
}
=20
=20
@@ -1863,7 +1874,7 @@
=20
Int main(Int argc, HChar **argv, HChar **envp)
{
- HChar* tool =3D "memcheck"; // default to Memcheck
+ HChar* toolname =3D "memcheck"; // default to Memcheck
HChar** env =3D NULL;
Int need_help =3D 0; // 0 =3D no, 1 =3D --help, 2 =3D --h=
elp-debug
Addr initial_client_IP =3D 0;
@@ -1872,6 +1883,7 @@
SizeT clstack_max_size =3D 0;
UInt* client_auxv;
Int loglevel, i;
+ Bool logging_to_fd;
struct vki_rlimit zero =3D { 0, 0 };
struct exeinfo info;
=20
@@ -2026,7 +2038,7 @@
// Split up argv into: C args, V args, V extra args, and exename.
// p: dynamic memory allocation
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Split up command line");
+ VG_(debugLog)(1, "main", "Split up command line\n");
VG_(split_up_argv)( argc, argv );
if (0) {
for (i =3D 0; i < VG_(args_for_valgrind).used; i++)
@@ -2043,7 +2055,7 @@
// p: split_up_argv [for VG_(args_for_valgrind)]
//--------------------------------------------------------------
VG_(debugLog)(1, "main", "Preprocess command line opts\n");
- get_helprequest_and_toolname(&need_help, &tool);
+ get_helprequest_and_toolname(&need_help, &toolname);
=20
// Set default vex control params
LibVEX_default_VexControl(& VG_(clo_vex_control));
@@ -2065,11 +2077,11 @@
//--------------------------------------------------------------
// Set up client's environment
// p: set-libdir [for VG_(libdir)]
- // p: pre_process_cmd_line_options [for tool]
+ // p: pre_process_cmd_line_options [for toolname]
//--------------------------------------------------------------
if (!need_help) {
VG_(debugLog)(1, "main", "Setup client env\n");
- env =3D setup_client_env(envp, tool);
+ env =3D setup_client_env(envp, toolname);
}
=20
//--------------------------------------------------------------
@@ -2116,8 +2128,7 @@
if (dseg_max_size > m8) dseg_max_size =3D m8;
dseg_max_size =3D VG_PGROUNDUP(dseg_max_size);
=20
- if (!need_help)
- setup_client_dataseg( dseg_max_size );
+ setup_client_dataseg( dseg_max_size );
}
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -2127,6 +2138,13 @@
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
//--------------------------------------------------------------
+ // setup file descriptors
+ // p: n/a
+ //--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Setup file descriptors\n");
+ setup_file_descriptors();
+
+ //--------------------------------------------------------------
// Init tool part 1: pre_clo_init
// p: setup_client_stack() [for 'VG_(client_arg[cv]']
// p: setup_file_descriptors() [for 'VG_(fd_xxx_limit)']
@@ -2145,53 +2163,65 @@
}
=20
//--------------------------------------------------------------
- // Initialise translation table and translation cache
- // p: aspacem [??]
- // p: pre_clo_init [for 'VG_(details).avg_translation_sizeB']
+ // If --tool and --help/--help-debug was given, now give the core+too=
l
+ // help message
+ // p: get_helprequest_and_toolname() [for 'need_help']
+ // p: tl_pre_clo_init [for 'VG_(tdict).usage']
//--------------------------------------------------------------
- if (!need_help) {
- VG_(debugLog)(1, "main", "Initialise TT/TC\n");
- VG_(init_tt_tc)();
+ VG_(debugLog)(1, "main", "Print help and quit, if requested\n");
+ if (need_help) {
+ usage_NORETURN(/*--help-debug?*/2 =3D=3D need_help);
}
=20
//--------------------------------------------------------------
- // Initialise the redirect table.
- // p: init_tt_tc [so it can call VG_(search_transtab) safely]
- // p: aspacem [so can change ownership of sysinfo pages]
+ // Process command line options to Valgrind + tool
+ // p: setup_client_stack() [for 'VG_(client_arg[cv]']
+ // p: setup_file_descriptors() [for 'VG_(fd_xxx_limit)']
+ // p: parse_procselfmaps [so VG segments are setup so tool c=
an
+ // call VG_(malloc)]
//--------------------------------------------------------------
- if (!need_help) {=20
- VG_(debugLog)(1, "main", "Initialise redirects\n");
- VG_(setup_code_redirect_table)();
- }
+ VG_(debugLog)(1, "main", "Process Valgrind's command line options, "
+ " setup logging\n");
+ logging_to_fd =3D process_cmd_line_options(client_auxv, toolname);
=20
//--------------------------------------------------------------
- // setup file descriptors
- // p: n/a
- //--------------------------------------------------------------
- if (!need_help) {
- VG_(debugLog)(1, "main", "Setup file descriptors\n");
- setup_file_descriptors();
- }
-
- //--------------------------------------------------------------
- // Init tool part 2: pre_clo_init
+ // Init tool part 2: post_clo_init
// p: setup_client_stack() [for 'VG_(client_arg[cv]']
// p: setup_file_descriptors() [for 'VG_(fd_xxx_limit)']
// p: parse_procselfmaps [so VG segments are setup so tool c=
an
// call VG_(malloc)]
//--------------------------------------------------------------
-
VG_(debugLog)(1, "main", "Initialise the tool part 2 (post_clo_init)\=
n");
- // If --tool and --help/--help-debug was given, now give the core+too=
l
- // help message
- if (need_help) {
- usage_NORETURN(/*--help-debug?*/2 =3D=3D need_help);
- }
- process_cmd_line_options(client_auxv, tool);
-
VG_TDICT_CALL(tool_post_clo_init);
=20
//--------------------------------------------------------------
+ // Print the preamble
+ // p: tl_pre_clo_init [for 'VG_(details).name' and frien=
ds]
+ // p: process_cmd_line_options() [for VG_(clo_verbosity), VG_(clo_x=
ml),
+ // VG_(clo_log_file_qualifier),
+ // logging_to_fd]
+ //--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Print the preamble...\n");
+ print_preamble(logging_to_fd, toolname);
+ VG_(debugLog)(1, "main", "...finished the preamble\n");
+
+ //--------------------------------------------------------------
+ // Initialise translation table and translation cache
+ // p: aspacem [??]
+ // p: tl_pre_clo_init [for 'VG_(details).avg_translation_sizeB']
+ //--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise TT/TC\n");
+ VG_(init_tt_tc)();
+
+ //--------------------------------------------------------------
+ // Initialise the redirect table.
+ // p: init_tt_tc [so it can call VG_(search_transtab) safely]
+ // p: aspacem [so can change ownership of sysinfo pages]
+ //--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Initialise redirects\n");
+ VG_(setup_code_redirect_table)();
+
+ //--------------------------------------------------------------
// Allow GDB attach
// p: process_cmd_line_options() [for VG_(clo_wait_for_gdb)]
//--------------------------------------------------------------
|
|
From: Tom H. <to...@co...> - 2005-09-24 21:39:58
|
In message <200...@kf...>
Maurice van der Pot <gri...@ge...> wrote:
> On Sat, Sep 24, 2005 at 07:27:45PM +0100, Julian Seward wrote:
> > Qt designer and GIMP work, but OOo 1.1.3 is still crashing. It appears
> > that it reads /proc/self/cmdline to find out the executable name and
> > incorporates that in subsequent paths. That doesn't work now since
> > what it gets is "valgrind [vargs] clientname [cargs]" etc, and it all
> > goes south shortly thereafter.
>
> Would it be worth checking how gdb does it? Reading /proc/self/cmdline
> from a program running within valgrind 3.0.1 gives "valgrind", but
> from within gdb it gives the name of the program being run.
Under gdb the client program is a separate process with it's own
directory in /proc - gdb just controls it with ptrace.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Tom H. <to...@co...> - 2005-09-24 21:39:07
|
In message <200...@ac...>
Julian Seward <js...@ac...> wrote:
> > Perhaps we need to similarly intercept /proc/self/cmdline?
>
> Yes. The least worst thing I can think of is to create a file
> /tmp/valgrind_fake_proc_self_cmdline_<pid> at startup, and intercept
> any attempts to open /proc/self/cmdline and reroute it to said
> file instead. Problem is the need to delete the file at the end,
> given all the multifarious crashing-out exit points there are.
Create it then delete it but hang on to the file handle and when
the client asks to open /proc/self/cmdline give them a dup of the
handle you are hanging on to.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: <sv...@va...> - 2005-09-24 21:05:33
|
Author: njn
Date: 2005-09-24 22:05:29 +0100 (Sat, 24 Sep 2005)
New Revision: 4752
Log:
Backport a commit from the trunk.
Modified:
branches/ASPACEM/cachegrind/cg_main.c
Modified: branches/ASPACEM/cachegrind/cg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/cachegrind/cg_main.c 2005-09-24 19:42:41 UTC (rev 47=
51)
+++ branches/ASPACEM/cachegrind/cg_main.c 2005-09-24 21:05:29 UTC (rev 47=
52)
@@ -578,12 +578,6 @@
if (storeAddrExpr)=20
tl_assert(wordTy =3D=3D typeOfIRExpr(bbOut->tyenv, storeAddrExpr))=
;
=20
-
- // Nb: instrLen will be zero if Vex failed to decode it.
- tl_assert( 0 =3D=3D instrLen ||
- (instrLen >=3D VG_MIN_INSTR_SZB &&=20
- instrLen <=3D VG_MAX_INSTR_SZB) );
-
// Large (eg. 28B, 108B, 512B on x86) data-sized instructions will be
// done inaccurately, but they're very rare and this avoids errors fr=
om
// hitting more than two cache lines in the simulation.
@@ -705,6 +699,14 @@
tl_assert(!addedInstrumentation);
addedInstrumentation =3D True;
=20
+ // Nb: instrLen will be zero if Vex failed to decode it.
+ // Also Client requests can appear to be very large (eg. 18
+ // bytes on x86) because they are really multiple instructio=
ns.
+ tl_assert( 0 =3D=3D instrLen ||
+ bbIn->jumpkind =3D=3D Ijk_ClientReq ||
+ (instrLen >=3D VG_MIN_INSTR_SZB &&=20
+ instrLen <=3D VG_MAX_INSTR_SZB) );
+
// Add instrumentation before this statement.
instrumentInstr(bbOut, &bbInfo->instrs[ bbInfo_i ], bbSeenBe=
fore,
instrAddr, instrLen, dataSize, loadAddrExpr, store=
AddrExpr);
|
|
From: Maurice v. d. P. <gri...@ge...> - 2005-09-24 19:56:01
|
On Sat, Sep 24, 2005 at 07:27:45PM +0100, Julian Seward wrote: > Qt designer and GIMP work, but OOo 1.1.3 is still crashing. It appears > that it reads /proc/self/cmdline to find out the executable name and > incorporates that in subsequent paths. That doesn't work now since > what it gets is "valgrind [vargs] clientname [cargs]" etc, and it all > goes south shortly thereafter. Would it be worth checking how gdb does it? Reading /proc/self/cmdline =66rom a program running within valgrind 3.0.1 gives "valgrind", but =66rom within gdb it gives the name of the program being run. Regards, Maurice. --=20 Maurice van der Pot Gentoo Linux Developer gri...@ge... http://www.gentoo.org Creator of BiteMe! gri...@kf... http://www.kfk4ever.com |
|
From: <sv...@va...> - 2005-09-24 19:42:45
|
Author: njn
Date: 2005-09-24 20:42:41 +0100 (Sat, 24 Sep 2005)
New Revision: 4751
Log:
fix for #113230
Added:
trunk/memcheck/tests/pipe.c
trunk/memcheck/tests/pipe.stderr.exp
trunk/memcheck/tests/pipe.vgtest
Modified:
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/docs/internals/3_0_BUGSTATUS.txt
trunk/memcheck/tests/Makefile.am
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2005-09-24 19:14:12 UTC (re=
v 4750)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2005-09-24 19:42:41 UTC (re=
v 4751)
@@ -1601,12 +1601,23 @@
PRE_REG_READ0(long, "munlockall");
}
=20
-// XXX: sort of x86/Linux-specific
+// This has different signatures for different platforms.
+//
+// x86: int sys_pipe(unsigned long __user *fildes);
+// AMD64: long sys_pipe(int *fildes);
+// ppc32: int sys_pipe(int __user *fildes);
+// ppc64: int sys_pipe(int __user *fildes);
+//
+// The type of the argument is most important, and it is an array of 32 =
bit
+// values in all cases. (The return type differs across platforms, but =
it
+// is not used.) So we use 'int' as its type. This fixed bug #113230 w=
hich
+// was caused by using an array of 'unsigned long's, which didn't work o=
n
+// AMD64.
PRE(sys_pipe)
{
PRINT("sys_pipe ( %p )", ARG1);
- PRE_REG_READ1(int, "pipe", unsigned long *, filedes);
- PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(long) );
+ PRE_REG_READ1(int, "pipe", int *, filedes);
+ PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(int) );
}
POST(sys_pipe)
{
Modified: trunk/docs/internals/3_0_BUGSTATUS.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-24 19:14:12 UTC (rev 4=
750)
+++ trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-24 19:42:41 UTC (rev 4=
751)
@@ -155,7 +155,14 @@
FIXED-TRUNK: TODO
FIXED-30BRANCH: TODO
=20
+----------------------------------------------------------------
+113230 Valgrind sys_pipe on x86-64 wrongly thinks file descriptors
+ should be 64bit
=20
+FIXED-TRUNK: vg:4669
+FIXED-30BRANCH: TODO
+
+
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D Bugs targeted for 3.1.0 and 3.0.1 (all done, 3.0.1 released) =
=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Modified: trunk/memcheck/tests/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/Makefile.am 2005-09-24 19:14:12 UTC (rev 4750)
+++ trunk/memcheck/tests/Makefile.am 2005-09-24 19:42:41 UTC (rev 4751)
@@ -63,6 +63,7 @@
oset_test.stderr.exp oset_test.stdout.exp oset_test.vgtest \
partiallydefinedeq.vgtest partiallydefinedeq.stderr.exp \
partiallydefinedeq.stdout.exp \
+ pipe.stderr.exp pipe.vgtest \
pointer-trace.vgtest \
pointer-trace.stderr.exp pointer-trace.stderr.exp64 \
post-syscall.stderr.exp post-syscall.stdout.exp post-syscall.vgtest \
@@ -107,7 +108,7 @@
nanoleak new_nothrow \
null_socket oset_test overlap \
partiallydefinedeq \
- pointer-trace \
+ pipe pointer-trace \
post-syscall \
realloc1 realloc2 realloc3 \
sigaltstack signal2 sigprocmask sigkill \
Added: trunk/memcheck/tests/pipe.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/pipe.c 2005-09-24 19:14:12 UTC (rev 4750)
+++ trunk/memcheck/tests/pipe.c 2005-09-24 19:42:41 UTC (rev 4751)
@@ -0,0 +1,16 @@
+// This is a regtest for bug #113230, in which 64-bit platforms mistaken=
ly
+// behaved as if pipe() took an array of 64-bit ints, when it really tak=
es
+// an array of 32-bit ints.
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ int *filedes =3D malloc(2 * sizeof(int));
+
+ pipe(filedes);
+
+ return 0;
+}
Added: trunk/memcheck/tests/pipe.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Added: trunk/memcheck/tests/pipe.vgtest
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/pipe.vgtest 2005-09-24 19:14:12 UTC (rev 4750)
+++ trunk/memcheck/tests/pipe.vgtest 2005-09-24 19:42:41 UTC (rev 4751)
@@ -0,0 +1,2 @@
+prog: pipe
+vgopts: -q
|
|
From: <sv...@va...> - 2005-09-24 19:14:22
|
Author: njn Date: 2005-09-24 20:14:12 +0100 (Sat, 24 Sep 2005) New Revision: 4750 Log: Make 3.1.0 work with gcc 2.95. Modified: trunk/docs/internals/roadmap.txt Modified: trunk/docs/internals/roadmap.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/docs/internals/roadmap.txt 2005-09-24 18:57:57 UTC (rev 4749) +++ trunk/docs/internals/roadmap.txt 2005-09-24 19:14:12 UTC (rev 4750) @@ -32,6 +32,11 @@ * Rewrite address space manager; statically link the core with each tool; remove all glibc dependencies (Julian). =20 +* Make it work with GCC 2.95 (bug #111781) -- don't put declarations aft= er + statements in blocks. Do it after merging ASPACEM with the trunk. + -Wdeclaration-after-statement is the GCC warning that detects this, bu= t + it is only present in GCC after 3.4.0 (ie. not in 3.0.X--3.3.X)... + Maybe ----- * Get pthread modelling and Helgrind working again. Requires function |
|
From: Julian S. <js...@ac...> - 2005-09-24 19:01:20
|
> Hmm. I did a workaround a while back that fixed something in /proc, but
> can't for the life of me remember what it was. I think it
> was /proc/self/exe symlink reading.
I think it's this:
/*
* Handle the case where readlink is looking at /proc/self/exe or
* /proc/<pid>/exe.
*/
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
/* jrs 20050604: where does the magic value 2 come from? It seems
like it should be a kernel error value, but we don't know of any
such. */
if (SWHAT == SsFailure && RES_unchecked == 2) {
HChar name[25];
VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
if (VG_(strcmp)((Char *)ARG1, name) == 0 ||
VG_(strcmp)((Char *)ARG1, "/proc/self/exe") == 0) {
VG_(sprintf)(name, "/proc/self/fd/%d", VG_(clexecfd));
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name, ARG2,
ARG3));
}
}
Quite an elegant kludge.
> Perhaps we need to similarly intercept /proc/self/cmdline?
Yes. The least worst thing I can think of is to create a file
/tmp/valgrind_fake_proc_self_cmdline_<pid> at startup, and intercept
any attempts to open /proc/self/cmdline and reroute it to said
file instead. Problem is the need to delete the file at the end,
given all the multifarious crashing-out exit points there are.
I'd still like to know how/why 3.0.1 works OK. Perhaps there is
some magic way to tell the kernel to emit something different
from the default stuff in /proc/<pid>/cmdline?
J
|
|
From: <sv...@va...> - 2005-09-24 18:57:59
|
Author: njn
Date: 2005-09-24 19:57:57 +0100 (Sat, 24 Sep 2005)
New Revision: 4749
Log:
whoops...
Modified:
branches/ASPACEM/coregrind/m_main.c
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-24 18:57:38 UTC (rev 4748=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 18:57:57 UTC (rev 4749=
)
@@ -517,7 +517,7 @@
vg_assert(VG_IS_PAGE_ALIGNED(resvn_size));
vg_assert(VG_IS_PAGE_ALIGNED(anon_start));
vg_assert(VG_IS_PAGE_ALIGNED(resvn_start));
- vg_assert(resvn_start =3D clstack_end + 1 - clstack_max_size);
+ vg_assert(resvn_start =3D=3D clstack_end + 1 - clstack_max_size);
=20
if (0)
VG_(printf)("%p 0x%x %p 0x%x\n",=20
|
|
From: <sv...@va...> - 2005-09-24 18:57:40
|
Author: njn
Date: 2005-09-24 19:57:38 +0100 (Sat, 24 Sep 2005)
New Revision: 4748
Log:
Move verbosity message printing in with the rest of the preamble printing=
.
Modified:
branches/ASPACEM/coregrind/m_main.c
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-24 18:18:32 UTC (rev 4747=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 18:57:38 UTC (rev 4748=
)
@@ -1513,6 +1513,9 @@
"%sCopyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et =
al.%s",
xpre, xpost );
=20
+ if (VG_(clo_verbosity) =3D=3D 1 && !VG_(clo_xml))
+ VG_(message)(Vg_UserMsg, "For more details, rerun with: -v");
+
if (VG_(clo_xml))
VG_(message)(Vg_UserMsg, "</preamble>");
}
@@ -1579,6 +1582,10 @@
VG_(message)(Vg_UserMsg, "</args>");
}
=20
+ // Empty line after the preamble
+ if (VG_(clo_verbosity) > 0)
+ VG_(message)(Vg_UserMsg, "");
+
if (VG_(clo_verbosity) > 1) {
SysRes fd;
if (log_to !=3D VgLogTo_Fd)
@@ -2386,15 +2393,6 @@
}
=20
//--------------------------------------------------------------
- // Verbosity message
- // p: end_rdtsc_calibration [so startup message is printed first]
- //--------------------------------------------------------------
- if (VG_(clo_verbosity) =3D=3D 1 && !VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "For more details, rerun with: -v");
- if (VG_(clo_verbosity) > 0)
- VG_(message)(Vg_UserMsg, "");
-
- //--------------------------------------------------------------
// Setup pointercheck
// p: layout_remaining_space() [for VG_(client_{base,end})]
// p: process_cmd_line_options() [for VG_(clo_pointercheck)]
|
|
From: Robert W. <rj...@du...> - 2005-09-24 18:42:41
|
> Qt designer and GIMP work, but OOo 1.1.3 is still crashing. It appears > that it reads /proc/self/cmdline to find out the executable name and > incorporates that in subsequent paths. That doesn't work now since > what it gets is "valgrind [vargs] clientname [cargs]" etc, and it all > goes south shortly thereafter. Hmm. I did a workaround a while back that fixed something in /proc, but can't for the life of me remember what it was. I think it was /proc/self/exe symlink reading. Perhaps we need to similarly intercept /proc/self/cmdline? That's likely to be harder, though, since it's not just a single call that needs to be intercepted. Regards, Robert. --=20 Robert Walsh Amalgamated Durables, Inc. - "We don't make the things you buy." Email: rj...@du... |
|
From: Julian S. <js...@ac...> - 2005-09-24 18:28:09
|
The new address space manager (which includes a major overhaul of command-line handling) seems to be working fairly convincingly now. On my reference box I get == 180 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vgtest_ume (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) Other distros have more failures. Of these, the last 2 also happen on the trunk. The remaining ones are leak checker problems -- I think it is scanning too much memory. I'll look at it. Current issues are: ---------- Fix the leak checker. ---------- Reading of args from from $VALGRIND_OPTS, ./.valgrindrc and ~/.valgrindrc is currently disabled (m_commandline.c:augment_command_line). ---------- I'd like to get rid of VG_(client_base) and VG_(client_end) because I don't think they do anything useful any more. However, they are still mentioned in PIE mumbo-jumbo in m_ume.c which I don't understand. ---------- Qt designer and GIMP work, but OOo 1.1.3 is still crashing. It appears that it reads /proc/self/cmdline to find out the executable name and incorporates that in subsequent paths. That doesn't work now since what it gets is "valgrind [vargs] clientname [cargs]" etc, and it all goes south shortly thereafter. OOo does work on 3.0.1. I find that odd given that (AIUI) the stage1/ stage2 scheme is 3.0.X is similar to the aspacem scheme, except for the static vs dynamicness of stage2. Anybody know how this worked on 3.0.1? ---------- I'd like to merge all this back to the trunk early next week. Any objections? J |
|
From: <sv...@va...> - 2005-09-24 18:18:39
|
Author: njn Date: 2005-09-24 19:18:32 +0100 (Sat, 24 Sep 2005) New Revision: 4747 Log: Fix xml1. Modified: branches/ASPACEM/memcheck/tests/filter_xml Modified: branches/ASPACEM/memcheck/tests/filter_xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/ASPACEM/memcheck/tests/filter_xml 2005-09-24 16:45:16 UTC (r= ev 4746) +++ branches/ASPACEM/memcheck/tests/filter_xml 2005-09-24 18:18:32 UTC (r= ev 4747) @@ -8,6 +8,7 @@ sed "s/<line>.*<\/line>/<line>...<\/line>/" | sed "s/<dir>.*<\/dir>/<dir>...<\/dir>/" | sed "s/<count>.*<\/count>/<count>...<\/count>/" | +sed "s/\(m_replacemalloc\/\)\?vg_replace_malloc.c/vg_replace_malloc.c/" = | perl -0 -p -e "s/<suppcounts>.*<\/suppcounts>/<suppcounts>...<\/suppcoun= ts>/s" | perl -p -e "s/<time>.*<\/time>/<time>...<\/time>/s" | perl -0 -p -e "s/<vargv>.*<\/vargv>/<vargv>...<\/vargv>/s" |
|
From: <sv...@va...> - 2005-09-24 16:45:22
|
Author: sewardj
Date: 2005-09-24 17:45:16 +0100 (Sat, 24 Sep 2005)
New Revision: 4746
Log:
Make (g)db attaching work again.
Modified:
branches/ASPACEM/coregrind/m_clientstate.c
branches/ASPACEM/coregrind/m_libcproc.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/pub_core_clientstate.h
Modified: branches/ASPACEM/coregrind/m_clientstate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_clientstate.c 2005-09-24 12:45:15 UTC (r=
ev 4745)
+++ branches/ASPACEM/coregrind/m_clientstate.c 2005-09-24 16:45:16 UTC (r=
ev 4746)
@@ -52,7 +52,10 @@
Addr VG_(brk_base) =3D 0; /* start of brk */
Addr VG_(brk_limit) =3D 0; /* current brk */
=20
+/* A fd which refers to the client executable. */
+Int VG_(clexecfd) =3D -1;
=20
+
// Command line pieces, after they have been extracted from argv in
// m_main.main(). The payload vectors are allocated in VG_AR_TOOL
// (the default arena). They are never freed.
Modified: branches/ASPACEM/coregrind/m_libcproc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcproc.c 2005-09-24 12:45:15 UTC (rev =
4745)
+++ branches/ASPACEM/coregrind/m_libcproc.c 2005-09-24 16:45:16 UTC (rev =
4746)
@@ -46,9 +46,6 @@
envp[] as extracted from the client's stack at startup-time. */
Char** VG_(client_envp);
=20
-/* client executable file descriptor */
-Int VG_(clexecfd) =3D -1;
-
/* Path to library directory */
const Char *VG_(libdir) =3D VG_LIBDIR;
=20
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-24 12:45:15 UTC (rev 4745=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 16:45:16 UTC (rev 4746=
)
@@ -828,6 +828,7 @@
{
HChar* exec;
Int ret;
+ SysRes res;
=20
vg_assert( VG_(args_the_exename) !=3D NULL);
exec =3D find_executable( VG_(args_the_exename) );
@@ -843,6 +844,12 @@
VG_(exit)(127);
}
=20
+ /* Get hold of a file descriptor which refers to the client
+ executable. This is needed for attaching to GDB. */
+ res =3D VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR);
+ if (!res.isError)
+ VG_(clexecfd) =3D res.val;
+
/* Copy necessary bits of 'info' that were filled in */
*client_eip =3D info->init_eip;
VG_(brk_base) =3D VG_(brk_limit) =3D VG_PGROUNDUP(info->brkbase);
Modified: branches/ASPACEM/coregrind/pub_core_clientstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-24 12:45:15=
UTC (rev 4745)
+++ branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-24 16:45:16=
UTC (rev 4746)
@@ -51,7 +51,7 @@
extern Addr VG_(brk_base); // start of brk
extern Addr VG_(brk_limit); // current brk
=20
-// Client's executable file descriptor.
+/* A fd which refers to the client executable. */
extern Int VG_(clexecfd);
=20
// Client's original rlimit data and rlimit stack
|
|
From: <sv...@va...> - 2005-09-24 12:45:17
|
Author: sewardj
Date: 2005-09-24 13:45:15 +0100 (Sat, 24 Sep 2005)
New Revision: 4745
Log:
(non-functional change) Add debugLogging for translation cache discard
requests.
Modified:
branches/ASPACEM/coregrind/m_redir.c
branches/ASPACEM/coregrind/m_scheduler/scheduler.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
branches/ASPACEM/coregrind/m_transtab.c
branches/ASPACEM/coregrind/pub_core_transtab.h
Modified: branches/ASPACEM/coregrind/m_redir.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_redir.c 2005-09-24 12:43:57 UTC (rev 474=
4)
+++ branches/ASPACEM/coregrind/m_redir.c 2005-09-24 12:45:15 UTC (rev 474=
5)
@@ -152,7 +152,8 @@
TRACE_REDIR("Discarding translation due to redirect of already =
loaded function" );
TRACE_REDIR(" %s:%s(%p) -> %p)", redir->from_lib, redir->from=
_sym,
redir->from_addr, redir->to_=
addr );
- VG_(discard_translations)((Addr64)redir->from_addr, 1);
+ VG_(discard_translations)((Addr64)redir->from_addr, 1,=20
+ "add_redir_to_resolved_list");
}
=20
r =3D VG_(SkipList_Find_Exact)(&sk_resolved_redirs, &redir->from_a=
ddr);
Modified: branches/ASPACEM/coregrind/m_scheduler/scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_scheduler/scheduler.c 2005-09-24 12:43:5=
7 UTC (rev 4744)
+++ branches/ASPACEM/coregrind/m_scheduler/scheduler.c 2005-09-24 12:45:1=
5 UTC (rev 4745)
@@ -782,7 +782,8 @@
case VEX_TRC_JMP_TINVAL:
VG_(discard_translations)(
(Addr64)VG_(threads)[tid].arch.vex.guest_TISTART,
- VG_(threads)[tid].arch.vex.guest_TILEN
+ VG_(threads)[tid].arch.vex.guest_TILEN,
+ "scheduler(VEX_TRC_JMP_TINVAL)"
);
if (0)
VG_(printf)("dump translations done.\n");
@@ -1050,7 +1051,9 @@
" addr %p, len %d\n",
(void*)arg[1], arg[2] );
=20
- VG_(discard_translations)( arg[1], arg[2] );
+ VG_(discard_translations)(=20
+ arg[1], arg[2], "scheduler(VG_USERREQ__DISCARD_TRANSLATIONS)=
"=20
+ );
=20
SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless =
*/
break;
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-24 12:=
43:57 UTC (rev 4744)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-24 12:=
45:15 UTC (rev 4745)
@@ -162,7 +162,8 @@
VG_TRACK( new_mem_mmap, a, len, rr, ww, xx );
=20
if (d)
- VG_(discard_translations)( (Addr64)a, (ULong)len );
+ VG_(discard_translations)( (Addr64)a, (ULong)len,
+ "ML_(notify_aspacem_and_tool_of_mmap)" =
);
}
=20
/* Expand (or shrink) an existing mapping, potentially moving it at
@@ -303,8 +304,8 @@
old_seg->hasR, old_seg->hasW, old_seg->hasX );
VG_TRACK(die_mem_munmap, old_addr, old_len);
if (d) {
- VG_(discard_translations)( old_addr, old_len );
- VG_(discard_translations)( new_addr, new_len );
+ VG_(discard_translations)( old_addr, old_len, "do_remap(1)" =
);
+ VG_(discard_translations)( new_addr, new_len, "do_remap(2)" =
);
}
return VG_(mk_SysRes_Success)( new_addr );
}
@@ -333,7 +334,7 @@
old_seg->hasR,=20
old_seg->hasW, old_seg->hasX );
if (d)=20
- VG_(discard_translations)( needA, needL );
+ VG_(discard_translations)( needA, needL, "do_remap(3)" );
return VG_(mk_SysRes_Success)( old_addr );
}
}
@@ -354,8 +355,8 @@
old_seg->hasR, old_seg->hasW, old_seg->hasX );
VG_TRACK(die_mem_munmap, old_addr, old_len);
if (d) {
- VG_(discard_translations)( old_addr, old_len );
- VG_(discard_translations)( advised, new_len );
+ VG_(discard_translations)( old_addr, old_len, "do_remap(4)" =
);
+ VG_(discard_translations)( advised, new_len, "do_remap(5)" )=
;
}
return VG_(mk_SysRes_Success)( advised );
}
@@ -381,7 +382,7 @@
VG_TRACK( new_mem_mmap, needA, needL,=20
old_seg->hasR, old_seg->hasW, old_seg->hasX )=
;
if (d)
- VG_(discard_translations)( needA, needL );
+ VG_(discard_translations)( needA, needL, "do_remap(6)" );
return VG_(mk_SysRes_Success)( old_addr );
}
/*NOTREACHED*/ vg_assert(0);
@@ -393,7 +394,8 @@
return sres;
VG_TRACK( die_mem_munmap, old_addr+new_len, old_len-new_len );
if (d)
- VG_(discard_translations)( old_addr+new_len, old_len-new_len );
+ VG_(discard_translations)( old_addr+new_len, old_len-new_len,=20
+ "do_remap(7)" );
return VG_(mk_SysRes_Success)( old_addr );
}
/*NOTREACHED*/ vg_assert(0);
@@ -942,7 +944,10 @@
if (newbrk >=3D VG_(brk_base) && newbrk < VG_(brk_limit)) {
/* shrinking the data segment. Be lazy and don't munmap the
excess area. */
- VG_(discard_translations)( newbrk, VG_(brk_limit) - newbrk );
+ NSegment* seg =3D VG_(am_find_nsegment)(newbrk);
+ if (seg && seg->hasT)
+ VG_(discard_translations)( newbrk, VG_(brk_limit) - newbrk,=20
+ "do_brk(shrink)" );
VG_(brk_limit) =3D newbrk;
return newbrk;
}
@@ -1673,7 +1678,8 @@
VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False );
if (d)
VG_(discard_translations)( (Addr64)res,=20
- (ULong)VG_PGROUNDUP(segmentSize) );
+ (ULong)VG_PGROUNDUP(segmentSize),
+ "ML_(generic_POST_sys_shmat)" );
}
}
=20
@@ -1698,7 +1704,8 @@
VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
if (d)
VG_(discard_translations)( (Addr64)(s->start),
- (ULong)(s->end+1 - s->start) );
+ (ULong)(s->end+1 - s->start),
+ "ML_(generic_POST_sys_shmdt)" );
}
}
/* ------ */
@@ -4868,7 +4875,8 @@
VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx );
VG_(di_notify_mprotect)( a, len, prot );
if (d)
- VG_(discard_translations)( (Addr64)a, (ULong)len );
+ VG_(discard_translations)( (Addr64)a, (ULong)len,=20
+ "POST(sys_mprotect)" );
}
=20
PRE(sys_munmap)
@@ -4892,7 +4900,8 @@
VG_TRACK( die_mem_munmap, a, len );
VG_(di_notify_munmap)( a, len );
if (d)
- VG_(discard_translations)( (Addr64)a, (ULong)len );
+ VG_(discard_translations)( (Addr64)a, (ULong)len,
+ "POST(sys_munmap)" );
}
=20
PRE(sys_mincore)
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-24 12:43=
:57 UTC (rev 4744)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-24 12:45=
:15 UTC (rev 4745)
@@ -726,7 +726,8 @@
Bool d =3D VG_(am_notify_munmap)( ARG1, size );
VG_TRACK( die_mem_munmap, ARG1, size );
if (d)
- VG_(discard_translations)( (Addr64)ARG1, (ULong)size );
+ VG_(discard_translations)( (Addr64)ARG1, (ULong)size,=20
+ "PRE(sys_io_destroy)" );
} =20
} =20
=20
Modified: branches/ASPACEM/coregrind/m_transtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_transtab.c 2005-09-24 12:43:57 UTC (rev =
4744)
+++ branches/ASPACEM/coregrind/m_transtab.c 2005-09-24 12:45:15 UTC (rev =
4745)
@@ -581,13 +581,18 @@
}
=20
=20
-void VG_(discard_translations) ( Addr64 guest_start, ULong range )
+void VG_(discard_translations) ( Addr64 guest_start, ULong range,
+ HChar* who )
{
Int sno, i;
Bool anyDeleted =3D False;
=20
vg_assert(init_done);
=20
+ VG_(debugLog)(1, "transtab",
+ "discard_translations(0x%llx, %lld) req by %s\n",
+ guest_start, range, who );
+
for (sno =3D 0; sno < N_SECTORS; sno++) {
if (sectors[sno].tc =3D=3D NULL)
continue;
@@ -659,6 +664,16 @@
N_SECTORS * N_TTES_PER_SECTOR_USABLE,=20
SECTOR_TT_LIMIT_PERCENT );
}
+
+ VG_(debugLog)(2, "transtab",
+ "cache: %d sectors of %d bytes each =3D %d total\n",=20
+ N_SECTORS, 8 * tc_sector_szQ,
+ N_SECTORS * 8 * tc_sector_szQ );
+ VG_(debugLog)(2, "transtab",
+ "table: %d total entries, max occupancy %d (%d%%)\n",
+ N_SECTORS * N_TTES_PER_SECTOR,
+ N_SECTORS * N_TTES_PER_SECTOR_USABLE,=20
+ SECTOR_TT_LIMIT_PERCENT );
}
=20
=20
Modified: branches/ASPACEM/coregrind/pub_core_transtab.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_transtab.h 2005-09-24 12:43:57 UT=
C (rev 4744)
+++ branches/ASPACEM/coregrind/pub_core_transtab.h 2005-09-24 12:45:15 UT=
C (rev 4745)
@@ -56,7 +56,8 @@
Addr64 guest_addr,=20
Bool upd_cache );
=20
-extern void VG_(discard_translations) ( Addr64 start, ULong range );
+extern void VG_(discard_translations) ( Addr64 start, ULong range,
+ HChar* who );
=20
extern void VG_(print_tt_tc_stats) ( void );
=20
|
|
From: <sv...@va...> - 2005-09-24 12:44:11
|
Author: sewardj
Date: 2005-09-24 13:43:57 +0100 (Sat, 24 Sep 2005)
New Revision: 4744
Log:
Minor refinements to segment permission checking.
Modified:
branches/ASPACEM/coregrind/m_translate.c
Modified: branches/ASPACEM/coregrind/m_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_translate.c 2005-09-24 11:57:15 UTC (rev=
4743)
+++ branches/ASPACEM/coregrind/m_translate.c 2005-09-24 12:43:57 UTC (rev=
4744)
@@ -381,6 +381,24 @@
'tid' is the identity of the thread needing this block.
*/
=20
+/* Look for reasons to disallow making translations from the given
+ segment. */
+
+static Bool translations_allowable_from_seg ( NSegment* seg )
+{
+# if defined(VGA_x86)
+ Bool allowR =3D True;
+# else
+ Bool allowR =3D False;
+# endif
+
+ return seg !=3D NULL
+ && (seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
+ && (seg->hasX || (seg->hasR && allowR));
+}
+
+
+
/* This stops Vex from chasing into function entry points that we wish
to redirect. Chasing across them obviously defeats the redirect
mechanism, with bad effects for Memcheck, Addrcheck, and possibly
@@ -397,6 +415,8 @@
static ThreadId chase_into_ok__CLOSURE_tid;
static Bool chase_into_ok ( Addr64 addr64 )
{
+ NSegment* seg;
+
/* Work through a list of possibilities why we might not want to
allow a chase. */
Addr addr =3D (Addr)addr64;
@@ -405,12 +425,16 @@
if (VG_(clo_smc_check) =3D=3D Vg_SmcAll)
goto dontchase;
=20
+ /* Check the segment permissions. */
+ seg =3D VG_(am_find_nsegment)(addr);
+ if (!translations_allowable_from_seg(seg))
+ goto dontchase;
+
/* AAABBBCCC: if default self-checks are in force, reject if we
would choose to have a self-check for the dest. Note, this must
match the logic at XXXYYYZZZ below. */
if (VG_(clo_smc_check) =3D=3D Vg_SmcStack) {
ThreadId tid =3D chase_into_ok__CLOSURE_tid;
- NSegment* seg =3D VG_(am_find_nsegment)(addr);
if (seg
&& (seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
&& seg->start <=3D VG_(get_SP)(tid)
@@ -442,7 +466,7 @@
{
Addr64 redir, orig_addr0 =3D orig_addr;
Int tmpbuf_used, verbosity, i;
- Bool notrace_until_done, do_self_check, allowR, seg_ok;
+ Bool notrace_until_done, do_self_check;
UInt notrace_until_limit =3D 0;
NSegment* seg;
VexGuestExtents vge;
@@ -529,22 +553,11 @@
bbs_done);
}
=20
- /* Figure out what segment the requested address is in, and=20
- look for possible reasons to disallow it. */
+ /* Are we allowed to translate here? */
=20
seg =3D VG_(am_find_nsegment)(orig_addr);
=20
-# if defined(VGA_x86)
- allowR =3D True;
-# else
- allowR =3D False;
-# endif
-
- seg_ok =3D seg !=3D NULL
- && (seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
- && (seg->hasX || (seg->hasR && allowR));
-
- if (!seg_ok) {
+ if (!translations_allowable_from_seg(seg)) {
/* U R busted, sonny. Place your hands on your head and step
away from the orig_addr. */
/* Code address is bad - deliver a signal instead */
@@ -623,8 +636,14 @@
VGP_POPCC(VgpVexTime);
=20
/* Tell aspacem of all segments that have had translations taken
- from them. */
- for (i =3D 0; i < vge.n_used; i++) {
+ from them. Optimisation: don't re-look up vge.base[0] since seg
+ should already point to it. */
+
+ vg_assert( vge.base[0] =3D=3D (Addr64)orig_addr );
+ if (seg->kind =3D=3D SkFileC || seg->kind =3D=3D SkAnonC)
+ seg->hasT =3D True; /* has cached code */
+
+ for (i =3D 1; i < vge.n_used; i++) {
seg =3D VG_(am_find_nsegment)( vge.base[i] );
if (seg->kind =3D=3D SkFileC || seg->kind =3D=3D SkAnonC)
seg->hasT =3D True; /* has cached code */
|
|
From: <sv...@va...> - 2005-09-24 11:57:24
|
Author: sewardj
Date: 2005-09-24 12:57:15 +0100 (Sat, 24 Sep 2005)
New Revision: 4743
Log:
* Implement code discarding for sys_mremap
* Fix yet another bug in sys_mremap
* Implement code discarding for sys_brk, when dataseg shrinks
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-24 02:53:1=
5 UTC (rev 4742)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-24 11:57:1=
5 UTC (rev 4743)
@@ -1203,7 +1203,7 @@
translations made from it. This is used to determine when to
discard code, so if in doubt return True. */
=20
-static Bool anyTs_in_range ( Addr start, SizeT len )
+static Bool any_Ts_in_range ( Addr start, SizeT len )
{
Int iLo, iHi, i;
aspacem_assert(len > 0);
@@ -1749,7 +1749,7 @@
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
=20
/* Discard is needed if any of the just-trashed range had T. */
- needDiscard =3D anyTs_in_range( a, len );
+ needDiscard =3D any_Ts_in_range( a, len );
=20
init_nsegment( &seg );
seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnonC : SkFileC;
@@ -1799,7 +1799,7 @@
newX =3D toBool(prot & VKI_PROT_EXEC);
=20
/* Discard is needed if we're dumping X permission */
- needDiscard =3D anyTs_in_range( start, len ) && !newX;
+ needDiscard =3D any_Ts_in_range( start, len ) && !newX;
=20
split_nsegments_lo_and_hi( start, start+len-1, &iLo, &iHi );
=20
@@ -1845,7 +1845,7 @@
if (len =3D=3D 0)
return False;
=20
- needDiscard =3D anyTs_in_range( start, len );
+ needDiscard =3D any_Ts_in_range( start, len );
=20
init_nsegment( &seg );
seg.kind =3D SkFree;
@@ -2191,15 +2191,19 @@
/* --- --- munmap helper --- --- */
=20
static=20
-SysRes am_munmap_both_wrk ( Addr start, SizeT len, Bool forClient )
+SysRes am_munmap_both_wrk ( /*OUT*/Bool* need_discard,
+ Addr start, SizeT len, Bool forClient )
{
+ Bool d;
SysRes sres;
=20
if (!VG_IS_PAGE_ALIGNED(start))
goto eINVAL;
=20
- if (len =3D=3D 0)
+ if (len =3D=3D 0) {
+ *need_discard =3D False;
return VG_(mk_SysRes_Success)( 0 );
+ }
=20
if (start + len < len)
goto eINVAL;
@@ -2217,12 +2221,15 @@
goto eINVAL;
}
=20
+ d =3D any_Ts_in_range( start, len );
+
sres =3D do_munmap_NO_NOTIFY( start, len );
if (sres.isError)
return sres;
=20
VG_(am_notify_munmap)( start, len );
AM_SANITY_CHECK;
+ *need_discard =3D d;
return sres;
=20
eINVAL:
@@ -2230,12 +2237,15 @@
}
=20
/* Unmap the given address range and update the segment array
- accordingly. This fails if the range isn't valid for the
- client. */
+ accordingly. This fails if the range isn't valid for the client.
+ If *need_discard is True after a successful return, the caller
+ should immediately discard translations from the specified address
+ range. */
=20
-SysRes VG_(am_munmap_client)( Addr start, SizeT len )
+SysRes VG_(am_munmap_client)( /*OUT*/Bool* need_discard,
+ Addr start, SizeT len )
{
- return am_munmap_both_wrk( start, len, True/*client*/ );
+ return am_munmap_both_wrk( need_discard, start, len, True/*client*/ )=
;
}
=20
/* Unmap the given address range and update the segment array
@@ -2243,7 +2253,14 @@
=20
SysRes VG_(am_munmap_valgrind)( Addr start, SizeT len )
{
- return am_munmap_both_wrk( start, len, False/*valgrind*/ );
+ Bool need_discard;
+ SysRes r =3D am_munmap_both_wrk( &need_discard,=20
+ start, len, False/*valgrind*/ );
+ /* If this assertion fails, it means we allowed translations to be
+ made from a V-owned section. Which shouldn't happen. */
+ if (!r.isError)
+ aspacem_assert(!need_discard);
+ return r;
}
=20
/* Let (start,len) denote an area within a single Valgrind-owned
@@ -2461,9 +2478,12 @@
the mapping forwards only by DELTA bytes, and trashes whatever was
in the new area. Fails if SEG is not a single client mapping or if
the new area is not accessible to the client. Fails if DELTA is
- not page aligned. *seg is invalid after a successful return. */
+ not page aligned. *seg is invalid after a successful return. If
+ *need_discard is True after a successful return, the caller should
+ immediately discard translations from the new area. */
=20
-Bool VG_(am_extend_map_client)( NSegment* seg, SizeT delta )
+Bool VG_(am_extend_map_client)( /*OUT*/Bool* need_discard,
+ NSegment* seg, SizeT delta )
{
Addr xStart;
SysRes sres;
@@ -2493,6 +2513,8 @@
return False;
}
=20
+ *need_discard =3D any_Ts_in_range( seg_copy.end+1, delta );
+
seg_copy.end +=3D delta;
add_segment( &seg_copy );
=20
@@ -2506,9 +2528,12 @@
wraparound is implied, if the old address range does not fall
entirely within a single segment, if the new address range overlaps
with the old one, or if the old address range is not a valid client
- mapping. */
+ mapping. If *need_discard is True after a successful return, the
+ caller should immediately discard translations from both specified
+ address ranges. */
=20
-Bool VG_(am_relocate_nooverlap_client)( Addr old_addr, SizeT old_len,
+Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard,
+ Addr old_addr, SizeT old_len,
Addr new_addr, SizeT new_len )
{
Int iLo, iHi;
@@ -2547,6 +2572,9 @@
return False;
}
=20
+ *need_discard =3D any_Ts_in_range( old_addr, old_len )
+ || any_Ts_in_range( new_addr, new_len );
+
oldseg =3D nsegments[iLo];
=20
/* Create a free hole in the old location. */
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-24 02:=
53:15 UTC (rev 4742)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-24 11:=
57:15 UTC (rev 4743)
@@ -175,7 +175,7 @@
{
# define MIN_SIZET(_aa,_bb) (_aa) < (_bb) ? (_aa) : (_bb)
=20
- Bool ok;
+ Bool ok, d;
NSegment* old_seg;
Addr advised;
Bool f_fixed =3D toBool(flags & VKI_MREMAP_FIXED);
@@ -294,7 +294,7 @@
if (!ok || advised !=3D new_addr)
goto eNOMEM;
ok =3D VG_(am_relocate_nooverlap_client)
- ( old_addr, old_len, new_addr, new_len );
+ ( &d, old_addr, old_len, new_addr, new_len );
if (ok) {
VG_TRACK( copy_mem_remap, old_addr, new_addr,=20
MIN_SIZET(old_len,new_len) );
@@ -302,6 +302,10 @@
VG_TRACK( new_mem_mmap, new_addr+old_len, new_len-old_len,
old_seg->hasR, old_seg->hasW, old_seg->hasX );
VG_TRACK(die_mem_munmap, old_addr, old_len);
+ if (d) {
+ VG_(discard_translations)( old_addr, old_len );
+ VG_(discard_translations)( new_addr, new_len );
+ }
return VG_(mk_SysRes_Success)( new_addr );
}
goto eNOMEM;
@@ -323,11 +327,13 @@
non-fixed, which is not what we want */
advised =3D VG_(am_get_advisory_client_simple)( needA, needL, &ok );
if (ok && advised =3D=3D needA) {
- ok =3D VG_(am_extend_map_client)( old_seg, needL );
+ ok =3D VG_(am_extend_map_client)( &d, old_seg, needL );
if (ok) {
VG_TRACK( new_mem_mmap, needA, needL,=20
old_seg->hasR,=20
old_seg->hasW, old_seg->hasX );
+ if (d)=20
+ VG_(discard_translations)( needA, needL );
return VG_(mk_SysRes_Success)( old_addr );
}
}
@@ -339,14 +345,18 @@
vg_assert(advised+new_len-1 < old_addr=20
|| advised > old_addr+old_len-1);
ok =3D VG_(am_relocate_nooverlap_client)
- ( old_addr, old_len, advised, new_len );
+ ( &d, old_addr, old_len, advised, new_len );
if (ok) {
- VG_TRACK( copy_mem_remap, old_addr, new_addr,=20
+ VG_TRACK( copy_mem_remap, old_addr, advised,=20
MIN_SIZET(old_len,new_len) );
if (new_len > old_len)
- VG_TRACK( new_mem_mmap, new_addr+old_len, new_len-old_len,
+ VG_TRACK( new_mem_mmap, advised+old_len, new_len-old_len,
old_seg->hasR, old_seg->hasW, old_seg->hasX );
VG_TRACK(die_mem_munmap, old_addr, old_len);
+ if (d) {
+ VG_(discard_translations)( old_addr, old_len );
+ VG_(discard_translations)( advised, new_len );
+ }
return VG_(mk_SysRes_Success)( advised );
}
}
@@ -365,21 +375,25 @@
advised =3D VG_(am_get_advisory_client_simple)( needA, needL, &ok );
if (!ok || advised !=3D needA)
goto eNOMEM;
- ok =3D VG_(am_extend_map_client)( old_seg, needL );
+ ok =3D VG_(am_extend_map_client)( &d, old_seg, needL );
if (!ok)
goto eNOMEM;
VG_TRACK( new_mem_mmap, needA, needL,=20
old_seg->hasR, old_seg->hasW, old_seg->hasX )=
;
+ if (d)
+ VG_(discard_translations)( needA, needL );
return VG_(mk_SysRes_Success)( old_addr );
}
/*NOTREACHED*/ vg_assert(0);
=20
shrink_in_place:
{
- SysRes sres =3D VG_(am_munmap_client)( old_addr+new_len, old_len-new_=
len );
+ SysRes sres =3D VG_(am_munmap_client)( &d, old_addr+new_len, old_len-=
new_len );
if (sres.isError)
return sres;
VG_TRACK( die_mem_munmap, old_addr+new_len, old_len-new_len );
+ if (d)
+ VG_(discard_translations)( old_addr+new_len, old_len-new_len );
return VG_(mk_SysRes_Success)( old_addr );
}
/*NOTREACHED*/ vg_assert(0);
@@ -928,6 +942,7 @@
if (newbrk >=3D VG_(brk_base) && newbrk < VG_(brk_limit)) {
/* shrinking the data segment. Be lazy and don't munmap the
excess area. */
+ VG_(discard_translations)( newbrk, VG_(brk_limit) - newbrk );
VG_(brk_limit) =3D newbrk;
return newbrk;
}
Modified: branches/ASPACEM/coregrind/pub_core_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-24 02:53:15 U=
TC (rev 4742)
+++ branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-24 11:57:15 U=
TC (rev 4743)
@@ -226,9 +226,12 @@
( SizeT length, UInt prot, Int fd, SizeT offset );
=20
/* Unmap the given address range and update the segment array
- accordingly. This fails if the range isn't valid for the
- client. */
-extern SysRes VG_(am_munmap_client)( Addr start, SizeT length );
+ accordingly. This fails if the range isn't valid for the client.
+ If *need_discard is True after a successful return, the caller
+ should immediately discard translations from the specified address
+ range. */
+extern SysRes VG_(am_munmap_client)( /*OUT*/Bool* need_discard,
+ Addr start, SizeT length );
=20
/* Unmap the given address range and update the segment array
accordingly. This fails if the range isn't valid for valgrind. */
@@ -270,16 +273,22 @@
the mapping forwards only by DELTA bytes, and trashes whatever was
in the new area. Fails if SEG is not a single client mapping or if
the new area is not accessible to the client. Fails if DELTA is
- not page aligned. *seg is invalid after a successful return. */
-extern Bool VG_(am_extend_map_client)( NSegment* seg, SizeT delta );
+ not page aligned. *seg is invalid after a successful return. If
+ *need_discard is True after a successful return, the caller should
+ immediately discard translations from the new area. */
+extern Bool VG_(am_extend_map_client)( /*OUT*/Bool* need_discard,
+ NSegment* seg, SizeT delta );
=20
/* Remap the old address range to the new address range. Fails if any
parameter is not page aligned, if the either size is zero, if any
wraparound is implied, if the old address range does not fall
entirely within a single segment, if the new address range overlaps
with the old one, or if the old address range is not a valid client
- mapping. */
-extern Bool VG_(am_relocate_nooverlap_client)( Addr old_addr, SizeT old_=
len,
+ mapping. If *need_discard is True after a successful return, the
+ caller should immediately discard translations from both specified
+ address ranges. */
+extern Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard=
,
+ Addr old_addr, SizeT old_=
len,
Addr new_addr, SizeT new_=
len );
=20
//--------------------------------------------------------------
|
|
From: <js...@ac...> - 2005-09-24 03:03:48
|
Nightly build on phoenix ( SuSE 9.1 ) started at 2005-09-24 03:30:00 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 185 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <sv...@va...> - 2005-09-24 02:53:20
|
Author: sewardj
Date: 2005-09-24 03:53:15 +0100 (Sat, 24 Sep 2005)
New Revision: 4742
Log:
Discard translations after munmap/mprotect/mmap. This makes Qt
designer and Gimp work. mremap is not done yet.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
branches/ASPACEM/coregrind/m_translate.c
branches/ASPACEM/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-23 21:29:5=
1 UTC (rev 4741)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-24 02:53:1=
5 UTC (rev 4742)
@@ -1199,6 +1199,25 @@
}
=20
=20
+/* Returns True if any part of the address range is marked as having
+ translations made from it. This is used to determine when to
+ discard code, so if in doubt return True. */
+
+static Bool anyTs_in_range ( Addr start, SizeT len )
+{
+ Int iLo, iHi, i;
+ aspacem_assert(len > 0);
+ aspacem_assert(start + len > start);
+ iLo =3D find_nsegment_idx(start);
+ iHi =3D find_nsegment_idx(start + len - 1);
+ for (i =3D iLo; i <=3D iHi; i++) {
+ if (nsegments[i].hasT)
+ return True;
+ }
+ return False;
+}
+
+
/*-----------------------------------------------------------------*/
/*--- ---*/
/*--- Modifying the segment array, and constructing segments. ---*/
@@ -1712,19 +1731,26 @@
=20
=20
/* Notifies aspacem that the client completed an mmap successfully.
- The segment array is updated accordingly. */
+ The segment array is updated accordingly. If the returned Bool is
+ True, the caller should immediately discard translations from the
+ specified address range. */
=20
-void=20
+Bool
VG_(am_notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
Int fd, SizeT offset )
{
HChar buf[VKI_PATH_MAX];
UInt dev, ino;
NSegment seg;
+ Bool needDiscard;
=20
aspacem_assert(len > 0);
aspacem_assert(VG_IS_PAGE_ALIGNED(a));
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
+
+ /* Discard is needed if any of the just-trashed range had T. */
+ needDiscard =3D anyTs_in_range( a, len );
+
init_nsegment( &seg );
seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnonC : SkFileC;
seg.start =3D a;
@@ -1744,6 +1770,7 @@
}
add_segment( &seg );
AM_SANITY_CHECK;
+ return needDiscard;
}
=20
/* Notifies aspacem that an mprotect was completed successfully. The
@@ -1752,28 +1779,33 @@
stupid mprotects, for example the client doing mprotect of
non-client areas. Such requests should be intercepted earlier, by
the syscall wrapper for mprotect. This function merely records
- whatever it is told. */
+ whatever it is told. If the returned Bool is True, the caller
+ should immediately discard translations from the specified address
+ range. */
=20
-void VG_(am_notify_mprotect)( Addr start, SizeT len, UInt prot )
+Bool VG_(am_notify_mprotect)( Addr start, SizeT len, UInt prot )
{
Int i, iLo, iHi;
- Bool newR, newW, newX;
+ Bool newR, newW, newX, needDiscard;
=20
aspacem_assert(VG_IS_PAGE_ALIGNED(start));
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
=20
if (len =3D=3D 0)
- return;
+ return False;
=20
+ newR =3D toBool(prot & VKI_PROT_READ);
+ newW =3D toBool(prot & VKI_PROT_WRITE);
+ newX =3D toBool(prot & VKI_PROT_EXEC);
+
+ /* Discard is needed if we're dumping X permission */
+ needDiscard =3D anyTs_in_range( start, len ) && !newX;
+
split_nsegments_lo_and_hi( start, start+len-1, &iLo, &iHi );
=20
iLo =3D find_nsegment_idx(start);
iHi =3D find_nsegment_idx(start + len - 1);
=20
- newR =3D toBool(prot & VKI_PROT_READ);
- newW =3D toBool(prot & VKI_PROT_WRITE);
- newX =3D toBool(prot & VKI_PROT_EXEC);
-
for (i =3D iLo; i <=3D iHi; i++) {
/* Apply the permissions to all relevant segments. */
switch (nsegments[i].kind) {
@@ -1792,24 +1824,29 @@
segments mergeable. Therefore have to re-preen them. */
(void)preen_nsegments();
AM_SANITY_CHECK;
+ return needDiscard;
}
=20
=20
/* Notifies aspacem that an munmap completed successfully. The
segment array is updated accordingly. As with
VG_(am_notify_munmap), we merely record the given info, and don't
- check it for sensibleness. */
+ check it for sensibleness. If the returned Bool is True, the
+ caller should immediately discard translations from the specified
+ address range. */
=20
-void VG_(am_notify_munmap)( Addr start, SizeT len )
+Bool VG_(am_notify_munmap)( Addr start, SizeT len )
{
NSegment seg;
-
+ Bool needDiscard;
aspacem_assert(VG_IS_PAGE_ALIGNED(start));
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
=20
if (len =3D=3D 0)
- return;
+ return False;
=20
+ needDiscard =3D anyTs_in_range( start, len );
+
init_nsegment( &seg );
seg.kind =3D SkFree;
seg.start =3D start;
@@ -1819,6 +1856,7 @@
/* Unmapping could create two adjacent free segments, so a preen is
needed. add_segment() will do that, so no need to here. */
AM_SANITY_CHECK;
+ return needDiscard;
}
=20
=20
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-23 21:29:51 UTC (rev 4741=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 02:53:15 UTC (rev 4742=
)
@@ -1577,7 +1577,10 @@
if (log_to !=3D VgLogTo_Fd)
VG_(message)(Vg_DebugMsg, "");
VG_(message)(Vg_DebugMsg, "Valgrind library directory: %s", VG_(li=
bdir));
+
VG_(message)(Vg_DebugMsg, "Command line");
+ if (VG_(args_the_exename))
+ VG_(message)(Vg_DebugMsg, " %s", VG_(args_the_exename));
for (i =3D 0; i < VG_(args_for_client).used; i++)
VG_(message)(Vg_DebugMsg, " %s", VG_(args_for_client).strs[i]=
);
=20
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-23 21:=
29:51 UTC (rev 4741)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-24 02:=
53:15 UTC (rev 4742)
@@ -32,6 +32,7 @@
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_aspacemgr.h"
+#include "pub_core_transtab.h" // VG_(discard_translations)
#include "pub_core_clientstate.h" // VG_(brk_base), VG_(brk_limit)
#include "pub_core_debuglog.h"
#include "pub_core_errormgr.h"
@@ -145,20 +146,23 @@
ML_(notify_aspacem_and_tool_of_mmap) ( Addr a, SizeT len, UInt prot,=20
UInt flags, Int fd, ULong offset =
)
{
- Bool rr, ww, xx;
+ Bool rr, ww, xx, d;
=20
/* 'a' is the return value from a real kernel mmap, hence: */
vg_assert(VG_IS_PAGE_ALIGNED(a));
/* whereas len is whatever the syscall supplied. So: */
len =3D VG_PGROUNDUP(len);
=20
- VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset );
+ d =3D VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset );
=20
rr =3D toBool(prot & VKI_PROT_READ);
ww =3D toBool(prot & VKI_PROT_WRITE);
xx =3D toBool(prot & VKI_PROT_EXEC);
=20
VG_TRACK( new_mem_mmap, a, len, rr, ww, xx );
+
+ if (d)
+ VG_(discard_translations)( (Addr64)a, (ULong)len );
}
=20
/* Expand (or shrink) an existing mapping, potentially moving it at
@@ -1632,6 +1636,7 @@
UInt segmentSize =3D get_shm_size ( arg0 );
if ( segmentSize > 0 ) {
UInt prot =3D VKI_PROT_READ|VKI_PROT_WRITE;
+ Bool d;
=20
if (!(arg2 & 010000)) /* =3D SHM_RDONLY */
prot &=3D ~VKI_PROT_WRITE;
@@ -1645,12 +1650,15 @@
cope with the discrepancy, aspacem's sync checker omits the
dev/ino correspondence check in cases where V does not know
the dev/ino. */
- VG_(am_notify_client_mmap)( res, VG_PGROUNDUP(segmentSize),=20
- prot, VKI_MAP_ANONYMOUS, 0,0);
+ d =3D VG_(am_notify_client_mmap)( res, VG_PGROUNDUP(segmentSize),=20
+ prot, VKI_MAP_ANONYMOUS, 0,0);
=20
/* we don't distinguish whether it's read-only or
* read-write -- it doesn't matter really. */
VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False );
+ if (d)
+ VG_(discard_translations)( (Addr64)res,=20
+ (ULong)VG_PGROUNDUP(segmentSize) );
}
}
=20
@@ -1666,13 +1674,16 @@
void
ML_(generic_POST_sys_shmdt) ( ThreadId tid, UWord res, UWord arg0 )
{
- NSegment *s =3D VG_(am_find_nsegment)(arg0);
+ NSegment* s =3D VG_(am_find_nsegment)(arg0);
=20
if (s !=3D NULL /* && (s->flags & SF_SHM) */
/* && Implied by defn of am_find_nsegment:
VG_(seg_contains)(s, arg0, 1) */) {
- VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+ Bool d =3D VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
+ if (d)
+ VG_(discard_translations)( (Addr64)(s->start),
+ (ULong)(s->end+1 - s->start) );
}
}
/* ------ */
@@ -4835,11 +4846,14 @@
Bool rr =3D toBool(prot & VKI_PROT_READ);
Bool ww =3D toBool(prot & VKI_PROT_WRITE);
Bool xx =3D toBool(prot & VKI_PROT_EXEC);
+ Bool d;
=20
page_align_addr_and_len(&a, &len);
- VG_(am_notify_mprotect)(a, len, prot);
+ d =3D VG_(am_notify_mprotect)(a, len, prot);
VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx );
VG_(di_notify_mprotect)( a, len, prot );
+ if (d)
+ VG_(discard_translations)( (Addr64)a, (ULong)len );
}
=20
PRE(sys_munmap)
@@ -4856,11 +4870,14 @@
{
Addr a =3D ARG1;
SizeT len =3D ARG2;
+ Bool d;
=20
page_align_addr_and_len(&a, &len);
- VG_(am_notify_munmap)(a, len);
+ d =3D VG_(am_notify_munmap)(a, len);
VG_TRACK( die_mem_munmap, a, len );
VG_(di_notify_munmap)( a, len );
+ if (d)
+ VG_(discard_translations)( (Addr64)a, (ULong)len );
}
=20
PRE(sys_mincore)
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-23 21:29=
:51 UTC (rev 4741)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-24 02:53=
:15 UTC (rev 4742)
@@ -31,6 +31,7 @@
#include "pub_core_basics.h"
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
+#include "pub_core_transtab.h" // VG_(discard_translations)
#include "pub_core_debuglog.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
@@ -722,8 +723,10 @@
SET_STATUS_from_SysRes( VG_(do_syscall1)(SYSNO, ARG1) );
=20
if (SUCCESS && RES =3D=3D 0) {=20
- VG_(am_notify_munmap)( ARG1, size );
+ Bool d =3D VG_(am_notify_munmap)( ARG1, size );
VG_TRACK( die_mem_munmap, ARG1, size );
+ if (d)
+ VG_(discard_translations)( (Addr64)ARG1, (ULong)size );
} =20
} =20
=20
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-23 21:29:=
51 UTC (rev 4741)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-24 02:53:=
15 UTC (rev 4742)
@@ -180,18 +180,27 @@
should be notified BEFORE the tool. Hence the following is
correct:
=20
- VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+ Bool d =3D VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
+ if (d)
+ VG_(discard_translations)(s->start, s->end+1 - s->start);
=20
whilst this is wrong:
=20
VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
- VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+ Bool d =3D VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+ if (d)
+ VG_(discard_translations)(s->start, s->end+1 - s->start);
=20
The reason is that the tool may itself ask aspacem for more shadow
memory as a result of the VG_TRACK call. In such a situation it is
critical that aspacem's segment array is up to date -- hence the
need to notify aspacem first.
+
+ -----------
+
+ Also .. take care to call VG_(discard_translations) whenever
+ memory with execute permissions is unmapped.
*/
=20
=20
Modified: branches/ASPACEM/coregrind/m_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_translate.c 2005-09-23 21:29:51 UTC (rev=
4741)
+++ branches/ASPACEM/coregrind/m_translate.c 2005-09-24 02:53:15 UTC (rev=
4742)
@@ -441,7 +441,7 @@
ULong bbs_done )
{
Addr64 redir, orig_addr0 =3D orig_addr;
- Int tmpbuf_used, verbosity;
+ Int tmpbuf_used, verbosity, i;
Bool notrace_until_done, do_self_check, allowR, seg_ok;
UInt notrace_until_limit =3D 0;
NSegment* seg;
@@ -545,7 +545,6 @@
&& (seg->hasX || (seg->hasR && allowR));
=20
if (!seg_ok) {
-
/* U R busted, sonny. Place your hands on your head and step
away from the orig_addr. */
/* Code address is bad - deliver a signal instead */
@@ -559,15 +558,8 @@
VG_(synth_fault_mapping)(tid, orig_addr);
}
return False;
-
- } else {
-
- /* Ok to execute here. Mark that we have taken a translation
- from this segment. */
- seg->hasT =3D True; /* contains cached code */
}
=20
-
/* Do we want a self-checking translation? */
do_self_check =3D False;
switch (VG_(clo_smc_check)) {
@@ -630,6 +622,14 @@
=20
VGP_POPCC(VgpVexTime);
=20
+ /* Tell aspacem of all segments that have had translations taken
+ from them. */
+ for (i =3D 0; i < vge.n_used; i++) {
+ seg =3D VG_(am_find_nsegment)( vge.base[i] );
+ if (seg->kind =3D=3D SkFileC || seg->kind =3D=3D SkAnonC)
+ seg->hasT =3D True; /* has cached code */
+ }
+
/* Copy data at trans_addr into the translation cache. */
vg_assert(tmpbuf_used > 0 && tmpbuf_used < 65536);
=20
Modified: branches/ASPACEM/coregrind/pub_core_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-23 21:29:51 U=
TC (rev 4741)
+++ branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-24 02:53:15 U=
TC (rev 4742)
@@ -157,8 +157,10 @@
( Addr start, SizeT len, /*OUT*/Bool* ok );
=20
/* Notifies aspacem that the client completed an mmap successfully.
- The segment array is updated accordingly. */
-extern void VG_(am_notify_client_mmap)
+ The segment array is updated accordingly. If the returned Bool is
+ True, the caller should immediately discard translations from the
+ specified address range. */
+extern Bool VG_(am_notify_client_mmap)
( Addr a, SizeT len, UInt prot, UInt flags, Int fd, SizeT offset );
=20
/* Notifies aspacem that an mprotect was completed successfully. The
@@ -167,14 +169,18 @@
stupid mprotects, for example the client doing mprotect of
non-client areas. Such requests should be intercepted earlier, by
the syscall wrapper for mprotect. This function merely records
- whatever it is told. */
-extern void VG_(am_notify_mprotect)( Addr start, SizeT len, UInt prot );
+ whatever it is told. If the returned Bool is True, the caller
+ should immediately discard translations from the specified address
+ range. */
+extern Bool VG_(am_notify_mprotect)( Addr start, SizeT len, UInt prot );
=20
/* Notifies aspacem that an munmap completed successfully. The
segment array is updated accordingly. As with
VG_(am_notify_munmap), we merely record the given info, and don't
- check it for sensibleness. */
-extern void VG_(am_notify_munmap)( Addr start, SizeT len );
+ check it for sensibleness. If the returned Bool is True, the
+ caller should immediately discard translations from the specified
+ address range. */
+extern Bool VG_(am_notify_munmap)( Addr start, SizeT len );
=20
=20
/* Hand a raw mmap to the kernel, without aspacem updating the segment
|
|
From: Tom H. <to...@co...> - 2005-09-24 02:41:58
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-09-24 03:30:05 BST 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 == 187 tests, 5 stderr failures, 0 stdout failures ================= memcheck/tests/leak-tree (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-24 02:27:55
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2005-09-24 03:15:03 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 14 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) none/tests/x86/yield (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Sat Sep 24 03:21:34 2005 --- new.short Sat Sep 24 03:27:50 2005 *************** *** 8,10 **** ! == 186 tests, 14 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) --- 8,10 ---- ! == 186 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) *************** *** 23,25 **** none/tests/x86/int (stderr) - none/tests/x86/yield (stdout) --- 23,24 ---- |
|
From: Tom H. <th...@cy...> - 2005-09-24 02:25:40
|
Nightly build on ginetta ( i686, Red Hat 8.0 ) started at 2005-09-24 03:10:07 BST 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 == 186 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |