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
(21) |
2
(18) |
3
(19) |
4
(17) |
|
5
(6) |
6
(5) |
7
(9) |
8
(21) |
9
(16) |
10
(21) |
11
(22) |
|
12
(19) |
13
(19) |
14
(8) |
15
(16) |
16
(17) |
17
(16) |
18
(33) |
|
19
(33) |
20
(34) |
21
(32) |
22
(26) |
23
(23) |
24
(16) |
25
(21) |
|
26
(19) |
27
(7) |
28
(29) |
29
(27) |
30
(55) |
|
|
|
From: <sv...@va...> - 2005-06-19 21:57:56
|
Author: njn
Date: 2005-06-19 22:57:54 +0100 (Sun, 19 Jun 2005)
New Revision: 3962
Log:
Move VG_(get_memory_from_mmap_for_client) out of m_aspacemgr into
m_libcmman, next to VG_(get_memory_from_mmap). Removes the (direct)
dependence of m_mallocfree on m_aspacemgr.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_libcmman.c
trunk/coregrind/m_mallocfree.c
trunk/coregrind/pub_core_aspacemgr.h
trunk/coregrind/pub_core_libcmman.h
Modified: trunk/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
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 21:49:28 UTC (rev =
3961)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 21:57:54 UTC (rev =
3962)
@@ -1372,28 +1372,9 @@
=20
=20
/*--------------------------------------------------------------------*/
-/*--- Manage allocation of memory on behalf of the client ---*/
+/*--- Random function that doesn't really belong here ---*/
/*--------------------------------------------------------------------*/
=20
-// Returns 0 on failure.
-Addr VG_(get_memory_from_mmap_for_client)
- (Addr addr, SizeT len, UInt prot, UInt sf_flags)
-{
- len =3D VG_PGROUNDUP(len);
-
- tl_assert(!(sf_flags & SF_FIXED));
- tl_assert(0 =3D=3D addr);
-
- addr =3D (Addr)VG_(mmap)((void *)addr, len, prot,=20
- VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_=
CLIENT,
- sf_flags | SF_CORE, -1, 0);
- if ((Addr)-1 !=3D addr)
- return addr;
- else
- return 0;
-}
-
-
/* We'll call any RW mmaped memory segment, within the client address
range, which isn't SF_CORE, a root.=20
*/
Modified: trunk/coregrind/m_libcmman.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_libcmman.c 2005-06-19 21:49:28 UTC (rev 3961)
+++ trunk/coregrind/m_libcmman.c 2005-06-19 21:57:54 UTC (rev 3962)
@@ -166,6 +166,25 @@
VG_(exit)(1);
}
=20
+// Returns 0 on failure.
+Addr VG_(get_memory_from_mmap_for_client)
+ (Addr addr, SizeT len, UInt prot, UInt sf_flags)
+{
+ len =3D VG_PGROUNDUP(len);
+
+ tl_assert(!(sf_flags & SF_FIXED));
+ tl_assert(0 =3D=3D addr);
+
+ addr =3D (Addr)VG_(mmap)((void *)addr, len, prot,=20
+ VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_=
CLIENT,
+ sf_flags | SF_CORE, -1, 0);
+ if ((Addr)-1 !=3D addr)
+ return addr;
+ else
+ return 0;
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_mallocfree.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_mallocfree.c 2005-06-19 21:49:28 UTC (rev 3961)
+++ trunk/coregrind/m_mallocfree.c 2005-06-19 21:57:54 UTC (rev 3962)
@@ -30,7 +30,6 @@
*/
=20
#include "pub_core_basics.h"
-#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcmman.h"
Modified: trunk/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
--- trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 21:49:28 UTC (rev 396=
1)
+++ trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 21:57:54 UTC (rev 396=
2)
@@ -145,9 +145,6 @@
/* Return string for prot */
extern const HChar *VG_(prot_str)(UInt prot);
=20
-extern Addr VG_(get_memory_from_mmap_for_client)
- (Addr base, SizeT len, UInt prot, UInt flags);
-
/* Parses /proc/self/maps, calling `record_mapping' for each entry. */
extern=20
void VG_(parse_procselfmaps) (
Modified: trunk/coregrind/pub_core_libcmman.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
--- trunk/coregrind/pub_core_libcmman.h 2005-06-19 21:49:28 UTC (rev 3961=
)
+++ trunk/coregrind/pub_core_libcmman.h 2005-06-19 21:57:54 UTC (rev 3962=
)
@@ -48,6 +48,9 @@
extern SysRes VG_(munmap_native) ( void* start, SizeT length );
extern SysRes VG_(mprotect_native) ( void *start, SizeT length, UInt pro=
t );
=20
+extern Addr VG_(get_memory_from_mmap_for_client)
+ (Addr base, SizeT len, UInt prot, UInt flags);
+
#endif // __PUB_CORE_LIBCMMAN_H
=20
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2005-06-19 21:50:31
|
Author: njn
Date: 2005-06-19 22:49:28 +0100 (Sun, 19 Jun 2005)
New Revision: 3961
Log:
Put VG_(client_trampoline_code) in m_trampoline.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_stacktrace.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_aspacemgr.h
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/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
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 21:10:42 UTC (rev =
3960)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 21:49:28 UTC (rev =
3961)
@@ -60,7 +60,6 @@
Addr VG_(client_base); /* client address space limits */
Addr VG_(client_end);
Addr VG_(client_mapbase);
-Addr VG_(client_trampoline_code);
Addr VG_(clstk_base);
Addr VG_(clstk_end);
UWord VG_(clstk_id);
Modified: trunk/coregrind/m_stacktrace.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_stacktrace.c 2005-06-19 21:10:42 UTC (rev 3960)
+++ trunk/coregrind/m_stacktrace.c 2005-06-19 21:49:28 UTC (rev 3961)
@@ -31,6 +31,7 @@
#include "pub_core_basics.h"
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
+#include "pub_core_debuginfo.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
Modified: trunk/coregrind/m_trampoline.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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_trampoline.S 2005-06-19 21:10:42 UTC (rev 3960)
+++ trunk/coregrind/m_trampoline.S 2005-06-19 21:49:28 UTC (rev 3961)
@@ -37,6 +37,7 @@
space at an arbitary address. Therefore, this code must be completel=
y
position-independent.
*/
+.global VG_(client_trampoline_code)
.global VG_(trampoline_code_start)
.global VG_(trampoline_code_length)
.global VG_(tramp_sigreturn_offset)
@@ -101,6 +102,8 @@
tramp_code_end:
=09
.data
+VG_(client_trampoline_code):
+ .long 0
VG_(trampoline_code_length):
.long tramp_code_end - VG_(trampoline_code_start)
VG_(tramp_sigreturn_offset):
Modified: trunk/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
--- trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 21:10:42 UTC (rev 396=
0)
+++ trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 21:49:28 UTC (rev 396=
1)
@@ -50,7 +50,6 @@
extern Addr VG_(clstk_base); // client stack range
extern Addr VG_(clstk_end);
extern UWord VG_(clstk_id); // client stack id
-extern Addr VG_(client_trampoline_code);
=20
extern Addr VG_(brk_base); // start of brk
extern Addr VG_(brk_limit); // current brk
Modified: trunk/coregrind/pub_core_trampoline.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
--- trunk/coregrind/pub_core_trampoline.h 2005-06-19 21:10:42 UTC (rev 39=
60)
+++ trunk/coregrind/pub_core_trampoline.h 2005-06-19 21:49:28 UTC (rev 39=
61)
@@ -36,6 +36,8 @@
// over the client's, for arcane signal return and syscall purposes...
//--------------------------------------------------------------------
=20
+extern Addr VG_(client_trampoline_code);
+
// Platform-specifics aren't neatly factored out here, since some of the
// constants are not used on all platforms. But it's non-obvious how
// to do it better.
|
|
From: <sv...@va...> - 2005-06-19 21:10:47
|
Author: njn
Date: 2005-06-19 22:10:42 +0100 (Sun, 19 Jun 2005)
New Revision: 3960
Log:
Moved VG_(resolve_filename{,_nodup}) from m_syswrap into m_libcfile,
so that m_aspacemgr doesn't depend on m_syswrap any more.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_libcfile.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/pub_core_libcfile.h
trunk/coregrind/pub_core_syswrap.h
Modified: trunk/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
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 19:38:03 UTC (rev =
3959)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-19 21:10:42 UTC (rev =
3960)
@@ -35,14 +35,13 @@
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
-#include "pub_core_libcfile.h" // For VG_(fstat)()
+#include "pub_core_libcfile.h"
#include "pub_core_libcmman.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_syscall.h"
-#include "pub_core_syswrap.h"
#include "pub_core_tooliface.h"
#include "pub_core_transtab.h"
#include "vki_unistd.h"
Modified: trunk/coregrind/m_libcfile.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_libcfile.c 2005-06-19 19:38:03 UTC (rev 3959)
+++ trunk/coregrind/m_libcfile.c 2005-06-19 21:10:42 UTC (rev 3960)
@@ -32,6 +32,7 @@
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
+#include "pub_core_libcprint.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_syscall.h"
@@ -69,6 +70,36 @@
return newfd;
}
=20
+/* Given a file descriptor, attempt to deduce its filename. To do
+ this, we use /proc/self/fd/<FD>. If this doesn't point to a file,
+ or if it doesn't exist, we just return NULL. The caller is
+ responsible for copying the contents of buf out immediately. */
+static HChar resolve_filename_buf[VKI_PATH_MAX];
+HChar* VG_(resolve_filename_nodup) ( Int fd )
+{
+ HChar tmp[64];
+
+ VG_(sprintf)(tmp, "/proc/self/fd/%d", fd);
+ VG_(memset)(resolve_filename_buf, 0, VKI_PATH_MAX);
+
+ if (VG_(readlink)(tmp, resolve_filename_buf, VKI_PATH_MAX) =3D=3D -1)
+ return NULL;
+
+ return (resolve_filename_buf[0] =3D=3D '/')=20
+ ? resolve_filename_buf=20
+ : NULL;
+}
+
+/* Same as resolve_filename_nodup, except that the result is copied=20
+ into new memory which the caller is responsible for freeing. */
+HChar* VG_(resolve_filename) ( Int fd )
+{
+ HChar* transient =3D VG_(resolve_filename_nodup)(fd);
+ return transient
+ ? VG_(arena_strdup)(VG_AR_CORE, transient)
+ : NULL;
+}
+
/* Returns -1 on failure. */
Int VG_(open) ( const Char* pathname, Int flags, Int mode )
{ =20
Modified: trunk/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
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2005-06-19 19:38:03 UTC (=
rev 3959)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-06-19 21:10:42 UTC (=
rev 3960)
@@ -286,7 +286,6 @@
------------------------------------------------------------------ */
=20
/* One of these is allocated for each open file descriptor. */
-
typedef struct OpenFd
{
Int fd; /* The file descriptor */
@@ -296,51 +295,13 @@
} OpenFd;
=20
/* List of allocated file descriptors. */
-
static OpenFd *allocated_fds;
=20
/* Count of open file descriptors. */
-
static int fd_count =3D 0;
=20
=20
-
-/* Given a file descriptor, attempt to deduce its filename. To do
- this, we use /proc/self/fd/<FD>. If this doesn't point to a file,
- or if it doesn't exist, we just return NULL. The caller is
- responsible for copying the contents of buf out immediately. */
-
-static HChar resolve_filename_buf[VKI_PATH_MAX];
-
-HChar* VG_(resolve_filename_nodup) ( Int fd )
-{
- HChar tmp[64];
-
- VG_(sprintf)(tmp, "/proc/self/fd/%d", fd);
- VG_(memset)(resolve_filename_buf, 0, VKI_PATH_MAX);
-
- if (VG_(readlink)(tmp, resolve_filename_buf, VKI_PATH_MAX) =3D=3D -1)
- return NULL;
-
- return (resolve_filename_buf[0] =3D=3D '/')=20
- ? resolve_filename_buf=20
- : NULL;
-}
-
-/* Same as resolve_filename_nodup, except that the result is copied=20
- into new memory which the caller is responsible for freeing. */
-
-HChar* VG_(resolve_filename) ( Int fd )
-{
- HChar* transient =3D VG_(resolve_filename_nodup)(fd);
- return transient
- ? VG_(arena_strdup)(VG_AR_CORE, transient)
- : NULL;
-}
-
-
/* Note the fact that a file descriptor was just closed. */
-
static
void record_fd_close(ThreadId tid, Int fd)
{
@@ -373,7 +334,6 @@
some such thing) or that we don't know the filename. If the fd is
already open, then we're probably doing a dup2() to an existing fd,
so just overwrite the existing one. */
-
void VG_(record_fd_open)(ThreadId tid, Int fd, char *pathname)
{
OpenFd *i;
Modified: trunk/coregrind/pub_core_libcfile.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
--- trunk/coregrind/pub_core_libcfile.h 2005-06-19 19:38:03 UTC (rev 3959=
)
+++ trunk/coregrind/pub_core_libcfile.h 2005-06-19 21:10:42 UTC (rev 3960=
)
@@ -46,6 +46,10 @@
extern Int VG_(safe_fd) ( Int oldfd );
extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg );
=20
+/* Convert an fd into a filename */
+extern HChar* VG_(resolve_filename_nodup) ( Int fd );
+extern HChar* VG_(resolve_filename) ( Int fd );
+
/* Default destination port to be used in logging over a network, if
none specified. */
#define VG_CLO_DEFAULT_LOGPORT 1500
Modified: trunk/coregrind/pub_core_syswrap.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
--- trunk/coregrind/pub_core_syswrap.h 2005-06-19 19:38:03 UTC (rev 3959)
+++ trunk/coregrind/pub_core_syswrap.h 2005-06-19 21:10:42 UTC (rev 3960)
@@ -43,9 +43,6 @@
// as if the thread had been set up by clone()
extern void VGP_(main_thread_wrapper_NORETURN)(ThreadId tid);
=20
-extern HChar* VG_(resolve_filename_nodup)(Int fd);
-extern HChar* VG_(resolve_filename)(Int fd);
-
extern void VG_(client_syscall) ( ThreadId tid );
=20
extern void VG_(post_syscall) ( ThreadId tid );
|
|
From: <sv...@va...> - 2005-06-19 19:38:26
|
Author: njn Date: 2005-06-19 20:38:03 +0100 (Sun, 19 Jun 2005) New Revision: 3959 Log: whoops Modified: trunk/coregrind/m_libcproc.c trunk/coregrind/m_main.c Modified: trunk/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 --- trunk/coregrind/m_libcproc.c 2005-06-19 19:27:07 UTC (rev 3958) +++ trunk/coregrind/m_libcproc.c 2005-06-19 19:38:03 UTC (rev 3959) @@ -48,7 +48,7 @@ Char** VG_(client_envp); =20 /* client executable file descriptor */ -Int VG_(clexecfd); +Int VG_(clexecfd) =3D -1; =20 /* Path to library directory */ const Char *VG_(libdir) =3D VG_LIBDIR; Modified: trunk/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 --- trunk/coregrind/m_main.c 2005-06-19 19:27:07 UTC (rev 3958) +++ trunk/coregrind/m_main.c 2005-06-19 19:38:03 UTC (rev 3959) @@ -115,9 +115,6 @@ /* stage1 (main) executable */ static Int vgexecfd =3D -1; =20 -/* client executable */ -Int VG_(clexecfd) =3D -1; - /* our argc/argv */ static Int vg_argc; static Char **vg_argv; |
|
From: <sv...@va...> - 2005-06-19 19:27:14
|
Author: njn Date: 2005-06-19 20:27:07 +0100 (Sun, 19 Jun 2005) New Revision: 3958 Log: Remove now-unnecessary #includes. Modified: trunk/coregrind/m_redir.c trunk/coregrind/m_translate.c Modified: trunk/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 --- trunk/coregrind/m_redir.c 2005-06-19 19:25:44 UTC (rev 3957) +++ trunk/coregrind/m_redir.c 2005-06-19 19:27:07 UTC (rev 3958) @@ -31,7 +31,6 @@ */ =20 #include "pub_core_basics.h" -#include "pub_core_threadstate.h" // needed for pub_core_main.h #include "pub_core_aspacemgr.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" Modified: trunk/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 --- trunk/coregrind/m_translate.c 2005-06-19 19:25:44 UTC (rev 3957) +++ trunk/coregrind/m_translate.c 2005-06-19 19:27:07 UTC (rev 3958) @@ -30,7 +30,6 @@ */ =20 #include "pub_core_basics.h" -#include "pub_core_threadstate.h" // needed for pub_core_main.h #include "pub_core_aspacemgr.h" #include "pub_core_cpuid.h" #include "pub_core_libcbase.h" |
|
From: <sv...@va...> - 2005-06-19 19:25:47
|
Author: njn
Date: 2005-06-19 20:25:44 +0100 (Sun, 19 Jun 2005)
New Revision: 3957
Log:
Moved VG_(start_debugger) out of m_main.c into its own module,
m_debugger. This removes the dependence of m_signals.c and m_errormgr.c
on m_main.c. It required also moving VG_(clexecfd) out of m_main.c; I p=
ut
it in m_libcproc.c which seemed like an ok-but-not-great choice.
Added:
trunk/coregrind/m_debugger.c
trunk/coregrind/pub_core_debugger.h
Modified:
trunk/coregrind/Makefile.am
trunk/coregrind/m_errormgr.c
trunk/coregrind/m_libcproc.c
trunk/coregrind/m_main.c
trunk/coregrind/m_signals.c
trunk/coregrind/pub_core_libcproc.h
trunk/coregrind/pub_core_main.h
Modified: trunk/coregrind/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/coregrind/Makefile.am 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/Makefile.am 2005-06-19 19:25:44 UTC (rev 3957)
@@ -36,6 +36,7 @@
pub_core_basics.h \
pub_core_cpuid.h \
pub_core_debuginfo.h \
+ pub_core_debugger.h \
pub_core_debuglog.h \
pub_core_demangle.h \
pub_core_dispatch.h \
@@ -95,6 +96,7 @@
=20
stage2_SOURCES =3D \
m_cpuid.S \
+ m_debugger.c \
m_debuglog.c \
m_errormgr.c \
m_execontext.c \
Added: trunk/coregrind/m_debugger.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_debugger.c 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/m_debugger.c 2005-06-19 19:25:44 UTC (rev 3957)
@@ -0,0 +1,158 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Attaching a debugger. m_debugger.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_threadstate.h"
+#include "pub_core_debugger.h"
+#include "pub_core_libcbase.h"
+#include "pub_core_libcprint.h"
+#include "pub_core_libcproc.h"
+#include "pub_core_libcsignal.h"
+#include "pub_core_options.h"
+
+// We can remove these easily by implementing our own VG_(ptrace)() and
+// VG_(fork)().
+#include <sys/ptrace.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+static Int ptrace_setregs(Int pid, VexGuestArchState* vex)
+{
+ struct vki_user_regs_struct regs;
+#if defined(VGA_x86)
+ regs.cs =3D vex->guest_CS;
+ regs.ss =3D vex->guest_SS;
+ regs.ds =3D vex->guest_DS;
+ regs.es =3D vex->guest_ES;
+ regs.fs =3D vex->guest_FS;
+ regs.gs =3D vex->guest_GS;
+ regs.eax =3D vex->guest_EAX;
+ regs.ebx =3D vex->guest_EBX;
+ regs.ecx =3D vex->guest_ECX;
+ regs.edx =3D vex->guest_EDX;
+ regs.esi =3D vex->guest_ESI;
+ regs.edi =3D vex->guest_EDI;
+ regs.ebp =3D vex->guest_EBP;
+ regs.esp =3D vex->guest_ESP;
+ regs.eflags =3D LibVEX_GuestX86_get_eflags(vex);
+ regs.eip =3D vex->guest_EIP;
+
+ return ptrace(PTRACE_SETREGS, pid, NULL, ®s);
+#elif defined(VGA_amd64)
+ I_die_here;
+#else
+# error Unknown arch
+#endif
+}
+
+/* Start debugger and get it to attach to this process. Called if the
+ user requests this service after an error has been shown, so she can
+ poke around and look at parameters, memory, etc. You can't
+ meaningfully get the debugger to continue the program, though; to
+ continue, quit the debugger. */
+void VG_(start_debugger) ( ThreadId tid )
+{
+ Int pid;
+
+ if ((pid =3D fork()) =3D=3D 0) {
+ ptrace(PTRACE_TRACEME, 0, NULL, NULL);
+ VG_(kill)(VG_(getpid)(), VKI_SIGSTOP);
+
+ } else if (pid > 0) {
+ Int status;
+ Int res;
+
+ if ((res =3D VG_(waitpid)(pid, &status, 0)) =3D=3D pid &&
+ WIFSTOPPED(status) && WSTOPSIG(status) =3D=3D SIGSTOP &&
+ ptrace_setregs(pid, &(VG_(threads)[tid].arch.vex)) =3D=3D 0 &&
+ VG_(kill)(pid, SIGSTOP) =3D=3D 0 &&
+ ptrace(PTRACE_DETACH, pid, NULL, 0) =3D=3D 0)
+ {
+ Char pidbuf[15];
+ Char file[30];
+ Char buf[100];
+ Char *bufptr;
+ Char *cmdptr;
+ =20
+ VG_(sprintf)(pidbuf, "%d", pid);
+ VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(clexecfd));
+=20
+ bufptr =3D buf;
+ cmdptr =3D VG_(clo_db_command);
+ =20
+ while (*cmdptr) {
+ switch (*cmdptr) {
+ case '%':
+ switch (*++cmdptr) {
+ case 'f':
+ VG_(memcpy)(bufptr, file, VG_(strlen)(file));
+ bufptr +=3D VG_(strlen)(file);
+ cmdptr++;
+ break;
+ case 'p':
+ VG_(memcpy)(bufptr, pidbuf, VG_(strlen)(pidbuf));
+ bufptr +=3D VG_(strlen)(pidbuf);
+ cmdptr++;
+ break;
+ default:
+ *bufptr++ =3D *cmdptr++;
+ break;
+ }
+ break;
+ default:
+ *bufptr++ =3D *cmdptr++;
+ break;
+ }
+ }
+ =20
+ *bufptr++ =3D '\0';
+ =20
+ VG_(message)(Vg_UserMsg, "starting debugger with cmd: %s", buf)=
;
+ res =3D VG_(system)(buf);
+ if (res =3D=3D 0) { =20
+ VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg,=20
+ "Debugger has detached. Valgrind regains contr=
ol. We continue.");
+ } else {
+ VG_(message)(Vg_UserMsg, "Apparently failed!");
+ VG_(message)(Vg_UserMsg, "");
+ }
+ }
+
+ VG_(kill)(pid, VKI_SIGKILL);
+ VG_(waitpid)(pid, &status, 0);
+ }
+}
+
+
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_errormgr.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_errormgr.c 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/m_errormgr.c 2005-06-19 19:25:44 UTC (rev 3957)
@@ -29,7 +29,8 @@
*/
=20
#include "pub_core_basics.h"
-#include "pub_core_threadstate.h" // needed for pub_core_main.h
+#include "pub_core_threadstate.h"
+#include "pub_core_debugger.h"
#include "pub_core_debuginfo.h"
#include "pub_core_errormgr.h"
#include "pub_core_execontext.h"
@@ -38,7 +39,6 @@
#include "pub_core_libcfile.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
-#include "pub_core_main.h" // for VG_(start_debugger)()
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_stacktrace.h"
Modified: trunk/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
--- trunk/coregrind/m_libcproc.c 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/m_libcproc.c 2005-06-19 19:25:44 UTC (rev 3957)
@@ -47,6 +47,9 @@
Char** VG_(client_argv);
Char** VG_(client_envp);
=20
+/* client executable file descriptor */
+Int VG_(clexecfd);
+
/* Path to library directory */
const Char *VG_(libdir) =3D VG_LIBDIR;
=20
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/m_main.c 2005-06-19 19:25:44 UTC (rev 3957)
@@ -63,8 +63,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/ptrace.h>
-#include <sys/wait.h>
#include <unistd.h>
=20
#include "memcheck/memcheck.h"
@@ -148,119 +146,6 @@
=20
=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=3D=3D=3D=3D=3D=3D*/
-/*=3D=3D=3D Miscellaneous global functions =
=3D=3D=3D*/
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
-
-static Int ptrace_setregs(Int pid, VexGuestArchState* vex)
-{
- struct vki_user_regs_struct regs;
-#if defined(VGA_x86)
- regs.cs =3D vex->guest_CS;
- regs.ss =3D vex->guest_SS;
- regs.ds =3D vex->guest_DS;
- regs.es =3D vex->guest_ES;
- regs.fs =3D vex->guest_FS;
- regs.gs =3D vex->guest_GS;
- regs.eax =3D vex->guest_EAX;
- regs.ebx =3D vex->guest_EBX;
- regs.ecx =3D vex->guest_ECX;
- regs.edx =3D vex->guest_EDX;
- regs.esi =3D vex->guest_ESI;
- regs.edi =3D vex->guest_EDI;
- regs.ebp =3D vex->guest_EBP;
- regs.esp =3D vex->guest_ESP;
- regs.eflags =3D LibVEX_GuestX86_get_eflags(vex);
- regs.eip =3D vex->guest_EIP;
-
- return ptrace(PTRACE_SETREGS, pid, NULL, ®s);
-#elif defined(VGA_amd64)
- I_die_here;
-#else
-# error Unknown arch
-#endif
-}
-
-/* Start debugger and get it to attach to this process. Called if the
- user requests this service after an error has been shown, so she can
- poke around and look at parameters, memory, etc. You can't
- meaningfully get the debugger to continue the program, though; to
- continue, quit the debugger. */
-void VG_(start_debugger) ( ThreadId tid )
-{
- Int pid;
-
- if ((pid =3D fork()) =3D=3D 0) {
- ptrace(PTRACE_TRACEME, 0, NULL, NULL);
- VG_(kill)(VG_(getpid)(), VKI_SIGSTOP);
-
- } else if (pid > 0) {
- Int status;
- Int res;
-
- if ((res =3D VG_(waitpid)(pid, &status, 0)) =3D=3D pid &&
- WIFSTOPPED(status) && WSTOPSIG(status) =3D=3D SIGSTOP &&
- ptrace_setregs(pid, &(VG_(threads)[tid].arch.vex)) =3D=3D 0 &&
- kill(pid, SIGSTOP) =3D=3D 0 &&
- ptrace(PTRACE_DETACH, pid, NULL, 0) =3D=3D 0)
- {
- Char pidbuf[15];
- Char file[30];
- Char buf[100];
- Char *bufptr;
- Char *cmdptr;
- =20
- VG_(sprintf)(pidbuf, "%d", pid);
- VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(clexecfd));
-=20
- bufptr =3D buf;
- cmdptr =3D VG_(clo_db_command);
- =20
- while (*cmdptr) {
- switch (*cmdptr) {
- case '%':
- switch (*++cmdptr) {
- case 'f':
- VG_(memcpy)(bufptr, file, VG_(strlen)(file));
- bufptr +=3D VG_(strlen)(file);
- cmdptr++;
- break;
- case 'p':
- VG_(memcpy)(bufptr, pidbuf, VG_(strlen)(pidbuf));
- bufptr +=3D VG_(strlen)(pidbuf);
- cmdptr++;
- break;
- default:
- *bufptr++ =3D *cmdptr++;
- break;
- }
- break;
- default:
- *bufptr++ =3D *cmdptr++;
- break;
- }
- }
- =20
- *bufptr++ =3D '\0';
- =20
- VG_(message)(Vg_UserMsg, "starting debugger with cmd: %s", buf)=
;
- res =3D VG_(system)(buf);
- if (res =3D=3D 0) { =20
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,=20
- "Debugger has detached. Valgrind regains contr=
ol. We continue.");
- } else {
- VG_(message)(Vg_UserMsg, "Apparently failed!");
- VG_(message)(Vg_UserMsg, "");
- }
- }
-
- VG_(kill)(pid, VKI_SIGKILL);
- VG_(waitpid)(pid, &status, 0);
- }
-}
-
-
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/*=3D=3D=3D Check we were launched by stage 1 =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
Modified: trunk/coregrind/m_signals.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_signals.c 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/m_signals.c 2005-06-19 19:25:44 UTC (rev 3957)
@@ -82,6 +82,7 @@
#include "pub_core_basics.h"
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
+#include "pub_core_debugger.h"
#include "pub_core_errormgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
@@ -90,7 +91,6 @@
#include "pub_core_libcproc.h"
#include "pub_core_libcsignal.h"
#include "pub_core_machine.h"
-#include "pub_core_main.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_scheduler.h"
Added: trunk/coregrind/pub_core_debugger.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
--- trunk/coregrind/pub_core_debugger.h 2005-06-19 18:58:03 UTC (rev 3956=
)
+++ trunk/coregrind/pub_core_debugger.h 2005-06-19 19:25:44 UTC (rev 3957=
)
@@ -0,0 +1,45 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Attaching a debugger. pub_core_debugger.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_CORE_DEBUGGER_H
+#define __PUB_CORE_DEBUGGER_H
+
+//--------------------------------------------------------------------
+// PURPOSE: This simple module just deals with attaching a debugger to t=
he
+// running program.
+//--------------------------------------------------------------------
+
+extern void VG_(start_debugger) ( ThreadId tid );
+
+#endif // __PUB_CORE_DEBUGGER_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/pub_core_libcproc.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
--- trunk/coregrind/pub_core_libcproc.h 2005-06-19 18:58:03 UTC (rev 3956=
)
+++ trunk/coregrind/pub_core_libcproc.h 2005-06-19 19:25:44 UTC (rev 3957=
)
@@ -58,6 +58,9 @@
client environment. */
#define VALGRINDCLO "_VALGRIND_CLO"
=20
+// Client's executable file descriptor.
+extern Int VG_(clexecfd);
+
// Client's original rlimit data and rlimit stack
extern struct vki_rlimit VG_(client_rlimit_data);
extern struct vki_rlimit VG_(client_rlimit_stack);
Modified: trunk/coregrind/pub_core_main.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
--- trunk/coregrind/pub_core_main.h 2005-06-19 18:58:03 UTC (rev 3956)
+++ trunk/coregrind/pub_core_main.h 2005-06-19 19:25:44 UTC (rev 3957)
@@ -38,16 +38,10 @@
// things.
//--------------------------------------------------------------------
=20
-/* client executable file descriptor */
-extern Int VG_(clexecfd);
-
// Help set up the child used when doing execve() with --trace-children=3D=
yes
Char* VG_(build_child_VALGRINDCLO) ( Char* exename );
Char* VG_(build_child_exename) ( void );
=20
-/* Something of a function looking for a home ... start up debugger. */
-extern void VG_(start_debugger) ( ThreadId tid );
-
// Do everything which needs doing before the process finally ends,
// like printing reports, etc
extern void VG_(shutdown_actions_NORETURN) (
|
|
From: <sv...@va...> - 2005-06-19 18:58:06
|
Author: njn
Date: 2005-06-19 19:58:03 +0100 (Sun, 19 Jun 2005)
New Revision: 3956
Log:
Fix up the libc_freeres_wrapper code so that m_main depends on m_redir,
not the other way around.
Modified:
trunk/coregrind/m_main.c
trunk/coregrind/m_redir.c
trunk/coregrind/pub_core_main.h
trunk/coregrind/pub_core_redir.h
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/m_main.c 2005-06-19 18:58:03 UTC (rev 3956)
@@ -2759,26 +2759,19 @@
}
=20
=20
-/* The we need to know the address of it so it can be
- called at program exit. */
-static Addr __libc_freeres_wrapper;
-
-void VG_(set_libc_freeres_wrapper_addr)(Addr addr)
-{
- __libc_freeres_wrapper =3D addr;
-}
-
/* Final clean-up before terminating the process. =20
Clean up the client by calling __libc_freeres() (if requested)=20
This is Linux-specific?
*/
static void final_tidyup(ThreadId tid)
{
+ Addr __libc_freeres_wrapper;
+
vg_assert(VG_(is_running_thread)(tid));
=20
- if (!VG_(needs).libc_freeres ||
- !VG_(clo_run_libc_freeres) ||
- __libc_freeres_wrapper =3D=3D 0)
+ if ( !VG_(needs).libc_freeres ||
+ !VG_(clo_run_libc_freeres) ||
+ 0 =3D=3D (__libc_freeres_wrapper =3D VG_(get_libc_freeres_wrappe=
r)()) )
return; /* can't/won't do it */
=20
if (VG_(clo_verbosity) > 2 ||
Modified: trunk/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
--- trunk/coregrind/m_redir.c 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/m_redir.c 2005-06-19 18:58:03 UTC (rev 3956)
@@ -36,7 +36,6 @@
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-#include "pub_core_main.h" // for VG_(set_libc_freeres_wrapper_add=
r)
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_redir.h"
@@ -512,6 +511,13 @@
VG_(arena_free)(VG_AR_SYMTAB, lib);
}
=20
+static Addr __libc_freeres_wrapper =3D 0;
+
+Addr VG_(get_libc_freeres_wrapper)(void)
+{
+ return __libc_freeres_wrapper;
+}
+
// This is specifically for stringifying VG_(x) function names. We
// need to do two macroexpansions to get the VG_ macro expanded before
// stringifying.
@@ -521,7 +527,7 @@
static void handle_load_notifier( Char* symbol, Addr addr )
{
if (VG_(strcmp)(symbol, STR(VG_NOTIFY_ON_LOAD(freeres))) =3D=3D 0)
- VG_(set_libc_freeres_wrapper_addr)(addr);
+ __libc_freeres_wrapper =3D addr;
// else if (VG_(strcmp)(symbol, STR(VG_WRAPPER(pthread_startfunc_wrapp=
er))) =3D=3D 0)
// VG_(pthread_startfunc_wrapper)((Addr)(si->offset + sym->st_value=
));
else
Modified: trunk/coregrind/pub_core_main.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
--- trunk/coregrind/pub_core_main.h 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/pub_core_main.h 2005-06-19 18:58:03 UTC (rev 3956)
@@ -48,9 +48,6 @@
/* Something of a function looking for a home ... start up debugger. */
extern void VG_(start_debugger) ( ThreadId tid );
=20
-// Set up the libc freeres wrapper=20
-extern void VG_(set_libc_freeres_wrapper_addr)(Addr);
-
// Do everything which needs doing before the process finally ends,
// like printing reports, etc
extern void VG_(shutdown_actions_NORETURN) (
Modified: trunk/coregrind/pub_core_redir.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
--- trunk/coregrind/pub_core_redir.h 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/pub_core_redir.h 2005-06-19 18:58:03 UTC (rev 3956)
@@ -89,6 +89,8 @@
#define VG_NOTIFY_ON_LOAD_PREFIX "_vgw_"
#define VG_NOTIFY_ON_LOAD_PREFIX_LEN 5
=20
+// Called by m_main to get our __libc_freeres wrapper.
+extern Addr VG_(get_libc_freeres_wrapper)(void);
=20
//--------------------------------------------------------------------
// Function wrapping
|
|
From: <sv...@va...> - 2005-06-19 18:49:22
|
Author: njn
Date: 2005-06-19 19:49:19 +0100 (Sun, 19 Jun 2005)
New Revision: 3955
Log:
Move VG_(sanity_check_general) out of m_main.c into scheduler.c.
Removes the dependence of m_scheduler/ on m_main.c; reduces the=20
dependence of m_signals.c on m_main.c.
Modified:
trunk/coregrind/m_main.c
trunk/coregrind/m_scheduler/scheduler.c
trunk/coregrind/pub_core_aspacemgr.h
trunk/coregrind/pub_core_main.h
trunk/coregrind/pub_core_scheduler.h
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 18:38:24 UTC (rev 3954)
+++ trunk/coregrind/m_main.c 2005-06-19 18:49:19 UTC (rev 3955)
@@ -129,22 +129,10 @@
/*=3D=3D=3D Counters, for profiling purposes only =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
-/* Counts pertaining to internal sanity checking. */
-static UInt sanity_fast_count =3D 0;
-static UInt sanity_slow_count =3D 0;
-
static void print_all_stats ( void )
{
- // Translation stats
VG_(print_tt_tc_stats)();
-
- // Scheduler stats
VG_(print_scheduler_stats)();
-
- VG_(message)(Vg_DebugMsg,=20
- " sanity: %d cheap, %d expensive checks.",
- sanity_fast_count, sanity_slow_count );
-
VG_(print_ExeContext_stats)();
=20
// Memory stats
@@ -155,7 +143,6 @@
VG_(sanity_check_malloc_all)();
VG_(print_all_arena_stats)();
VG_(message)(Vg_DebugMsg, "");
- //VG_(print_shadow_stats)();
}
}
=20
@@ -2310,96 +2297,6 @@
=20
=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=3D=3D=3D=3D=3D=3D*/
-/*=3D=3D=3D Sanity check machinery (permanently engaged) =
=3D=3D=3D*/
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
-
-/* A fast sanity check -- suitable for calling circa once per
- millisecond. */
-
-void VG_(sanity_check_general) ( Bool force_expensive )
-{
- ThreadId tid;
-
- VGP_PUSHCC(VgpCoreCheapSanity);
-
- if (VG_(clo_sanity_level) < 1) return;
-
- /* --- First do all the tests that we can do quickly. ---*/
-
- sanity_fast_count++;
-
- /* Check stuff pertaining to the memory check system. */
-
- /* Check that nobody has spuriously claimed that the first or
- last 16 pages of memory have become accessible [...] */
- if (VG_(needs).sanity_checks) {
- VGP_PUSHCC(VgpToolCheapSanity);
- vg_assert(VG_TDICT_CALL(tool_cheap_sanity_check));
- VGP_POPCC(VgpToolCheapSanity);
- }
-
- /* --- Now some more expensive checks. ---*/
-
- /* Once every 25 times, check some more expensive stuff. */
- if ( force_expensive
- || VG_(clo_sanity_level) > 1
- || (VG_(clo_sanity_level) =3D=3D 1 && (sanity_fast_count % 25) =3D=3D=
0)) {
-
- VGP_PUSHCC(VgpCoreExpensiveSanity);
- sanity_slow_count++;
-
-# if 0
- { void zzzmemscan(void); zzzmemscan(); }
-# endif
-
- if ((sanity_fast_count % 250) =3D=3D 0)
- VG_(sanity_check_tt_tc)("VG_(sanity_check_general)");
-
- if (VG_(needs).sanity_checks) {
- VGP_PUSHCC(VgpToolExpensiveSanity);
- vg_assert(VG_TDICT_CALL(tool_expensive_sanity_check));
- VGP_POPCC(VgpToolExpensiveSanity);
- }
-
- /* Check that Segments and /proc/self/maps match up */
- //vg_assert(VG_(sanity_check_memory)());
-
- /* Look for stack overruns. Visit all threads. */
- for(tid =3D 1; tid < VG_N_THREADS; tid++) {
- SSizeT remains;
-
- if (VG_(threads)[tid].status =3D=3D VgTs_Empty ||
- VG_(threads)[tid].status =3D=3D VgTs_Zombie)
- continue;
-
- remains =3D VGA_(stack_unused)(tid);
- if (remains < VKI_PAGE_SIZE)
- VG_(message)(Vg_DebugMsg,=20
- "WARNING: Thread %d is within %d bytes "
- "of running out of stack!",
- tid, remains);
- }
-
- /*=20
- if ((sanity_fast_count % 500) =3D=3D 0) VG_(mallocSanityCheckAll)(=
);=20
- */
- VGP_POPCC(VgpCoreExpensiveSanity);
- }
-
- if (VG_(clo_sanity_level) > 1) {
- VGP_PUSHCC(VgpCoreExpensiveSanity);
- /* Check sanity of the low-level memory manager. Note that bugs
- in the client's code can cause this to fail, so we don't do
- this check unless specially asked for. And because it's
- potentially very expensive. */
- VG_(sanity_check_malloc_all)();
- VGP_POPCC(VgpCoreExpensiveSanity);
- }
- VGP_POPCC(VgpCoreCheapSanity);
-}
-
-
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/*=3D=3D=3D main() =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
Modified: trunk/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
--- trunk/coregrind/m_scheduler/scheduler.c 2005-06-19 18:38:24 UTC (rev =
3954)
+++ trunk/coregrind/m_scheduler/scheduler.c 2005-06-19 18:49:19 UTC (rev =
3955)
@@ -71,7 +71,6 @@
#include "pub_core_libcproc.h"
#include "pub_core_libcsignal.h"
#include "pub_core_machine.h"
-#include "pub_core_main.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_profile.h"
@@ -116,6 +115,9 @@
static UInt n_scheduling_events_MINOR =3D 0;
static UInt n_scheduling_events_MAJOR =3D 0;
=20
+/* Sanity checking counts. */
+static UInt sanity_fast_count =3D 0;
+static UInt sanity_slow_count =3D 0;
=20
void VG_(print_scheduler_stats)(void)
{
@@ -124,6 +126,9 @@
VG_(message)(Vg_DebugMsg,
"scheduler: %d/%d major/minor sched events.",=20
n_scheduling_events_MAJOR, n_scheduling_events_MINOR);
+ VG_(message)(Vg_DebugMsg,=20
+ " sanity: %d cheap, %d expensive checks.",
+ sanity_fast_count, sanity_slow_count );
}
=20
/* CPU semaphore, so that threads can run exclusively */
@@ -1031,7 +1036,7 @@
=20
=20
/* ---------------------------------------------------------------------
- Sanity checking.
+ Sanity checking (permanently engaged)
------------------------------------------------------------------ */
=20
/* Internal consistency checks on the sched structures. */
@@ -1055,7 +1060,88 @@
}
}
=20
+void VG_(sanity_check_general) ( Bool force_expensive )
+{
+ ThreadId tid;
=20
+ VGP_PUSHCC(VgpCoreCheapSanity);
+
+ if (VG_(clo_sanity_level) < 1) return;
+
+ /* --- First do all the tests that we can do quickly. ---*/
+
+ sanity_fast_count++;
+
+ /* Check stuff pertaining to the memory check system. */
+
+ /* Check that nobody has spuriously claimed that the first or
+ last 16 pages of memory have become accessible [...] */
+ if (VG_(needs).sanity_checks) {
+ VGP_PUSHCC(VgpToolCheapSanity);
+ vg_assert(VG_TDICT_CALL(tool_cheap_sanity_check));
+ VGP_POPCC(VgpToolCheapSanity);
+ }
+
+ /* --- Now some more expensive checks. ---*/
+
+ /* Once every 25 times, check some more expensive stuff. */
+ if ( force_expensive
+ || VG_(clo_sanity_level) > 1
+ || (VG_(clo_sanity_level) =3D=3D 1 && (sanity_fast_count % 25) =3D=3D=
0)) {
+
+ VGP_PUSHCC(VgpCoreExpensiveSanity);
+ sanity_slow_count++;
+
+# if 0
+ { void zzzmemscan(void); zzzmemscan(); }
+# endif
+
+ if ((sanity_fast_count % 250) =3D=3D 0)
+ VG_(sanity_check_tt_tc)("VG_(sanity_check_general)");
+
+ if (VG_(needs).sanity_checks) {
+ VGP_PUSHCC(VgpToolExpensiveSanity);
+ vg_assert(VG_TDICT_CALL(tool_expensive_sanity_check));
+ VGP_POPCC(VgpToolExpensiveSanity);
+ }
+
+ /* Check that Segments and /proc/self/maps match up */
+ //vg_assert(VG_(sanity_check_memory)());
+
+ /* Look for stack overruns. Visit all threads. */
+ for(tid =3D 1; tid < VG_N_THREADS; tid++) {
+ SSizeT remains;
+
+ if (VG_(threads)[tid].status =3D=3D VgTs_Empty ||
+ VG_(threads)[tid].status =3D=3D VgTs_Zombie)
+ continue;
+
+ remains =3D VGA_(stack_unused)(tid);
+ if (remains < VKI_PAGE_SIZE)
+ VG_(message)(Vg_DebugMsg,=20
+ "WARNING: Thread %d is within %d bytes "
+ "of running out of stack!",
+ tid, remains);
+ }
+
+ /*=20
+ if ((sanity_fast_count % 500) =3D=3D 0) VG_(mallocSanityCheckAll)(=
);=20
+ */
+ VGP_POPCC(VgpCoreExpensiveSanity);
+ }
+
+ if (VG_(clo_sanity_level) > 1) {
+ VGP_PUSHCC(VgpCoreExpensiveSanity);
+ /* Check sanity of the low-level memory manager. Note that bugs
+ in the client's code can cause this to fail, so we don't do
+ this check unless specially asked for. And because it's
+ potentially very expensive. */
+ VG_(sanity_check_malloc_all)();
+ VGP_POPCC(VgpCoreExpensiveSanity);
+ }
+ VGP_POPCC(VgpCoreCheapSanity);
+}
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/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
--- trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 18:38:24 UTC (rev 395=
4)
+++ trunk/coregrind/pub_core_aspacemgr.h 2005-06-19 18:49:19 UTC (rev 395=
5)
@@ -149,8 +149,6 @@
extern Addr VG_(get_memory_from_mmap_for_client)
(Addr base, SizeT len, UInt prot, UInt flags);
=20
-//extern void VG_(print_shadow_stats)();
-
/* Parses /proc/self/maps, calling `record_mapping' for each entry. */
extern=20
void VG_(parse_procselfmaps) (
Modified: trunk/coregrind/pub_core_main.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
--- trunk/coregrind/pub_core_main.h 2005-06-19 18:38:24 UTC (rev 3954)
+++ trunk/coregrind/pub_core_main.h 2005-06-19 18:49:19 UTC (rev 3955)
@@ -38,9 +38,6 @@
// things.
//--------------------------------------------------------------------
=20
-/* Sanity checks which may be done at any time. The scheduler decides w=
hen. */
-extern void VG_(sanity_check_general) ( Bool force_expensive );
-
/* client executable file descriptor */
extern Int VG_(clexecfd);
=20
Modified: trunk/coregrind/pub_core_scheduler.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
--- trunk/coregrind/pub_core_scheduler.h 2005-06-19 18:38:24 UTC (rev 395=
4)
+++ trunk/coregrind/pub_core_scheduler.h 2005-06-19 18:49:19 UTC (rev 395=
5)
@@ -86,6 +86,9 @@
/* If true, a fault is Valgrind-internal (ie, a bug) */
extern Bool VG_(my_fault);
=20
+/* Sanity checks which may be done at any time. The scheduler decides w=
hen. */
+extern void VG_(sanity_check_general) ( Bool force_expensive );
+
#endif // __PUB_CORE_SCHEDULER_H
=20
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2005-06-19 18:38:27
|
Author: njn
Date: 2005-06-19 19:38:24 +0100 (Sun, 19 Jun 2005)
New Revision: 3954
Log:
Move VG_(bbs_done) out of main and make it local in scheduler.c. This
removes the dependence of m_translate.c and m_libcassert.c on m_main.c.
Modified:
trunk/coregrind/m_errormgr.c
trunk/coregrind/m_libcassert.c
trunk/coregrind/m_main.c
trunk/coregrind/m_scheduler/scheduler.c
trunk/coregrind/m_translate.c
trunk/coregrind/m_transtab.c
trunk/coregrind/pub_core_main.h
trunk/coregrind/pub_core_translate.h
Modified: trunk/coregrind/m_errormgr.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_errormgr.c 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/m_errormgr.c 2005-06-19 18:38:24 UTC (rev 3954)
@@ -750,7 +750,8 @@
if ((i+1 =3D=3D VG_(clo_dump_error))) {
StackTrace ips =3D VG_(extract_StackTrace)(p_min->where);
VG_(translate) ( 0 /* dummy ThreadId; irrelevant due to debuggi=
ng*/,
- ips[0], /*debugging*/True, 0xFE/*verbosity*/);
+ ips[0], /*debugging*/True, 0xFE/*verbosity*/,
+ /*bbs_done*/0);
}
=20
p_min->count =3D 1 << 30;
Modified: trunk/coregrind/m_libcassert.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_libcassert.c 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/m_libcassert.c 2005-06-19 18:38:24 UTC (rev 3954)
@@ -34,8 +34,7 @@
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
-#include "pub_core_main.h" // for VG_(bbs_done) -- stupid!
-#include "pub_core_options.h" // for VG_(bbs_done) -- stupid!
+#include "pub_core_options.h"
#include "pub_core_stacktrace.h"
#include "pub_core_syscall.h"
#include "pub_core_tooliface.h"
@@ -110,7 +109,9 @@
VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop);
VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH);
=20
- VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done=
) );
+ // Don't print this, as it's not terribly interesting and avoids a
+ // dependence on m_scheduler/, which would be crazy.
+ //VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_do=
ne) );
=20
pp_sched_status();
VG_(printf)("\n");
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/m_main.c 2005-06-19 18:38:24 UTC (rev 3954)
@@ -125,14 +125,6 @@
static Char **vg_argv;
=20
=20
-/* ---------------------------------------------------------------------
- Running stuff =20
- ------------------------------------------------------------------ */
-
-/* 64-bit counter for the number of basic blocks done. */
-ULong VG_(bbs_done) =3D 0;
-
-
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/*=3D=3D=3D Counters, for profiling purposes only =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
@@ -145,8 +137,6 @@
{
// Translation stats
VG_(print_tt_tc_stats)();
- VG_(message)(Vg_DebugMsg,
- " dispatch: %llu jumps (bb entries).", VG_(bbs_done) );
=20
// Scheduler stats
VG_(print_scheduler_stats)();
Modified: trunk/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
--- trunk/coregrind/m_scheduler/scheduler.c 2005-06-19 17:52:41 UTC (rev =
3953)
+++ trunk/coregrind/m_scheduler/scheduler.c 2005-06-19 18:38:24 UTC (rev =
3954)
@@ -104,6 +104,9 @@
/* Counts downwards in VG_(run_innerloop). */
UInt VG_(dispatch_ctr);
=20
+/* 64-bit counter for the number of basic blocks done. */
+static ULong bbs_done =3D 0;
+
/* Forwards */
static void do_client_request ( ThreadId tid );
static void scheduler_sanity ( ThreadId tid );
@@ -117,7 +120,9 @@
void VG_(print_scheduler_stats)(void)
{
VG_(message)(Vg_DebugMsg,
- " %d/%d major/minor sched events.",=20
+ "scheduler: %llu jumps (bb entries).", bbs_done );
+ VG_(message)(Vg_DebugMsg,
+ "scheduler: %d/%d major/minor sched events.",=20
n_scheduling_events_MAJOR, n_scheduling_events_MINOR);
}
=20
@@ -419,7 +424,7 @@
done_this_time =3D (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) -=
0;
=20
vg_assert(done_this_time >=3D 0);
- VG_(bbs_done) +=3D (ULong)done_this_time;
+ bbs_done +=3D (ULong)done_this_time;
=20
VGP_POPCC(VgpRun);
return trc;
@@ -561,7 +566,7 @@
found =3D VG_(search_transtab)( NULL, ip, True/*upd_fast_cache*/ );
if (!found) {
/* Not found; we need to request a translation. */
- if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/ )) {
+ if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/, bbs=
_done )) {
found =3D VG_(search_transtab)( NULL, ip, True );=20
vg_assert2(found, "VG_TRC_INNER_FASTMISS: missing tt_fast entry=
");
=20
Modified: trunk/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
--- trunk/coregrind/m_translate.c 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/m_translate.c 2005-06-19 18:38:24 UTC (rev 3954)
@@ -36,7 +36,6 @@
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-#include "pub_core_main.h" // for VG_(bbs_done)
#include "pub_core_options.h"
#include "pub_core_profile.h"
#include "pub_core_redir.h"
@@ -417,7 +416,8 @@
Bool VG_(translate) ( ThreadId tid,=20
Addr64 orig_addr,
Bool debugging_translation,
- Int debugging_verbosity )
+ Int debugging_verbosity,
+ ULong bbs_done )
{
Addr64 redir, orig_addr0 =3D orig_addr;
Int tmpbuf_used, verbosity;
@@ -501,9 +501,9 @@
Char fnname[64] =3D "";
VG_(get_fnname_w_offset)(orig_addr, fnname, 64);
VG_(printf)(
- "=3D=3D=3D=3D BB %d %s(0x%llx) approx BBs exec'd %lld =3D=3D=
=3D=3D\n",
+ "=3D=3D=3D=3D BB %d %s(0x%llx) BBs exec'd %lld =3D=3D=3D=3D=
\n",
VG_(get_bbs_translated)(), fnname, orig_addr,=20
- VG_(bbs_done));
+ bbs_done);
}
=20
if (seg =3D=3D NULL ||
Modified: trunk/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
--- trunk/coregrind/m_transtab.c 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/m_transtab.c 2005-06-19 18:38:24 UTC (rev 3954)
@@ -798,7 +798,7 @@
score_cumul, buf_cumul,
score_here, buf_here, tops[r]->entry, name );
VG_(printf)("\n");
- VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags));
+ VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags), 0)=
;
VG_(printf)("=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=
end BB rank %d "
"=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=
\n\n", r);
}
Modified: trunk/coregrind/pub_core_main.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
--- trunk/coregrind/pub_core_main.h 2005-06-19 17:52:41 UTC (rev 3953)
+++ trunk/coregrind/pub_core_main.h 2005-06-19 18:38:24 UTC (rev 3954)
@@ -51,9 +51,6 @@
/* Something of a function looking for a home ... start up debugger. */
extern void VG_(start_debugger) ( ThreadId tid );
=20
-/* 64-bit counter for the number of basic blocks done. */
-extern ULong VG_(bbs_done);
-
// Set up the libc freeres wrapper=20
extern void VG_(set_libc_freeres_wrapper_addr)(Addr);
=20
Modified: trunk/coregrind/pub_core_translate.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
--- trunk/coregrind/pub_core_translate.h 2005-06-19 17:52:41 UTC (rev 395=
3)
+++ trunk/coregrind/pub_core_translate.h 2005-06-19 18:38:24 UTC (rev 395=
4)
@@ -40,7 +40,8 @@
Bool VG_(translate) ( ThreadId tid,=20
Addr64 orig_addr,
Bool debugging_translation,
- Int debugging_verbosity );
+ Int debugging_verbosity,
+ ULong bbs_done );
=20
#endif // __PUB_CORE_TRANSLATE_H
=20
|
|
From: <sv...@va...> - 2005-06-19 17:53:27
|
Author: rjwalsh Date: 2005-06-19 18:52:41 +0100 (Sun, 19 Jun 2005) New Revision: 3953 Log: Fix AMD64 build. Modified: trunk/include/vki-amd64-linux.h Modified: trunk/include/vki-amd64-linux.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 --- trunk/include/vki-amd64-linux.h 2005-06-19 16:14:06 UTC (rev 3952) +++ trunk/include/vki-amd64-linux.h 2005-06-19 17:52:41 UTC (rev 3953) @@ -220,6 +220,7 @@ #define VKI_MAP_PRIVATE 0x02 /* Changes are private */ #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ +#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations = */ =20 //---------------------------------------------------------------------- // From linux-2.6.9/include/asm-x86_64/fcntl.h |
|
From: <sv...@va...> - 2005-06-19 16:14:08
|
Author: sewardj
Date: 2005-06-19 17:14:06 +0100 (Sun, 19 Jun 2005)
New Revision: 3952
Log:
Get rid of the ELFSZ define, which is created at the configure stage
and use VG_WORDSIZE, as that is used everywhere else.
Modified:
trunk/configure.in
trunk/coregrind/ume.c
trunk/memcheck/tests/vgtest_ume.c
Modified: trunk/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/configure.in 2005-06-19 16:10:47 UTC (rev 3951)
+++ trunk/configure.in 2005-06-19 16:14:06 UTC (rev 3952)
@@ -104,7 +104,7 @@
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH=3D"x86"
KICKSTART_BASE=3D"0xb0000000"
- ARCH_CORE_AM_CFLAGS=3D"@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ -DE=
LFSZ=3D32"
+ ARCH_CORE_AM_CFLAGS=3D"@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
ARCH_TOOL_AM_CFLAGS=3D"@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
ARCH_CORE_AM_CCASFLAGS=3D"@FLAG_M32@"
;;
@@ -116,7 +116,7 @@
# quantities; therefore going above 0x7fffffff doesn't work... t=
his is
# a problem.
KICKSTART_BASE=3D"0x70000000"
- ARCH_CORE_AM_CFLAGS=3D"-m64 -fomit-frame-pointer @PREFERRED_STAC=
K_BOUNDARY@ -DELFSZ=3D64"=20
+ ARCH_CORE_AM_CFLAGS=3D"-m64 -fomit-frame-pointer @PREFERRED_STAC=
K_BOUNDARY@"=20
# XXX: need to use -fpic, otherwise when linking tools I get thi=
s error
# message:
# relocation R_X86_64_32 can not be used when making a shared =
object;
@@ -131,7 +131,7 @@
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH=3D"arm"
KICKSTART_BASE=3D"0xb0000000"
- ARCH_CORE_AM_CFLAGS=3D"-fomit-frame-pointer @PREFERRED_STACK_BOU=
NDARY@ -DELFSZ=3D32"
+ ARCH_CORE_AM_CFLAGS=3D"-fomit-frame-pointer @PREFERRED_STACK_BOU=
NDARY@"
ARCH_TOOL_AM_CFLAGS=3D"-fomit-frame-pointer @PREFERRED_STACK_BOU=
NDARY@"
ARCH_CORE_AM_CCASFLAGS=3D""
;;
@@ -140,7 +140,7 @@
AC_MSG_RESULT([no (${host_cpu})])
VG_ARCH=3D"ppc"
KICKSTART_BASE=3D"0x70000000"
- ARCH_CORE_AM_CFLAGS=3D"-DELFSZ=3D32"
+ ARCH_CORE_AM_CFLAGS=3D""
ARCH_TOOL_AM_CFLAGS=3D"-fpic"
ARCH_CORE_AM_CCASFLAGS=3D"-Wa,-maltivec"
AC_MSG_ERROR([PowerPC not supported. Sorry])
Modified: trunk/coregrind/ume.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/ume.c 2005-06-19 16:10:47 UTC (rev 3951)
+++ trunk/coregrind/ume.c 2005-06-19 16:14:06 UTC (rev 3952)
@@ -51,12 +51,12 @@
#include <unistd.h>
#include <assert.h>
=20
-#if ELFSZ =3D=3D 64
+#if VG_WORDSIZE =3D=3D 8
#define ESZ(x) Elf64_##x
-#elif ELFSZ =3D=3D 32
+#elif VG_WORDSIZE =3D=3D 4
#define ESZ(x) Elf32_##x
#else
-#error ELFSZ needs to =3D=3D32 or =3D=3D64
+#error VG_WORDSIZE needs to =3D=3D4 or =3D=3D8
#endif
=20
struct elfinfo
Modified: trunk/memcheck/tests/vgtest_ume.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/vgtest_ume.c 2005-06-19 16:10:47 UTC (rev 3951)
+++ trunk/memcheck/tests/vgtest_ume.c 2005-06-19 16:14:06 UTC (rev 3952)
@@ -1,4 +1,3 @@
-#define ELFSZ 32
=20
// This file is a unit self-test for ume.c, jmp_with_stack.c
=20
|
|
From: <sv...@va...> - 2005-06-19 16:10:51
|
Author: njn
Date: 2005-06-19 17:10:47 +0100 (Sun, 19 Jun 2005)
New Revision: 3951
Log:
Removed dependency on <sys/mman.h> by using our own versions of
mmap/munmap. Required making VG_(munmap_native) public.
Modified:
trunk/coregrind/m_libcmman.c
trunk/coregrind/m_main.c
trunk/coregrind/pub_core_libcmman.h
Modified: trunk/coregrind/m_libcmman.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_libcmman.c 2005-06-19 16:07:49 UTC (rev 3950)
+++ trunk/coregrind/m_libcmman.c 2005-06-19 16:10:47 UTC (rev 3951)
@@ -103,7 +103,7 @@
return res.isError ? (void*)-1 : (void*)res.val;
}
=20
-static SysRes munmap_native(void *start, SizeT length)
+SysRes VG_(munmap_native)(void *start, SizeT length)
{
return VG_(do_syscall2)(__NR_munmap, (UWord)start, length );
}
@@ -111,7 +111,7 @@
/* Returns -1 on failure. */
Int VG_(munmap)( void* start, SizeT length )
{
- SysRes res =3D munmap_native(start, length);
+ SysRes res =3D VG_(munmap_native)(start, length);
if (!res.isError) {
VG_(unmap_range)((Addr)start, length);
return 0;
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 16:07:49 UTC (rev 3950)
+++ trunk/coregrind/m_main.c 2005-06-19 16:10:47 UTC (rev 3951)
@@ -63,7 +63,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mman.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -328,9 +327,8 @@
=20
static void layout_remaining_space(Addr argc_addr, float ratio)
{
- Int ires;
- void* vres;
- Addr client_size, shadow_size;
+ SysRes res;
+ Addr client_size, shadow_size;
=20
// VG_(valgrind_base) should have been set by scan_auxv, but if not,
// this is a workable approximation
@@ -377,20 +375,23 @@
#undef SEGSIZE
=20
// Ban redzone
- vres =3D mmap((void *)VG_(client_end), REDZONE_SIZE, PROT_NONE,
- MAP_FIXED|MAP_ANON|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
- vg_assert((void*)-1 !=3D vres);
+ res =3D VG_(mmap_native)((void *)VG_(client_end), REDZONE_SIZE, VKI_P=
ROT_NONE,
+ VKI_MAP_FIXED|VKI_MAP_ANONYMOUS|VKI_MAP_PRIVATE|VKI_MAP_N=
ORESERVE,
+ -1, 0);
+ vg_assert(!res.isError);
=20
// Make client hole
- ires =3D munmap((void*)VG_(client_base), client_size);
- vg_assert(0 =3D=3D ires);
+ res =3D VG_(munmap_native)((void*)VG_(client_base), client_size);
+ vg_assert(!res.isError);
=20
// Map shadow memory.
// Initially all inaccessible, incrementally initialized as it is use=
d
if (shadow_size !=3D 0) {
- vres =3D mmap((char *)VG_(shadow_base), shadow_size, PROT_NONE,
- MAP_PRIVATE|MAP_ANON|MAP_FIXED|MAP_NORESERVE, -1, 0);
- if ((void*)-1 =3D=3D vres) {
+ res =3D VG_(mmap_native)((char *)VG_(shadow_base), shadow_size,
+ VKI_PROT_NONE,
+ VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS|VKI_MAP_FIXED|VKI_MA=
P_NORESERVE,
+ -1, 0);
+ if (res.isError) {
fprintf(stderr,=20
"valgrind: Could not allocate address space (%p bytes)\n"
"valgrind: for shadow memory\n"
@@ -818,7 +819,7 @@
const struct exeinfo *info,
UInt** client_auxv)
{
- void* res;
+ SysRes res;
char **cpp;
char *strtab; /* string table */
char *stringbase;
@@ -912,11 +913,11 @@
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D alloc=
ate space =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
=20
/* allocate a stack - mmap enough space for the stack */
- res =3D mmap((void *)VG_PGROUNDDN(cl_esp),=20
+ res =3D VG_(mmap_native)((void *)VG_PGROUNDDN(cl_esp),=20
VG_(clstk_end) - VG_PGROUNDDN(cl_esp),
- PROT_READ | PROT_WRITE | PROT_EXEC,=20
- MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
- vg_assert((void*)-1 !=3D res);=20
+ VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,=20
+ VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS|VKI_MAP_FIXED, -1, 0);
+ vg_assert(!res.isError);=20
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D copy =
client stack =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
*/
=20
@@ -1302,7 +1303,7 @@
{
killpad_extra* extra =3D ex;
void *b, *e;
- int res;
+ SysRes res;
=20
vg_assert(NULL !=3D extra->killpad_padstat);
=20
@@ -1323,8 +1324,8 @@
else
e =3D segend;
=20
- res =3D munmap(b, (char *)e-(char *)b);
- vg_assert(0 =3D=3D res);
+ res =3D VG_(munmap_native)(b, (char *)e-(char *)b);
+ vg_assert(!res.isError);
=20
return 1;
}
Modified: trunk/coregrind/pub_core_libcmman.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
--- trunk/coregrind/pub_core_libcmman.h 2005-06-19 16:07:49 UTC (rev 3950=
)
+++ trunk/coregrind/pub_core_libcmman.h 2005-06-19 16:10:47 UTC (rev 3951=
)
@@ -45,6 +45,7 @@
=20
extern SysRes VG_(mmap_native) ( void* start, SizeT length, UInt pro=
t,
UInt flags, UInt fd, OffT offset );
+extern SysRes VG_(munmap_native) ( void* start, SizeT length );
extern SysRes VG_(mprotect_native) ( void *start, SizeT length, UInt pro=
t );
=20
#endif // __PUB_CORE_LIBCMMAN_H
|
|
From: <sv...@va...> - 2005-06-19 16:07:51
|
Author: njn Date: 2005-06-19 17:07:49 +0100 (Sun, 19 Jun 2005) New Revision: 3950 Log: Add a comment. Modified: trunk/coregrind/ume.c Modified: trunk/coregrind/ume.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/ume.c 2005-06-19 15:58:33 UTC (rev 3949) +++ trunk/coregrind/ume.c 2005-06-19 16:07:49 UTC (rev 3950) @@ -33,6 +33,10 @@ #define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 =20 +// It seems that on SuSE 9.1 (x86) something in <fcntl.h> messes up stuf= f +// acquired indirectly from vki-x86-linux.h. Therefore our headers must= be +// included ahead of the glibc ones. This fix is a kludge; the right +// solution is to entirely remove the glibc dependency. #include "pub_core_basics.h" #include "pub_core_libcbase.h" #include "pub_core_machine.h" |
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 16:05:19
|
SVN commit 427112 by nethercote:
Fixed a bug in .valgrindrc reading I introduced recently -- freeing memor=
y
I should not have.
MERGED FROM 3.0 REPOSITORY
M +0 -4 vg_main.c =20
--- trunk/valgrind/coregrind/vg_main.c #427111:427112
@@ -578,10 +578,6 @@
to =3D copy_args(env_clo, to);
to =3D copy_args(f2_clo, to);
=20
- // Free memory
- free(f1_clo);
- free(f2_clo);
-
/* copy original arguments, stopping at command or -- */
while (*from) {
if (**from !=3D '-')
|
|
From: Julian S. <js...@ac...> - 2005-06-19 16:00:48
|
Similarly, it seems ume.c was messed up by <fcntl.h> on my SuSE box.
I just committed a (very crappy) "fix". (r3949). Some
de-glibc-ification of this file is needed for a proper fix.
J
On Sunday 19 June 2005 16:47, Nicholas Nethercote wrote:
> On Sun, 19 Jun 2005, Robert Walsh wrote:
> > It looks like a bad #define somewhere.
> >
> > After this makes it through the pre-processor, it looks like this:
> >
> > # 283 "../include/vki-amd64-linux.h"
> > struct vki_stat {
> > unsigned long st_dev;
> > unsigned long st_ino;
> > unsigned long st_nlink;
> >
> > unsigned int st_mode;
> > unsigned int st_uid;
> > unsigned int st_gid;
> > unsigned int __pad0;
> > unsigned long st_rdev;
> > long st_size;
> > long st_blksize;
> > long st_blocks;
> >
> > unsigned long st_atim.tv_sec;
> > unsigned long st_atime_nsec;
> > unsigned long st_mtim.tv_sec;
> > unsigned long st_mtime_nsec;
> > unsigned long st_ctim.tv_sec;
> > unsigned long st_ctime_nsec;
> > long __unused[3];
> > };
> >
> > In /usr/include/bits/stat.h, I see this:
> >
> > # define st_atime st_atim.tv_sec /* Backward compatibility. */
>
> I just committed a change to m_main.c so it no longer #includes
> <sys/stat.h>, which I guess was dragging in bits/stat.h. See if it works
> now.
>
> Nick
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
|
|
From: <sv...@va...> - 2005-06-19 15:58:35
|
Author: sewardj Date: 2005-06-19 16:58:33 +0100 (Sun, 19 Jun 2005) New Revision: 3949 Log: Un-break the build on SuSE 9.1 (x86). It seems that something in <fcntl.h> messes up stuff acquired indirectly from vki-x86-linux.h. This fix is therefore a kludge; it merely puts our defines ahead of the glibc ones. The right solution is to entirely remove the glibc dependency. Modified: trunk/coregrind/ume.c Modified: trunk/coregrind/ume.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/ume.c 2005-06-19 15:46:27 UTC (rev 3948) +++ trunk/coregrind/ume.c 2005-06-19 15:58:33 UTC (rev 3949) @@ -33,6 +33,11 @@ #define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 =20 +#include "pub_core_basics.h" +#include "pub_core_libcbase.h" +#include "pub_core_machine.h" +#include "ume.h" + #include <sys/mman.h> #include <fcntl.h> #include <errno.h> @@ -42,11 +47,6 @@ #include <unistd.h> #include <assert.h> =20 -#include "pub_core_basics.h" -#include "pub_core_libcbase.h" -#include "pub_core_machine.h" -#include "ume.h" - #if ELFSZ =3D=3D 64 #define ESZ(x) Elf64_##x #elif ELFSZ =3D=3D 32 |
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 15:47:21
|
On Sun, 19 Jun 2005, Robert Walsh wrote:
> It looks like a bad #define somewhere.
>
> After this makes it through the pre-processor, it looks like this:
>
> # 283 "../include/vki-amd64-linux.h"
> struct vki_stat {
> unsigned long st_dev;
> unsigned long st_ino;
> unsigned long st_nlink;
>
> unsigned int st_mode;
> unsigned int st_uid;
> unsigned int st_gid;
> unsigned int __pad0;
> unsigned long st_rdev;
> long st_size;
> long st_blksize;
> long st_blocks;
>
> unsigned long st_atim.tv_sec;
> unsigned long st_atime_nsec;
> unsigned long st_mtim.tv_sec;
> unsigned long st_mtime_nsec;
> unsigned long st_ctim.tv_sec;
> unsigned long st_ctime_nsec;
> long __unused[3];
> };
>
> In /usr/include/bits/stat.h, I see this:
>
> # define st_atime st_atim.tv_sec /* Backward compatibility. */
I just committed a change to m_main.c so it no longer #includes
<sys/stat.h>, which I guess was dragging in bits/stat.h. See if it works
now.
Nick
|
|
From: <sv...@va...> - 2005-06-19 15:46:29
|
Author: njn
Date: 2005-06-19 16:46:27 +0100 (Sun, 19 Jun 2005)
New Revision: 3948
Log:
Don't #include <sys/stat.h>, which was causing problems due to
it redefining certain names which clashed with field names in vki*.h.
There are plenty more glibc-isms that can be removed from m_main.c.
Modified:
trunk/coregrind/m_main.c
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 15:34:59 UTC (rev 3947)
+++ trunk/coregrind/m_main.c 2005-06-19 15:46:27 UTC (rev 3948)
@@ -64,7 +64,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -419,21 +418,21 @@
{
# define FLEN 512
Int fd, n;
- struct stat s1;
+ struct vki_stat s1;
char* f_clo =3D NULL;
char filename[FLEN];
=20
snprintf(filename, FLEN, "%s/.valgrindrc", ( NULL =3D=3D dir ? "" : d=
ir ) );
fd =3D VG_(open)(filename, 0, VKI_S_IRUSR);
if ( fd > 0 ) {
- if ( 0 =3D=3D fstat(fd, &s1) ) {
+ if ( 0 =3D=3D VG_(fstat)(fd, &s1) ) {
f_clo =3D malloc(s1.st_size+1);
vg_assert(f_clo);
- n =3D read(fd, f_clo, s1.st_size);
+ n =3D VG_(read)(fd, f_clo, s1.st_size);
if (n =3D=3D -1) n =3D 0;
f_clo[n] =3D '\0';
}
- close(fd);
+ VG_(close)(fd);
}
return f_clo;
# undef FLEN
@@ -1293,9 +1292,9 @@
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
typedef struct {
- char* killpad_start;
- char* killpad_end;
- struct stat* killpad_padstat;
+ char* killpad_start;
+ char* killpad_end;
+ struct vki_stat* killpad_padstat;
} killpad_extra;
=20
static int killpad(char *segstart, char *segend, const char *perm, off_t=
off,=20
@@ -1333,13 +1332,13 @@
// Remove padding of 'padfile' from a range of address space.
static void as_unpad(void *start, void *end, int padfile)
{
- static struct stat padstat;
+ static struct vki_stat padstat;
killpad_extra extra;
int res;
=20
vg_assert(padfile >=3D 0);
=20
- res =3D fstat(padfile, &padstat);
+ res =3D VG_(fstat)(padfile, &padstat);
vg_assert(0 =3D=3D res);
extra.killpad_padstat =3D &padstat;
extra.killpad_start =3D start;
|
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 15:41:58
|
On Sun, 19 Jun 2005 sv...@va... wrote: > Log: > Fixed a bug in .valgrindrc reading I introduced recently -- freeing memory > I should not have. > > Added a regression test for it. Whoops, no I didn't. Nick |
|
From: <sv...@va...> - 2005-06-19 15:35:04
|
Author: njn
Date: 2005-06-19 16:34:59 +0100 (Sun, 19 Jun 2005)
New Revision: 3947
Log:
Fixed a bug in .valgrindrc reading I introduced recently -- freeing memor=
y
I should not have.
Added a regression test for it.
MERGE TO 2.4 REPOSITORY
Modified:
trunk/coregrind/m_main.c
Modified: trunk/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
--- trunk/coregrind/m_main.c 2005-06-19 05:43:21 UTC (rev 3946)
+++ trunk/coregrind/m_main.c 2005-06-19 15:34:59 UTC (rev 3947)
@@ -413,6 +413,8 @@
/*=3D=3D=3D Command line setup =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
+// Note that we deliberately don't free the malloc'd memory. See commen=
t
+// at call site.
static char* get_file_clo(char* dir)
{
# define FLEN 512
@@ -454,7 +456,10 @@
return n;
}
=20
-/* add args out of environment, skipping multiple spaces and -- args */
+// Add args out of environment, skipping multiple spaces and "--" args.
+// We split 's' into multiple strings by replacing whitespace with nuls,
+// eg. "--aa --bb --cc" --> "--aa\0--bb\0--cc". And for each new string
+// carved out of 's', we put a pointer to it in 'to'.
static char** copy_args( char* s, char** to )
{
if (s) {
@@ -466,7 +471,7 @@
if ( !*cp ) break;
*to++ =3D cp;
while ( !VG_(isspace)(*cp) && *cp ) cp++;
- if ( *cp ) *cp++ =3D '\0'; // terminate if necessary
+ if ( *cp ) *cp++ =3D '\0'; // terminate if not the l=
ast
if (VG_STREQ(to[-1], "--")) to--; // undo any '--' arg
}
}
@@ -480,6 +485,8 @@
int vg_argc0 =3D *vg_argc_inout;
char** vg_argv0 =3D *vg_argv_inout;
=20
+ // get_file_clo() allocates the return value with malloc(). We do no=
t
+ // free f1_clo and f2_clo as they get put into vg_argv[] which must p=
ersist.
char* env_clo =3D getenv(VALGRINDOPTS);
char* f1_clo =3D get_file_clo( getenv("HOME") );
char* f2_clo =3D get_file_clo(".");
@@ -518,10 +525,6 @@
to =3D copy_args(env_clo, to);
to =3D copy_args(f2_clo, to);
=20
- // Free memory
- free(f1_clo);
- free(f2_clo);
-
/* copy original arguments, stopping at command or -- */
while (*from) {
if (**from !=3D '-')
|
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 14:57:13
|
On Tue, 24 May 2005, Nicholas Nethercote wrote: >> Additionally, another resource leak involving get_file_clo from >> vg_main.c is probably intended as there's a little comment above the >> definition of get_file_clo: >> >> /* Nb: malloc'd memory never freed -- kept throughout like argv, envp */ > > Hmm, looking at the code that comment is wrong -- the allocated memory gets > copied later in augment_command_line(), and then there is a definite leak. Turns out I was wrong about that, and my freeing of that memory broke the reading of options from files! Ah. Nick |
|
From: Robert W. <rj...@du...> - 2005-06-19 07:09:19
|
> The overnight tests all failed, in various different ways. I've made lot=
s=20
> of changes today, but everything builds and runs ok on my machine. The=20
> compile errors look really strange, some of the messages don't match the=20
> code, AFAICT, and some of the errors just seem completely bogus. And=20
> they're in files I haven't changed. And who knows about the cases where=20
> it compiled ok but failed to run any of the tests correctly.
>=20
> Julian, Tom, if you could take a look at the failures that would be great=
.
> Thanks.
It looks like a bad #define somewhere. If you look at the area around
vki-amd64-linux.h:297, it looks like this:
struct vki_stat {
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_nlink;
=20
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int __pad0;
unsigned long st_rdev;
long st_size;
long st_blksize;
long st_blocks; /* Number 512-byte blocks a=
llocated. */
=20
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
long __unused[3];
};
After this makes it through the pre-processor, it looks like this:
# 283 "../include/vki-amd64-linux.h"
struct vki_stat {
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_nlink;
=20
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int __pad0;
unsigned long st_rdev;
long st_size;
long st_blksize;
long st_blocks;
=20
unsigned long st_atim.tv_sec;
unsigned long st_atime_nsec;
unsigned long st_mtim.tv_sec;
unsigned long st_mtime_nsec;
unsigned long st_ctim.tv_sec;
unsigned long st_ctime_nsec;
long __unused[3];
};
In /usr/include/bits/stat.h, I see this:
# define st_atime st_atim.tv_sec /* Backward compatibility. */
plus many more that do other similar munging. Anyway, enough
investigating for one night - long day tomorrow, so got to hit the sack.
Regards,
Robert.
--=20
Robert Walsh
Amalgamated Durables, Inc. - "We don't make the things you buy."
Email: rj...@du...
|
|
From: <sv...@va...> - 2005-06-19 05:43:24
|
Author: njn Date: 2005-06-19 06:43:21 +0100 (Sun, 19 Jun 2005) New Revision: 3946 Log: Get "make dist" closer to working again. Modified: trunk/Makefile.am trunk/coregrind/m_aspacemgr/Makefile.am trunk/coregrind/m_sigframe/Makefile.am trunk/memcheck/docs/mc-manual.xml trunk/memcheck/tests/Makefile.am Modified: trunk/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/Makefile.am 2005-06-19 05:14:03 UTC (rev 3945) +++ trunk/Makefile.am 2005-06-19 05:43:21 UTC (rev 3946) @@ -14,7 +14,9 @@ ## addrcheck \ =20 # Temporary: we want to compile Helgrind, but not regtest it. -SUBDIRS =3D include coregrind . docs tests auxprogs $(TOOLS) helgrind +# Put docs last because building the HTML is slow and we want to get +# everything else working before we try it. +SUBDIRS =3D include coregrind . tests auxprogs $(TOOLS) helgrind docs ##DIST_SUBDIRS =3D $(SUBDIRS) helgrind =20 SUPP_FILES =3D \ Modified: trunk/coregrind/m_aspacemgr/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/coregrind/m_aspacemgr/Makefile.am 2005-06-19 05:14:03 UTC (rev = 3945) +++ trunk/coregrind/m_aspacemgr/Makefile.am 2005-06-19 05:43:21 UTC (rev = 3946) @@ -1,9 +1,6 @@ include $(top_srcdir)/Makefile.all.am include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am =20 -EXTRA_DIST =3D \ - README_ASPACEMGR.txt - noinst_LIBRARIES =3D libaspacemgr.a =20 libaspacemgr_a_SOURCES =3D \ Modified: trunk/coregrind/m_sigframe/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/coregrind/m_sigframe/Makefile.am 2005-06-19 05:14:03 UTC (rev 3= 945) +++ trunk/coregrind/m_sigframe/Makefile.am 2005-06-19 05:43:21 UTC (rev 3= 946) @@ -1,9 +1,6 @@ include $(top_srcdir)/Makefile.all.am include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am =20 -EXTRA_DIST =3D \ - README_SIGFRAME.txt - noinst_LIBRARIES =3D libsigframe.a =20 libsigframe_a_SOURCES =3D \ Modified: trunk/memcheck/docs/mc-manual.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 --- trunk/memcheck/docs/mc-manual.xml 2005-06-19 05:14:03 UTC (rev 3945) +++ trunk/memcheck/docs/mc-manual.xml 2005-06-19 05:43:21 UTC (rev 3946) @@ -396,7 +396,7 @@ before the pointer actually returned. This implies a variable-sized overhead in what's returned by <computeroutput>new</computeroutput> or -<computeroutput>new[]</computeroutput>. +<computeroutput>new[]</computeroutput>.</para> </sect2> =20 =20 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-06-19 05:14:03 UTC (rev 3945) +++ trunk/memcheck/tests/Makefile.am 2005-06-19 05:43:21 UTC (rev 3946) @@ -58,7 +58,7 @@ new_override.stderr.exp new_override.stdout.exp new_override.vgtest \ null_socket.stderr.exp null_socket.vgtest \ overlap.stderr.exp overlap.stdout.exp overlap.vgtest \ - pointer-trace.vgtest pointer-trace.stdout.exp \ + pointer-trace.vgtest \ pointer-trace.stderr.exp pointer-trace.stderr.exp64 \ post-syscall.stderr.exp post-syscall.stdout.exp post-syscall.vgtest \ realloc1.stderr.exp realloc1.vgtest \ @@ -76,7 +76,7 @@ toobig-allocs.stderr.exp toobig-allocs.vgtest \ trivialleak.stderr.exp trivialleak.vgtest \ weirdioctl.stderr.exp weirdioctl.stdout.exp weirdioctl.vgtest \ - metadata.stderr.exp metadata.stdout.exp metadata.vgtest \ + metadata.stderr.exp metadata.stdout.exp metadata.vgtest-HIDING \ vgtest_ume.stderr.exp vgtest_ume.vgtest \ writev.stderr.exp writev.stderr.exp2 writev.stderr.exp3 writev.vgtest \ xml1.stderr.exp xml1.stderr.exp64 xml1.stdout.exp xml1.vgtest \ |
|
From: <sv...@va...> - 2005-06-19 05:14:14
|
Author: njn
Date: 2005-06-19 06:14:03 +0100 (Sun, 19 Jun 2005)
New Revision: 3945
Log:
In m_redir.c, no longer need to handle the case of redirection to
a symbol -- we always redirect to a specific address. This simplifies
things a bit.
Modified:
trunk/coregrind/m_redir.c
Modified: trunk/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
--- trunk/coregrind/m_redir.c 2005-06-19 01:24:32 UTC (rev 3944)
+++ trunk/coregrind/m_redir.c 2005-06-19 05:14:03 UTC (rev 3945)
@@ -75,8 +75,6 @@
Addr from_addr; /* old addr */
=20
/* used for redirection */
- const Char *to_lib; /* library qualifier pattern */
- const Char *to_sym; /* symbol */
Addr to_addr; /* new addr */
=20
/* used for wrapping */
@@ -132,17 +130,9 @@
return redir->from_addr !=3D 0;
}
=20
-static inline Bool to_resolved(const CodeRedirect *redir)
-{
- if (redir->type =3D=3D R_REDIRECT)
- return redir->to_addr !=3D 0;
- vg_assert(redir->wrapper !=3D NULL);
- return True;
-}
-
Bool VG_(is_resolved)(const CodeRedirect *redir)
{
- return from_resolved(redir) && to_resolved(redir);
+ return from_resolved(redir);
}
=20
static void add_resolved(CodeRedirect *redir)
@@ -152,8 +142,7 @@
if (VG_(clo_trace_redir)) {
VG_(message)(Vg_DebugMsg, " redir resolved (%s:%s=3D%p -> ",
redir->from_lib, redir->from_sym, redir->from_addr=
);
- VG_(message)(Vg_DebugMsg, " %s:%s=3D%p)",
- redir->to_lib, redir->to_sym, redir->to_addr);
+ VG_(message)(Vg_DebugMsg, " %p)", redir->to_ad=
dr);
}
=20
if (VG_(search_transtab)(NULL, (Addr64)redir->from_addr, False)) {
@@ -192,9 +181,9 @@
else {
/* XXX leak redir */
if (VG_(clo_trace_redir))
- VG_(message)(Vg_DebugMsg, " redir %s:%s:%p->%s:%s:%p dup=
licated\n",
+ VG_(message)(Vg_DebugMsg, " redir %s:%s:%p->%p duplicate=
d\n",
redir->from_lib, redir->from_sym, redir->fro=
m_addr,
- redir->to_lib, redir->to_sym, redir->to_addr=
);
+ redir->to_addr);
}
}
break;
@@ -230,12 +219,6 @@
=20
resolved =3D VG_(is_resolved)(redir);
=20
- if (0 && VG_(clo_trace_redir))
- VG_(printf)(" consider FROM binding %s:%s -> %s:%s in %s(%s)\n",
- redir->from_lib, redir->from_sym,
- redir->to_lib, redir->to_sym,
- si->filename, si->soname);
-
vg_assert(!resolved);
=20
if (!from_resolved(redir)) {
@@ -249,25 +232,12 @@
}
}
=20
- if (!to_resolved(redir)) {
- vg_assert(redir->type =3D=3D R_REDIRECT);
- vg_assert(redir->to_sym !=3D NULL);
+ resolved =3D from_resolved(redir);
=20
- if (match_lib(redir->to_lib, si)) {
- redir->to_addr =3D VG_(reverse_search_one_symtab)(si, redir->to_sym);
- if (VG_(clo_trace_redir) && redir->to_addr !=3D 0)
- VG_(printf)(" bind TO: %p =3D %s:%s\n",=20
- redir->to_addr,redir->to_lib, redir->to_sym );
-
- }
- }
-
- resolved =3D from_resolved(redir) && to_resolved(redir);
-
if (0 && VG_(clo_trace_redir))
- VG_(printf)("resolve_redir: %s:%s from=3D%p %s:%s to=3D%p\n",
+ VG_(printf)("resolve_redir: %s:%s from=3D%p to=3D%p\n",
redir->from_lib, redir->from_sym, redir->from_addr,=20
- redir->to_lib, redir->to_sym, redir->to_addr);
+ redir->to_addr);
=20
if (resolved) add_resolved(redir);
=20
@@ -314,9 +284,8 @@
}
}
=20
-static void add_redirect_X_to_X(
- const Char *from_lib, const Char *from_sym, Addr from_addr,
- const Char *to_lib, const Char *to_sym, Addr to_addr
+static void add_redirect_X_to_addr(
+ const Char *from_lib, const Char *from_sym, Addr from_addr, Addr to_a=
ddr
)
{
CodeRedirect *redir =3D VG_(SkipNode_Alloc)(&sk_resolved_redir);
@@ -329,16 +298,14 @@
else redir->from_sym =3D NULL;
redir->from_addr =3D from_addr;
=20
- if (to_lib) redir->to_lib =3D VG_(arena_strdup)(VG_AR_SYMTAB, to=
_lib);
- else redir->to_lib =3D NULL;
- if (to_sym) redir->to_sym =3D VG_(arena_strdup)(VG_AR_SYMTAB, to=
_sym);
- else redir->to_sym =3D NULL;
- redir->to_addr =3D to_addr;
+ vg_assert(0 !=3D to_addr);
+ redir->to_addr =3D to_addr;
+ redir->wrapper =3D 0;
=20
if (VG_(clo_verbosity) >=3D 2 && VG_(clo_trace_redir))
VG_(message)(Vg_UserMsg,=20
- "REDIRECT %s:%s(%p) to %s:%s(%p)",
- from_lib, from_sym, from_addr, to_lib, to_sym, to_add=
r);
+ "REDIRECT %s:%s(%p) to %p",
+ from_lib, from_sym, from_addr, to_addr);
=20
/* Check against all existing segments to see if this redirection
can be resolved immediately */
@@ -352,26 +319,18 @@
}
}
=20
-/* Redirect a lib/symbol reference to a function at lib/symbol */
-__attribute__((unused))
-static void add_redirect_sym_to_sym(const Char *from_lib, const Char *fr=
om_sym,
- const Char *to_lib, const Char *to_sym)
-{
- add_redirect_X_to_X(from_lib, from_sym, 0, to_lib, to_sym, 0);
-}
-
/* Redirect a lib/symbol reference to a function at addr */
static void add_redirect_sym_to_addr(const Char *from_lib, const Char *f=
rom_sym,
Addr to_addr)
{
- add_redirect_X_to_X(from_lib, from_sym, 0, NULL, NULL, to_addr);
+ add_redirect_X_to_addr(from_lib, from_sym, 0, to_addr);
}
=20
/* Redirect a function at from_addr to a function at to_addr */
__attribute__((unused)) // It is used, but not on all platforms...
static void add_redirect_addr_to_addr(Addr from_addr, Addr to_addr)
{
- add_redirect_X_to_X(NULL, NULL, from_addr, NULL, NULL, to_addr);
+ add_redirect_X_to_addr(NULL, NULL, from_addr, to_addr);
}
=20
CodeRedirect *VG_(add_wrapper)(const Char *from_lib, const Char *from_sy=
m,
@@ -385,15 +344,11 @@
=20
redir->type =3D R_WRAPPER;
=20
- redir->from_lib =3D VG_(arena_strdup)(VG_AR_SYMTAB, from_lib);
- redir->from_sym =3D VG_(arena_strdup)(VG_AR_SYMTAB, from_sym);
+ redir->from_lib =3D VG_(arena_strdup)(VG_AR_SYMTAB, from_lib);
+ redir->from_sym =3D VG_(arena_strdup)(VG_AR_SYMTAB, from_sym);
redir->from_addr =3D 0;
-
- redir->to_lib =3D NULL;
- redir->to_sym =3D NULL;
- redir->to_addr =3D 0;
-
- redir->wrapper =3D wrapper;
+ redir->to_addr =3D 0;
+ redir->wrapper =3D wrapper;
=20
/* Check against all existing segments to see if this redirection
can be resolved immediately */
|
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 04:35:17
|
Hi, The overnight tests all failed, in various different ways. I've made lots of changes today, but everything builds and runs ok on my machine. The compile errors look really strange, some of the messages don't match the code, AFAICT, and some of the errors just seem completely bogus. And they're in files I haven't changed. And who knows about the cases where it compiled ok but failed to run any of the tests correctly. Julian, Tom, if you could take a look at the failures that would be great. Thanks. Nick |