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
(44) |
2
(9) |
3
(30) |
4
(28) |
5
(42) |
6
(14) |
7
(10) |
|
8
(7) |
9
(8) |
10
(6) |
11
(15) |
12
(13) |
13
(14) |
14
(23) |
|
15
(17) |
16
(10) |
17
(82) |
18
(14) |
19
(21) |
20
(14) |
21
(21) |
|
22
(7) |
23
(13) |
24
(16) |
25
(11) |
26
(11) |
27
(6) |
28
(7) |
|
29
(8) |
30
(13) |
31
(8) |
|
|
|
|
|
From: <sv...@va...> - 2006-10-01 23:15:31
|
Author: sewardj Date: 2006-10-02 00:15:29 +0100 (Mon, 02 Oct 2006) New Revision: 6137 Log: Oops; this was missed in r6134. Modified: branches/AIX5/coregrind/pub_core_errormgr.h Modified: branches/AIX5/coregrind/pub_core_errormgr.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/AIX5/coregrind/pub_core_errormgr.h 2006-10-01 23:14:11 UTC (= rev 6136) +++ branches/AIX5/coregrind/pub_core_errormgr.h 2006-10-01 23:15:29 UTC (= rev 6137) @@ -60,6 +60,8 @@ =20 extern UInt VG_(get_n_errs_found) ( void ); =20 +extern void VG_(print_errormgr_stats) ( void ); + #endif // __PUB_CORE_ERRORMGR_H =20 /*--------------------------------------------------------------------*/ |
|
From: <sv...@va...> - 2006-10-01 23:14:14
|
Author: sewardj
Date: 2006-10-02 00:14:11 +0100 (Mon, 02 Oct 2006)
New Revision: 6136
Log:
Track SysRes change; support bigpage allocation on AIX; make the
client-arena superblocks much bigger on AIX.
Modified:
branches/AIX5/coregrind/m_mallocfree.c
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/m_mallocfree.c 2006-10-01 23:08:53 UTC (rev 6=
135)
+++ branches/AIX5/coregrind/m_mallocfree.c 2006-10-01 23:14:11 UTC (rev 6=
136)
@@ -30,6 +30,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_debuglog.h"
#include "pub_core_libcbase.h"
#include "pub_core_aspacemgr.h"
@@ -453,6 +454,7 @@
larger prev/next ptr.
*/
if (VG_AR_CLIENT =3D=3D aid) {
+ Int ar_client_sbszB;
if (client_inited) {
// This assertion ensures that a tool cannot try to change the =
client
// redzone size with VG_(needs_malloc_replacement)() after this=
module
@@ -473,8 +475,17 @@
VG_(exit)(1);
}
}
- // Initialise the client arena
- arena_init ( VG_AR_CLIENT, "client", client_rz_szB, 1048576 )=
;
+ // Initialise the client arena. On AIX it's important to have
+ // relatively large client blocks so as not to cause excessively
+ // fine-grained interleaving of V and C address space. On Linux
+ // this is irrelevant since aspacem can keep the two spaces
+ // well apart, but not so on AIX.
+# if defined(VGO_aix5)
+ ar_client_sbszB =3D 16777216;
+# else
+ ar_client_sbszB =3D 1048576;
+# endif
+ arena_init ( VG_AR_CLIENT, "client", client_rz_szB, ar_client=
_sbszB );
client_inited =3D True;
=20
} else {
@@ -547,7 +558,6 @@
{
Superblock* sb;
SysRes sres;
- NSegment* seg;
=20
// Take into account admin bytes in the Superblock.
cszB +=3D sizeof(Superblock);
@@ -557,26 +567,26 @@
=20
if (a->clientmem) {
// client allocation -- return 0 to client if it fails
- sres =3D VG_(am_mmap_anon_float_client)
+ sres =3D VG_(am_sbrk_anon_float_client)
( cszB, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC );
if (sres.isError)
return 0;
- sb =3D (Superblock*)sres.val;
+ sb =3D (Superblock*)sres.res;
// Mark this segment as containing client heap. The leak
// checker needs to be able to identify such segments so as not
// to use them as sources of roots during leak checks.
- seg =3D VG_(am_find_nsegment)( (Addr)sb );
- vg_assert(seg && seg->kind =3D=3D SkAnonC);
- seg->isCH =3D True;
+ VG_(am_set_segment_isCH_if_SkAnonC)(=20
+ (NSegment*) VG_(am_find_nsegment)( (Addr)sb )
+ );
} else {
// non-client allocation -- abort if it fails
- sres =3D VG_(am_mmap_anon_float_valgrind)( cszB );
+ sres =3D VG_(am_sbrk_anon_float_valgrind)( cszB );
if (sres.isError) {
VG_(out_of_memory_NORETURN)("newSuperblock", cszB);
/* NOTREACHED */
sb =3D NULL; /* keep gcc happy */
} else {
- sb =3D (Superblock*)sres.val;
+ sb =3D (Superblock*)sres.res;
}
}
vg_assert(NULL !=3D sb);
|
|
From: <sv...@va...> - 2006-10-01 23:08:56
|
Author: sewardj
Date: 2006-10-02 00:08:53 +0100 (Mon, 02 Oct 2006)
New Revision: 6135
Log:
Track SysRes redefinition; also allow translations up to 60k long.
Modified:
branches/AIX5/coregrind/m_transtab.c
Modified: branches/AIX5/coregrind/m_transtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_transtab.c 2006-10-01 23:04:02 UTC (rev 613=
4)
+++ branches/AIX5/coregrind/m_transtab.c 2006-10-01 23:08:53 UTC (rev 613=
5)
@@ -667,7 +667,7 @@
8 * tc_sector_szQ );
/*NOTREACHED*/
}
- sec->tc =3D (ULong*)sres.val;
+ sec->tc =3D (ULong*)sres.res;
=20
sres =3D VG_(am_mmap_anon_float_valgrind)
( N_TTES_PER_SECTOR * sizeof(TTEntry) );
@@ -676,7 +676,7 @@
N_TTES_PER_SECTOR * sizeof(TTEntry)=
);
/*NOTREACHED*/
}
- sec->tt =3D (TTEntry*)sres.val;
+ sec->tt =3D (TTEntry*)sres.res;
=20
for (i =3D 0; i < N_TTES_PER_SECTOR; i++) {
sec->tt[i].status =3D Empty;
@@ -791,8 +791,10 @@
=20
vg_assert(init_done);
vg_assert(vge->n_used >=3D 1 && vge->n_used <=3D 3);
- vg_assert(code_len > 0 && code_len < 20000);
=20
+ /* 60000: should agree with N_TMPBUF in m_translate.c. */
+ vg_assert(code_len > 0 && code_len < 60000);
+
if (0)
VG_(printf)("add_to_transtab(entry =3D 0x%llx, len =3D %d)\n",
entry, code_len);
@@ -1262,7 +1264,7 @@
VG_(out_of_memory_NORETURN)("init_unredir_tt_tc", N_UNREDIR_TT =
* UNREDIR_SZB);
/*NOTREACHED*/
}
- unredir_tc =3D (ULong *)sres.val;
+ unredir_tc =3D (ULong *)sres.res;
}
unredir_tc_used =3D 0;
for (i =3D 0; i < N_UNREDIR_TT; i++)
|
|
From: <sv...@va...> - 2006-10-01 23:04:05
|
Author: sewardj
Date: 2006-10-02 00:04:02 +0100 (Mon, 02 Oct 2006)
New Revision: 6134
Log:
Accumulate statistics about the number of searches in the errors and
suppressions lists, and rearrange the suppressions list when searching
to reduce cost of future searches.
Modified:
branches/AIX5/coregrind/m_errormgr.c
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/m_errormgr.c 2006-10-01 23:01:25 UTC (rev 613=
3)
+++ branches/AIX5/coregrind/m_errormgr.c 2006-10-01 23:04:02 UTC (rev 613=
4)
@@ -29,6 +29,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_threadstate.h" // For VG_N_THREADS
#include "pub_core_debugger.h"
#include "pub_core_debuginfo.h"
@@ -67,7 +68,8 @@
static Error* errors =3D NULL;
=20
/* The list of suppression directives, as read from the specified
- suppressions file. */
+ suppressions file. Note that the list gets rearranged as a result
+ of the searches done by is_suppressible_error(). */
static Supp* suppressions =3D NULL;
=20
/* Running count of unsuppressed errors detected. */
@@ -81,6 +83,20 @@
=20
static ThreadId last_tid_printed =3D 1;
=20
+/* Stats: number of searches of the error list initiated. */
+static UWord em_errlist_searches =3D 0;
+
+/* Stats: number of comparisons done during error list
+ searching. */
+static UWord em_errlist_cmps =3D 0;
+
+/* Stats: number of searches of the suppression list initiated. */
+static UWord em_supplist_searches =3D 0;
+
+/* Stats: number of comparisons done during suppression list
+ searching. */
+static UWord em_supplist_cmps =3D 0;
+
/*------------------------------------------------------------*/
/*--- Error type ---*/
/*------------------------------------------------------------*/
@@ -531,9 +547,11 @@
construct_error ( &err, tid, ekind, a, s, extra, NULL );
=20
/* First, see if we've got an error record matching this one. */
- p =3D errors;
- p_prev =3D NULL;
+ em_errlist_searches++;
+ p =3D errors;
+ p_prev =3D NULL;
while (p !=3D NULL) {
+ em_errlist_cmps++;
if (eq_Error(exe_res, p, &err)) {
/* Found it. */
p->count++;
@@ -691,7 +709,7 @@
" </pair>",=20
su->count, su->sname);
} else {
- VG_(message)(Vg_DebugMsg, "supp: %4d %s", su->count, su->sname)=
;
+ VG_(message)(Vg_DebugMsg, "supp: %6d %s", su->count, su->sname)=
;
}
}
=20
@@ -817,6 +835,34 @@
/*--- Standard suppressions ---*/
/*------------------------------------------------------------*/
=20
+/* Get the next char from fd into *out_buf. Returns 1 if success,
+ 0 if eof or < 0 if error. */
+
+static Int get_char ( Int fd, Char* out_buf )
+{
+ Int r;
+ static Char buf[64];
+ static Int buf_size =3D 0;
+ static Int buf_used =3D 0;
+ vg_assert(buf_size >=3D 0 && buf_size <=3D 64);
+ vg_assert(buf_used >=3D 0 && buf_used <=3D buf_size);
+ if (buf_used =3D=3D buf_size) {
+ r =3D VG_(read)(fd, buf, 64);
+ if (r < 0) return r; /* read failed */
+ vg_assert(r >=3D 0 && r <=3D 64);
+ buf_size =3D r;
+ buf_used =3D 0;
+ }
+ if (buf_size =3D=3D 0)
+ return 0; /* eof */
+ vg_assert(buf_size >=3D 0 && buf_size <=3D 64);
+ vg_assert(buf_used >=3D 0 && buf_used < buf_size);
+ *out_buf =3D buf[buf_used];
+ buf_used++;
+ return 1;
+}
+
+
/* Get a non-blank, non-comment line of at most nBuf chars from fd.
Skips leading spaces on the line. Return True if EOF was hit instead.=
=20
*/
@@ -827,17 +873,17 @@
while (True) {
/* First, read until a non-blank char appears. */
while (True) {
- n =3D VG_(read)(fd, &ch, 1);
+ n =3D get_char(fd, &ch);
if (n =3D=3D 1 && !VG_(isspace)(ch)) break;
- if (n =3D=3D 0) return True;
+ if (n <=3D 0) return True;
}
=20
/* Now, read the line into buf. */
i =3D 0;
buf[i++] =3D ch; buf[i] =3D 0;
while (True) {
- n =3D VG_(read)(fd, &ch, 1);
- if (n =3D=3D 0) return False; /* the next call will return True=
*/
+ n =3D get_char(fd, &ch);
+ if (n <=3D 0) return False; /* the next call will return True *=
/
if (ch =3D=3D '\n') break;
if (i > 0 && i =3D=3D nBuf-1) i--;
buf[i++] =3D ch; buf[i] =3D 0;
@@ -919,7 +965,7 @@
filename );
VG_(exit)(1);
}
- fd =3D sres.val;
+ fd =3D sres.res;
=20
# define BOMB(S) { err_str =3D S; goto syntax_error; }
=20
@@ -1136,18 +1182,45 @@
static Supp* is_suppressible_error ( Error* err )
{
Supp* su;
+ Supp* su_prev;
=20
+ /* stats gathering */
+ em_supplist_searches++;
+
/* See if the error context matches any suppression. */
+ su_prev =3D NULL;
for (su =3D suppressions; su !=3D NULL; su =3D su->next) {
- if (supp_matches_error(su, err) &&
- supp_matches_callers(err, su))
- {
+ em_supplist_cmps++;
+ if (supp_matches_error(su, err) && supp_matches_callers(err, su)) =
{
+ /* got a match. Move this entry to the head of the list
+ in the hope of making future searches cheaper. */
+ if (su_prev) {
+ vg_assert(su_prev->next =3D=3D su);
+ su_prev->next =3D su->next;
+ su->next =3D suppressions;
+ suppressions =3D su;
+ }
return su;
}
+ su_prev =3D su;
}
return NULL; /* no matches */
}
=20
+/* Show accumulated error-list and suppression-list search stats.=20
+*/
+void VG_(print_errormgr_stats) ( void )
+{
+ VG_(message)(Vg_DebugMsg,=20
+ " errormgr: %,lu supplist searches, %,lu comparisons during search=
",
+ em_supplist_searches, em_supplist_cmps
+ );
+ VG_(message)(Vg_DebugMsg,=20
+ " errormgr: %,lu errlist searches, %,lu comparisons during search"=
,
+ em_errlist_searches, em_errlist_cmps
+ );
+}
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2006-10-01 23:01:30
|
Author: sewardj
Date: 2006-10-02 00:01:25 +0100 (Mon, 02 Oct 2006)
New Revision: 6133
Log:
Inline stackPush and stackPop and placate gcc's resulting concerns
about uninitialised variables.
Modified:
branches/AIX5/coregrind/m_oset.c
Modified: branches/AIX5/coregrind/m_oset.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_oset.c 2006-10-01 18:20:35 UTC (rev 6132)
+++ branches/AIX5/coregrind/m_oset.c 2006-10-01 23:01:25 UTC (rev 6133)
@@ -236,7 +236,7 @@
}
=20
// Push onto the iterator stack.
-static void stackPush(AvlTree* t, AvlNode* n, Int i)
+static inline void stackPush(AvlTree* t, AvlNode* n, Int i)
{
vg_assert(t->stackTop < STACK_MAX);
vg_assert(1 <=3D i && i <=3D 3);
@@ -246,7 +246,7 @@
}
=20
// Pop from the iterator stack.
-static Bool stackPop(AvlTree* t, AvlNode** n, Int* i)
+static inline Bool stackPop(AvlTree* t, AvlNode** n, Int* i)
{
vg_assert(t->stackTop <=3D STACK_MAX);
=20
@@ -296,8 +296,8 @@
// Destructor, frees up all memory held by remaining nodes.
void VG_(OSet_Destroy)(AvlTree* t, OSetNodeDestroy_t destroyNode)
{
- AvlNode* n;
- Int i, sz =3D 0;
+ AvlNode* n =3D NULL;
+ Int i =3D 0, sz =3D 0;
=20
vg_assert(t);
stackClear(t);
@@ -682,8 +682,8 @@
=20
void* VG_(OSet_Next)(AvlTree* t)
{
- Int i;
- OSetNode* n;
+ Int i =3D 0;
+ OSetNode* n =3D NULL;
=20
vg_assert(t);
=20
|
|
From: <sv...@va...> - 2006-10-01 18:20:37
|
Author: sewardj
Date: 2006-10-01 19:20:35 +0100 (Sun, 01 Oct 2006)
New Revision: 6132
Log:
Minor changes for redirection on AIX. The only significant change is
that it now checks for, warns about and disallows, attempts to
redirect to, or wrap with, a function for which no TOC pointer can be
found, since that would be really asking for trouble (a segfault).
Modified:
branches/AIX5/coregrind/m_redir.c
branches/AIX5/include/pub_tool_redir.h
Modified: branches/AIX5/coregrind/m_redir.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_redir.c 2006-10-01 18:16:56 UTC (rev 6131)
+++ branches/AIX5/coregrind/m_redir.c 2006-10-01 18:20:35 UTC (rev 6132)
@@ -43,7 +43,7 @@
#include "pub_core_trampoline.h"
#include "pub_core_transtab.h"
#include "pub_core_tooliface.h" // VG_(needs).malloc_replacement
-#include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
+#include "pub_core_machine.h" // VG_(fnptr_to_fnentry)
#include "pub_core_aspacemgr.h" // VG_(am_find_nsegment)
#include "pub_core_clientstate.h" // VG_(client___libc_freeres_wrapper)
#include "pub_core_demangle.h" // VG_(maybe_Z_demangle)
@@ -269,6 +269,7 @@
static void symtab_free(void*);
static HChar* symtab_strdup(HChar*);
static Bool is_plausible_guest_addr(Addr);
+static Bool is_aix5_glink_idiom(Addr);
=20
static void show_redir_state ( HChar* who );
static void show_active ( HChar* left, Active* act );
@@ -307,11 +308,16 @@
TopSpec* ts;
TopSpec* newts;
HChar* sym_name;
- Addr sym_addr;
+ Addr sym_addr, sym_toc;
HChar demangled_sopatt[N_DEMANGLED];
HChar demangled_fnpatt[N_DEMANGLED];
+ Bool check_ppcTOCs =3D False;
=20
+
const UChar* newsi_soname;
+# if defined(VG_PLAT_USES_PPCTOC)
+ check_ppcTOCs =3D True;
+# endif
=20
vg_assert(newsi);
newsi_soname =3D VG_(seginfo_soname)(newsi);
@@ -328,15 +334,22 @@
=20
nsyms =3D VG_(seginfo_syms_howmany)( newsi );
for (i =3D 0; i < nsyms; i++) {
- VG_(seginfo_syms_getidx)( newsi, i, &sym_addr, NULL, &sym_name );
+ VG_(seginfo_syms_getidx)( newsi, i, &sym_addr, &sym_toc, NULL, &sy=
m_name );
ok =3D VG_(maybe_Z_demangle)( sym_name, demangled_sopatt, N_DEMANG=
LED,
- demangled_fnpatt, N_DEMANGLED, &isWrap );
+ demangled_fnpatt, N_DEMANGLED, &isWrap=
);
if (!ok) {
/* It's not a full-scale redirect, but perhaps it is a load-not=
ify
fn? Let the load-notify department see it. */
handle_maybe_load_notifier( newsi_soname, sym_name, sym_addr );
continue;=20
}
+ if (check_ppcTOCs && sym_toc =3D=3D 0) {
+ /* This platform uses toc pointers, but none could be found
+ for this symbol, so we can't safely redirect/wrap to it.
+ Just skip it; we'll make a second pass over the symbols in
+ the following loop, and complain at that point. */
+ continue;
+ }
spec =3D symtab_alloc(sizeof(Spec));
vg_assert(spec);
spec->from_sopatt =3D symtab_strdup(demangled_sopatt);
@@ -352,6 +365,34 @@
specList =3D spec;
}
=20
+ if (check_ppcTOCs) {
+ for (i =3D 0; i < nsyms; i++) {
+ VG_(seginfo_syms_getidx)( newsi, i, &sym_addr, &sym_toc, NULL, =
&sym_name );
+ ok =3D VG_(maybe_Z_demangle)( sym_name, demangled_sopatt, N_DEM=
ANGLED,
+ demangled_fnpatt, N_DEMANGLED, &isW=
rap );
+ if (!ok)
+ /* not a redirect. Ignore. */
+ continue;
+ if (sym_toc !=3D 0)
+ /* has a valid toc pointer. Ignore. */
+ continue;
+
+ for (spec =3D specList; spec; spec =3D spec->next)=20
+ if (0 =3D=3D VG_(strcmp)(spec->from_sopatt, demangled_sopatt=
)
+ && 0 =3D=3D VG_(strcmp)(spec->from_fnpatt, demangled_fnp=
att))
+ break;
+ if (spec)
+ /* a redirect to some other copy of that symbol, which does have
+ a TOC value, already exists */
+ continue;
+
+ /* Complain */
+ VG_(message)(Vg_DebugMsg,
+ "WARNING: no TOC ptr for redir/wrap to %s %s",
+ demangled_sopatt, demangled_fnpatt);
+ }
+ }
+
/* Ok. Now specList holds the list of specs from the SegInfo.=20
Build a new TopSpec, but don't add it to topSpecs yet. */
newts =3D symtab_alloc(sizeof(TopSpec));
@@ -384,7 +425,7 @@
generate_and_add_actives( specList, newts,
ts->seginfo, ts );
}
-=09
+
/* Case (2) */
for (ts =3D topSpecs; ts; ts =3D ts->next) {
generate_and_add_actives( ts->specs, ts,=20
@@ -445,7 +486,18 @@
of trashing the caches less. */
nsyms =3D VG_(seginfo_syms_howmany)( si );
for (i =3D 0; i < nsyms; i++) {
- VG_(seginfo_syms_getidx)( si, i, &sym_addr, NULL, &sym_name );
+ VG_(seginfo_syms_getidx)( si, i, &sym_addr, NULL, NULL, &sym_name =
);
+
+ /* On AIX, we cannot redirect calls to a so-called glink
+ function for reasons which are not obvious - something to do
+ with saving r2 across the call. Not a problem, as we don't
+ want to anyway; presumably it is the target of the glink we
+ need to redirect. Hence just spot them and ignore them.
+ They are always of a very specific (more or less
+ ABI-mandated) form. */
+ if (is_aix5_glink_idiom(sym_addr))
+ continue;
+
for (sp =3D specs; sp; sp =3D sp->next) {
if (!sp->mark)
continue; /* soname doesn't match */
@@ -785,6 +837,12 @@
=20
}
=20
+# elif defined(VGP_ppc32_aix5)
+ /* nothing so far */
+
+# elif defined(VGP_ppc64_aix5)
+ /* nothing so far */
+
# else
# error Unknown platform
# endif
@@ -817,12 +875,48 @@
in m_translate. */
static Bool is_plausible_guest_addr(Addr a)
{
- NSegment* seg =3D VG_(am_find_nsegment)(a);
+ NSegment const*const seg =3D VG_(am_find_nsegment)(a);
return seg !=3D NULL
&& (seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
&& (seg->hasX || seg->hasR); /* crude x86-specific hack */
}
=20
+/* A function which spots AIX 'glink' functions. A 'glink' function
+ is a stub function which has something to do with AIX-style dynamic
+ linking, and jumps to the real target (with which it typically
+ shares the same name). See also comment where this function is
+ used (above). */
+static Bool is_aix5_glink_idiom ( Addr sym_addr )
+{
+# if defined(VGP_ppc32_aix5)
+ UInt* w =3D (UInt*)sym_addr;
+ if (VG_IS_4_ALIGNED(w)
+ && is_plausible_guest_addr((Addr)(w+0))
+ && is_plausible_guest_addr((Addr)(w+6))
+ && (w[0] & 0xFFFF0000) =3D=3D 0x81820000 /* lwz r12,func@toc(r2) =
*/
+ && w[1] =3D=3D 0x90410014 /* stw r2,20(r1) */
+ && w[2] =3D=3D 0x800c0000 /* lwz r0,0(r12) */
+ && w[3] =3D=3D 0x804c0004 /* lwz r2,4(r12) */
+ && w[4] =3D=3D 0x7c0903a6 /* mtctr r0 */
+ && w[5] =3D=3D 0x4e800420 /* bctr */
+ && w[6] =3D=3D 0x00000000 /* illegal */)
+ return True;
+# elif defined(VGP_ppc64_aix5)
+ UInt* w =3D (UInt*)sym_addr;
+ if (VG_IS_4_ALIGNED(w)
+ && is_plausible_guest_addr((Addr)(w+0))
+ && is_plausible_guest_addr((Addr)(w+6))
+ && (w[0] & 0xFFFF0000) =3D=3D 0xE9820000 /* ld r12,func@toc(r2) =
*/
+ && w[1] =3D=3D 0xF8410028 /* std r2,40(r1) */
+ && w[2] =3D=3D 0xE80C0000 /* ld r0,0(r12) */
+ && w[3] =3D=3D 0xE84C0008 /* ld r2,8(r12) */
+ && w[4] =3D=3D 0x7c0903a6 /* mtctr r0 */
+ && w[5] =3D=3D 0x4e800420 /* bctr */
+ && w[6] =3D=3D 0x00000000 /* illegal */)
+ return True;
+# endif
+ return False;
+}
=20
/*------------------------------------------------------------*/
/*--- NOTIFY-ON-LOAD FUNCTIONS ---*/
@@ -866,7 +960,7 @@
static void show_spec ( HChar* left, Spec* spec )
{
VG_(message)(Vg_DebugMsg,=20
- "%s%18s %30s %s-> 0x%08llx",
+ "%s%25s %30s %s-> 0x%08llx",
left,
spec->from_sopatt, spec->from_fnpatt,
spec->isWrap ? "W" : "R",
@@ -884,7 +978,7 @@
ok =3D VG_(get_fnname_w_offset)(act->to_addr, name2, 64);
if (!ok) VG_(strcpy)(name2, "???");
=20
- VG_(message)(Vg_DebugMsg, "%s0x%08llx (%10s) %s-> 0x%08llx %s",=20
+ VG_(message)(Vg_DebugMsg, "%s0x%08llx (%20s) %s-> 0x%08llx %s",=20
left,=20
(ULong)act->from_addr, name1,
act->isWrap ? "W" : "R",
Modified: branches/AIX5/include/pub_tool_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
--- branches/AIX5/include/pub_tool_redir.h 2006-10-01 18:16:56 UTC (rev 6=
131)
+++ branches/AIX5/include/pub_tool_redir.h 2006-10-01 18:20:35 UTC (rev 6=
132)
@@ -136,8 +136,10 @@
_ --> Zu (underscore)
- --> Zh (hyphen)
(space) --> Zs (space)
- @ -> ZA (at)
+ @ --> ZA (at)
Z --> ZZ (Z)
+ ( --> ZL (left)
+ ) --> ZR (right)
=20
Everything else is left unchanged.
*/
@@ -146,12 +148,17 @@
changed accordingly. NOTE: duplicates
I_{WRAP,REPLACE}_SONAME_FNNAME_Z{U,Z} in valgrind.h. */
=20
-#define VG_REPLACE_FUNCTION_ZU(soname,fnname) _vgrZU_##soname##_##fnname
-#define VG_REPLACE_FUNCTION_ZZ(soname,fnname) _vgrZZ_##soname##_##fnname
+/* Use an extra level of macroisation so as to ensure the soname/fnname
+ args are fully macro-expanded before pasting them together. */
+#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
=20
-#define VG_WRAP_FUNCTION_ZU(soname,fnname) _vgwZU_##soname##_##fnname
-#define VG_WRAP_FUNCTION_ZZ(soname,fnname) _vgwZZ_##soname##_##fnname
+#define VG_REPLACE_FUNCTION_ZU(soname,fnname) VG_CONCAT4(_vgrZU_,soname,=
_,fnname)
+#define VG_REPLACE_FUNCTION_ZZ(soname,fnname) VG_CONCAT4(_vgrZZ_,soname,=
_,fnname)
=20
+#define VG_WRAP_FUNCTION_ZU(soname,fnname) VG_CONCAT4(_vgwZU_,soname,_,f=
nname)
+#define VG_WRAP_FUNCTION_ZZ(soname,fnname) VG_CONCAT4(_vgwZZ_,soname,_,f=
nname)
+
+
#endif // __PUB_TOOL_REDIR_H
=20
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2006-10-01 18:16:58
|
Author: sewardj
Date: 2006-10-01 19:16:56 +0100 (Sun, 01 Oct 2006)
New Revision: 6131
Log:
Change the SysRes type so as to represent both the error value and the
non-error result at the same time.
Modified:
branches/AIX5/include/pub_tool_basics.h
Modified: branches/AIX5/include/pub_tool_basics.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_basics.h 2006-10-01 18:13:14 UTC (rev =
6130)
+++ branches/AIX5/include/pub_tool_basics.h 2006-10-01 18:16:56 UTC (rev =
6131)
@@ -52,13 +52,6 @@
// For varargs types
#include <stdarg.h>
=20
-// Kernel types. Might as well have them here, they're used so broadly
-// (eg. in pub_core_threadstate.h).
-#if defined(VGO_linux)
-# include "vki-linux.h"
-#else
-# error Unknown OS
-#endif
=20
/* ---------------------------------------------------------------------
builtin types
@@ -87,6 +80,7 @@
# define NULL ((void*)0)
#endif
=20
+
/* ---------------------------------------------------------------------
non-builtin types
------------------------------------------------------------------ */
@@ -98,15 +92,35 @@
typedef UInt ThreadId;
=20
/* An abstraction of syscall return values.
- When .isError =3D=3D False, val holds the return value.
- When .isError =3D=3D True, val holds the error code.
+ Linux:
+ When .isError =3D=3D False,=20
+ res holds the return value, and err is zero.
+ When .isError =3D=3D True, =20
+ err holds the error code, and res is zero.
+
+ AIX:
+ res is the POSIX result of the syscall.
+ err is the corresponding errno value.
+ isError =3D=3D=3D err=3D=3D0
+
+ Unlike on Linux, it is possible for 'err' to be nonzero (thus an
+ error has occurred), nevertheless 'res' is also nonzero. AIX
+ userspace does not appear to consistently inspect 'err' to
+ determine whether or not an error has occurred. For example,
+ sys_open() will return -1 for 'val' if a file cannot be opened,
+ as well as the relevant errno value in 'err', but AIX userspace
+ then consults 'val' to figure out if the syscall failed, rather
+ than looking at 'err'. Hence we need to represent them both.
*/
-typedef struct {=20
- UWord val;
- Bool isError;
-}
-SysRes;
+typedef
+ struct {
+ UWord res;
+ UWord err;
+ Bool isError;
+ }
+ SysRes;
=20
+
/* ---------------------------------------------------------------------
Miscellaneous (word size, endianness, regparmness, stringification)
------------------------------------------------------------------ */
|
|
From: <sv...@va...> - 2006-10-01 18:13:17
|
Author: sewardj
Date: 2006-10-01 19:13:14 +0100 (Sun, 01 Oct 2006)
New Revision: 6130
Log:
- AIX implementations of various stuff, nothing surprising.
- For all platforms: make VG_(read) and VG_(write) return (negative)
actual error values rather than producing -1 for all failures.
Modified:
branches/AIX5/coregrind/m_libcfile.c
branches/AIX5/coregrind/pub_core_libcfile.h
branches/AIX5/include/pub_tool_libcfile.h
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/m_libcfile.c 2006-10-01 18:07:31 UTC (rev 612=
9)
+++ branches/AIX5/coregrind/m_libcfile.c 2006-10-01 18:13:14 UTC (rev 613=
0)
@@ -28,7 +28,10 @@
The GNU General Public License is contained in the file COPYING.
*/
=20
+#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
@@ -36,7 +39,6 @@
#include "pub_core_libcproc.h" // VG_(getpid), VG_(getppid)
#include "pub_core_clientstate.h" // VG_(fd_hard_limit)
#include "pub_core_syscall.h"
-#include "vki_unistd.h"
=20
/* ---------------------------------------------------------------------
File stuff
@@ -60,6 +62,7 @@
if (newfd !=3D -1)
VG_(close)(oldfd);
=20
+ /* Set the close-on-exec flag for this fd. */
VG_(fcntl)(newfd, VKI_F_SETFD, VKI_FD_CLOEXEC);
=20
vg_assert(newfd >=3D VG_(fd_hard_limit));
@@ -95,14 +98,30 @@
=20
Int VG_(read) ( Int fd, void* buf, Int count)
{
+ Int ret;
SysRes res =3D VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count);
- return res.isError ? -1 : res.val;
+ if (res.isError) {
+ ret =3D - (Int)(Word)res.err;
+ vg_assert(ret < 0);
+ } else {
+ ret =3D (Int)(Word)res.res;
+ vg_assert(ret >=3D 0);
+ }
+ return ret;
}
=20
Int VG_(write) ( Int fd, const void* buf, Int count)
{
+ Int ret;
SysRes res =3D VG_(do_syscall3)(__NR_write, fd, (UWord)buf, count);
- return res.isError ? -1 : res.val;
+ if (res.isError) {
+ ret =3D - (Int)(Word)res.err;
+ vg_assert(ret < 0);
+ } else {
+ ret =3D (Int)(Word)res.res;
+ vg_assert(ret >=3D 0);
+ }
+ return ret;
}
=20
Int VG_(pipe) ( Int fd[2] )
@@ -114,39 +133,61 @@
OffT VG_(lseek) ( Int fd, OffT offset, Int whence )
{
SysRes res =3D VG_(do_syscall3)(__NR_lseek, fd, offset, whence);
- return res.isError ? (-1) : res.val;
+ return res.isError ? (-1) : res.res;
/* if you change the error-reporting conventions of this, also
change VG_(pread) and all other usage points. */
}
=20
SysRes VG_(stat) ( Char* file_name, struct vki_stat* buf )
{
+# if defined(VGO_linux)
SysRes res =3D VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)b=
uf);
return res;
+# elif defined(VGO_aix5)
+ SysRes res =3D VG_(do_syscall4)(__NR_AIX5_statx,
+ (UWord)file_name,
+ (UWord)buf,
+ sizeof(struct vki_stat),
+ VKI_STX_NORMAL);
+ return res;
+# else
+# error Unknown OS
+# endif
}
=20
Int VG_(fstat) ( Int fd, struct vki_stat* buf )
{
+# if defined(VGO_linux)
SysRes res =3D VG_(do_syscall2)(__NR_fstat, fd, (UWord)buf);
return res.isError ? (-1) : 0;
+# elif defined(VGO_aix5)
+ I_die_here;
+# else
+# error Unknown OS
+# endif
}
=20
Int VG_(fsize) ( Int fd )
{
-#ifdef __NR_fstat64
+# if defined(VGO_linux) && defined(__NR_fstat64)
struct vki_stat64 buf;
SysRes res =3D VG_(do_syscall2)(__NR_fstat64, fd, (UWord)&buf);
-#else
+ return res.isError ? (-1) : buf.st_size;
+# elif defined(VGO_linux) && !defined(__NR_fstat64)
struct vki_stat buf;
SysRes res =3D VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
-#endif
return res.isError ? (-1) : buf.st_size;
+# elif defined(VGO_aix5)
+ I_die_here;
+# else
+# error Unknown OS
+# endif
}
=20
Bool VG_(is_dir) ( HChar* f )
{
struct vki_stat buf;
- SysRes res =3D VG_(do_syscall2)(__NR_stat, (UWord)f, (UWord)&buf);
+ SysRes res =3D VG_(stat)(f, &buf);
return res.isError ? False
: VKI_S_ISDIR(buf.st_mode) ? True : False;
}
@@ -160,7 +201,7 @@
Int VG_(fcntl) ( Int fd, Int cmd, Int arg )
{
SysRes res =3D VG_(do_syscall3)(__NR_fcntl, fd, cmd, arg);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
}
=20
Int VG_(rename) ( Char* old_name, Char* new_name )
@@ -175,14 +216,25 @@
return res.isError ? (-1) : 0;
}
=20
-/* Nb: we do not allow the Linux extension which malloc()s memory for th=
e
- buffer if buf=3D=3DNULL, because we don't want Linux calling malloc()=
*/
Bool VG_(getcwd) ( Char* buf, SizeT size )
{
+# if defined(VGO_linux)
SysRes res;
vg_assert(buf !=3D NULL);
res =3D VG_(do_syscall2)(__NR_getcwd, (UWord)buf, size);
return res.isError ? False : True;
+# elif defined(VGO_aix5)
+ static Int complaints =3D 3;
+ if (complaints-- > 0)
+ VG_(debugLog)(0, "libcfile",
+ "Warning: AIX5: m_libcfile.c: kludged 'getcwd'\n"=
);
+ if (size < 2) return False;
+ buf[0] =3D '.';
+ buf[1] =3D 0;
+ return True;
+# else
+# error Unknown OS
+# endif
}
=20
Int VG_(readlink) (Char* path, Char* buf, UInt bufsiz)
@@ -190,7 +242,7 @@
SysRes res;
/* res =3D readlink( path, buf, bufsiz ); */
res =3D VG_(do_syscall3)(__NR_readlink, (UWord)path, (UWord)buf, bufs=
iz);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
}
=20
Int VG_(getdents) (UInt fd, struct vki_dirent *dirp, UInt count)
@@ -198,14 +250,14 @@
SysRes res;
/* res =3D getdents( fd, dirp, count ); */
res =3D VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, count);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
}
=20
/* Check accessibility of a file. Returns zero for access granted,
nonzero otherwise. */
Int VG_(access) ( HChar* path, Bool irusr, Bool iwusr, Bool ixusr )
{
-#if defined(VGO_linux)
+# if defined(VGO_linux)
/* Very annoyingly, I cannot find any definition for R_OK et al in
the kernel interfaces. Therefore I reluctantly resort to
hardwiring in these magic numbers that I determined by
@@ -214,10 +266,16 @@
| (iwusr ? 2/*W_OK*/ : 0)
| (ixusr ? 1/*X_OK*/ : 0);
SysRes res =3D VG_(do_syscall2)(__NR_access, (UWord)path, w);
- return res.isError ? 1 : res.val;
-#else
-# error "Don't know how to do VG_(access) on this OS"
-#endif
+ return res.isError ? 1 : 0;
+# elif defined(VGO_aix5)
+ UWord w =3D (irusr ? VKI_R_OK : 0)
+ | (iwusr ? VKI_W_OK : 0)
+ | (ixusr ? VKI_X_OK : 0);
+ SysRes res =3D VG_(do_syscall2)(__NR_access, (UWord)path, w);
+ return res.isError ? 1 : 0; =20
+# else
+# error "Don't know how to do VG_(access) on this OS"
+# endif
}
=20
/*=20
@@ -239,11 +297,11 @@
=20
res =3D VG_(stat)(f, &st);
if (res.isError) {
- return res.val;
+ return res.err;
}
=20
if (st.st_mode & (VKI_S_ISUID | VKI_S_ISGID)) {
- //VG_(printf)("Can't execute suid/sgid executable %s\n", exe);
+ /* VG_(printf)("Can't execute suid/sgid executable %s\n", exe); */
return VKI_EACCES;
}
=20
@@ -321,7 +379,7 @@
if (sres.isError)
continue;
/* VG_(safe_fd) doesn't return if it fails. */
- fd =3D VG_(safe_fd)( sres.val );
+ fd =3D VG_(safe_fd)( sres.res );
if (fullname)
VG_(strcpy)( fullname, buf );
return fd;
@@ -341,7 +399,12 @@
Int my_socket ( Int domain, Int type, Int protocol );
=20
static
-Int my_connect ( Int sockfd, struct vki_sockaddr_in* serv_addr,=20
+Int my_connect ( Int sockfd,=20
+# if defined(VGO_linux)
+ struct vki_sockaddr_in* serv_addr,=20
+# else
+ void* serv_addr,
+# endif
Int addrlen );
=20
UInt VG_(htonl) ( UInt x )
@@ -399,6 +462,9 @@
*/
Int VG_(connect_via_socket)( UChar* str )
{
+#if defined(VGO_aix5)
+ I_die_here;
+#else /* Yay, Linux */
Int sd, res;
struct vki_sockaddr_in servAddr;
UInt ip =3D 0;
@@ -433,13 +499,14 @@
}
=20
return sd;
+#endif
}
=20
=20
/* Let d =3D one or more digits. Accept either:
d.d.d.d or d.d.d.d:d
*/
-Int parse_inet_addr_and_port ( UChar* str, UInt* ip_addr, UShort* port )
+static Int parse_inet_addr_and_port ( UChar* str, UInt* ip_addr, UShort*=
port )
{
# define GET_CH ((*str) ? (*str++) : 0)
UInt ipa, i, j, c, any;
@@ -490,20 +557,28 @@
args[1] =3D type;
args[2] =3D protocol;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_SOCKET, (UWord)&arg=
s);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
SysRes res;
res =3D VG_(do_syscall3)(__NR_socket, domain, type, protocol );
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
# error Unknown arch
#endif
}
=20
static
-Int my_connect ( Int sockfd, struct vki_sockaddr_in* serv_addr,=20
+Int my_connect ( Int sockfd,
+# if defined(VGO_linux)
+ struct vki_sockaddr_in* serv_addr,=20
+# else
+ void* serv_addr,
+# endif
Int addrlen )
{
#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
@@ -513,13 +588,16 @@
args[1] =3D (UWord)serv_addr;
args[2] =3D addrlen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_CONNECT, (UWord)&ar=
gs);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
SysRes res;
res =3D VG_(do_syscall3)(__NR_connect, sockfd, (UWord)serv_addr, addr=
len);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
# error Unknown arch
#endif
@@ -528,10 +606,9 @@
Int VG_(write_socket)( Int sd, void *msg, Int count )
{
/* This is actually send(). */
- /* Requests not to send SIGPIPE on errors on stream oriented
- sockets when the other end breaks the connection. The EPIPE
- error is still returned. */
- Int flags =3D VKI_MSG_NOSIGNAL;
+ /* For Linux, VKI_MSG_NOSIGNAL is a request not to send SIGPIPE on
+ errors on stream oriented sockets when the other end breaks the
+ connection. The EPIPE error is still returned. */
=20
#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
SysRes res;
@@ -539,15 +616,19 @@
args[0] =3D sd;
args[1] =3D (UWord)msg;
args[2] =3D count;
- args[3] =3D flags;
+ args[3] =3D VKI_MSG_NOSIGNAL;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_SEND, (UWord)&args)=
;
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
SysRes res;
- res =3D VG_(do_syscall6)(__NR_sendto, sd, (UWord)msg, count, flags, 0=
,0);
- return res.isError ? -1 : res.val;
+ res =3D VG_(do_syscall6)(__NR_sendto, sd, (UWord)msg,=20
+ count, VKI_MSG_NOSIGNAL, 0,0);
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
# error Unknown arch
#endif
@@ -555,21 +636,24 @@
=20
Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen)
{
+#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
SysRes res;
-
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
UWord args[3];
args[0] =3D sd;
args[1] =3D (UWord)name;
args[2] =3D (UWord)namelen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKNAME, (UWord=
)&args);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
+ SysRes res;
res =3D VG_(do_syscall3)( __NR_getsockname,
(UWord)sd, (UWord)name, (UWord)namelen );
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
# error Unknown arch
#endif
@@ -577,32 +661,34 @@
=20
Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen)
{
+#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
SysRes res;
-
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
UWord args[3];
args[0] =3D sd;
args[1] =3D (UWord)name;
args[2] =3D (UWord)namelen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETPEERNAME, (UWord=
)&args);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
+ SysRes res;
res =3D VG_(do_syscall3)( __NR_getpeername,
(UWord)sd, (UWord)name, (UWord)namelen );
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
-# error Unknown archx
+# error Unknown arch
#endif
}
=20
Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval,
Int *optlen)
{
+#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
SysRes res;
-
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_pp=
c64_linux)
UWord args[5];
args[0] =3D sd;
args[1] =3D level;
@@ -610,14 +696,18 @@
args[3] =3D (UWord)optval;
args[4] =3D (UWord)optlen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKOPT, (UWord)=
&args);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
#elif defined(VGP_amd64_linux)
+ SysRes res;
res =3D VG_(do_syscall5)( __NR_getsockopt,
(UWord)sd, (UWord)level, (UWord)optname,=20
(UWord)optval, (UWord)optlen );
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
=20
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ I_die_here;
+
#else
# error Unknown arch
#endif
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/pub_core_libcfile.h 2006-10-01 18:07:31 UTC (=
rev 6129)
+++ branches/AIX5/coregrind/pub_core_libcfile.h 2006-10-01 18:13:14 UTC (=
rev 6130)
@@ -34,6 +34,7 @@
//--------------------------------------------------------------------
// PURPOSE: This module contains all the libc code that relates to
// files and sockets: opening, reading, writing, etc.
+// To use, you must first include: pub_core_vki.h
//--------------------------------------------------------------------
=20
#include "pub_tool_libcfile.h"
Modified: branches/AIX5/include/pub_tool_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
--- branches/AIX5/include/pub_tool_libcfile.h 2006-10-01 18:07:31 UTC (re=
v 6129)
+++ branches/AIX5/include/pub_tool_libcfile.h 2006-10-01 18:13:14 UTC (re=
v 6130)
@@ -35,6 +35,8 @@
File-related functions.
------------------------------------------------------------------ */
=20
+/* To use this file you must first include pub_tool_vki.h. */
+
extern SysRes VG_(open) ( const Char* pathname, Int flags, Int mode );
extern void VG_(close) ( Int fd );
extern Int VG_(read) ( Int fd, void* buf, Int count);
|
|
From: <sv...@va...> - 2006-10-01 18:07:34
|
Author: sewardj
Date: 2006-10-01 19:07:31 +0100 (Sun, 01 Oct 2006)
New Revision: 6129
Log:
Changes to support XCOFF:
- allow modules to have 'member names' as well as file names. A member
name is a "foo.o" name inside a "bar.a"; necessary as AIX
keeps all its dynamic libraries in .a files.
- rename the type RiLoc to DiLoc (this holds a line number indication).
No idea why it was called RiLoc in the first place.
- trace changes in type SysRes
- implement VG_(di_aix5_notify_segchange)
Modified:
branches/AIX5/coregrind/m_debuginfo/debuginfo.c
branches/AIX5/coregrind/m_debuginfo/priv_storage.h
branches/AIX5/coregrind/m_debuginfo/readelf.c
branches/AIX5/coregrind/m_debuginfo/storage.c
Modified: branches/AIX5/coregrind/m_debuginfo/debuginfo.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_debuginfo/debuginfo.c 2006-10-01 18:02:23 U=
TC (rev 6128)
+++ branches/AIX5/coregrind/m_debuginfo/debuginfo.c 2006-10-01 18:07:31 U=
TC (rev 6129)
@@ -35,6 +35,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h" /* self */
#include "pub_core_demangle.h"
@@ -45,12 +46,19 @@
#include "pub_core_options.h"
#include "pub_core_redir.h" // VG_(redir_notify_{new,delete}_SegIn=
fo)
#include "pub_core_aspacemgr.h"
+#include "pub_core_machine.h" // VG_PLAT_USES_PPCTOC
#include "priv_storage.h"
#include "priv_readdwarf.h"
#include "priv_readstabs.h"
-#include "priv_readelf.h"
+#if defined(VGO_linux)
+# include "priv_readelf.h"
+#elif defined(VGO_aix5)
+# include "pub_core_debuglog.h"
+# include "pub_core_libcproc.h"
+# include "pub_core_libcfile.h"
+# include "priv_readxcoff.h"
+#endif
=20
-
/*------------------------------------------------------------*/
/*--- Root structure ---*/
/*------------------------------------------------------------*/
@@ -71,7 +79,8 @@
/* Allocate and zero out a new SegInfo record. */
static=20
SegInfo* alloc_SegInfo(Addr start, SizeT size, OffT foffset,=20
- const HChar* filename)
+ const UChar* filename,
+ const UChar* memname)
{
SegInfo* si =3D VG_(arena_calloc)(VG_AR_SYMTAB, 1, sizeof(SegInfo));
=20
@@ -79,6 +88,8 @@
si->size =3D size;
si->foffset =3D foffset;
si->filename =3D VG_(arena_strdup)(VG_AR_SYMTAB, filename);
+ si->memname =3D memname ? VG_(arena_strdup)(VG_AR_SYMTAB, memname)
+ : NULL;
=20
// Everything else -- pointers, sizes, arrays -- is zeroed by calloc.
return si;
@@ -109,6 +120,12 @@
*/
static void discard_SegInfo ( SegInfo* si )
{
+# if defined(VGO_aix5)
+ HChar* reason =3D "__unload";
+# else
+ HChar* reason =3D "munmap()";
+# endif
+
SegInfo** prev_next_ptr =3D &segInfo_list;
SegInfo* curr =3D segInfo_list;
=20
@@ -117,9 +134,10 @@
// Found it; remove from list and free it.
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(message)(Vg_DebugMsg,=20
- "Discarding syms at %p-%p in %s due to munmap()=
",=20
+ "Discarding syms at %p-%p in %s due to %s",=20
si->start, si->start + si->size,
- curr->filename ? curr->filename : (UChar*)"???"=
);
+ curr->filename ? curr->filename : (UChar*)"???"=
,
+ reason);
vg_assert(*prev_next_ptr =3D=3D curr);
*prev_next_ptr =3D curr->next;
VG_(redir_notify_delete_SegInfo)( curr );
@@ -169,12 +187,29 @@
/* Create a new SegInfo with the specific address/length/vma offset,
then snarf whatever info we can from the given filename into it. */
static
-SegInfo* acquire_syms_for_range( Addr seg_addr, SizeT seg_len,
- OffT seg_offset, const Char* seg_filena=
me)
+SegInfo* acquire_syms_for_range(=20
+ /* ALL */ Addr seg_addr,=20
+ /* ALL */ SizeT seg_len,
+ /* ELF only */ OffT seg_offset,=20
+ /* ALL */ const UChar* seg_filename,
+ /* XCOFF only */ const UChar* seg_memname,
+ /* XCOFF only */ Addr data_addr,
+ /* XCOFF only */ SizeT data_len,
+ /* XCOFF only */ Bool is_mainexe
+ )
{
- SegInfo* si =3D alloc_SegInfo(seg_addr, seg_len, seg_offset, seg_file=
name);
+ Bool ok;
+ SegInfo* si =3D alloc_SegInfo(seg_addr, seg_len, seg_offset,=20
+ seg_filename, seg_memname);
+# if defined(VGO_linux)
+ ok =3D ML_(read_elf_debug_info) ( si );
+# elif defined(VGO_aix5)
+ ok =3D ML_(read_xcoff_debug_info) ( si, data_addr, data_len, is_maine=
xe );
+# else
+# error Unknown OS
+# endif
=20
- if (! ML_(read_elf_debug_info) ( si )) {
+ if (!ok) {
// Something went wrong (eg. bad ELF file).
free_SegInfo( si );
si =3D NULL;
@@ -194,12 +229,14 @@
}
=20
=20
-/*------------------------------------------------------------*/
-/*--- ---*/
-/*--- TOP LEVEL: NOTIFICATION (ACQUIRE/DISCARD INFO) ---*/
-/*--- ---*/
-/*------------------------------------------------------------*/
+/*--------------------------------------------------------------*/
+/*--- ---*/
+/*--- TOP LEVEL: NOTIFICATION (ACQUIRE/DISCARD INFO) (LINUX) ---*/
+/*--- ---*/
+/*--------------------------------------------------------------*/
=20
+#if defined(VGO_linux)
+
/* The debug info system is driven by notifications that a text
segment has been mapped in, or unmapped. When that happens it
tries to acquire/discard whatever info is available for the
@@ -215,7 +252,7 @@
=20
void VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV )
{
- NSegment* seg;
+ NSegment const * seg;
HChar* filename;
Bool ok;
=20
@@ -259,7 +296,7 @@
seg =3D VG_(am_find_nsegment)(a);
vg_assert(seg);
=20
- filename =3D VG_(am_get_filename)( seg );
+ filename =3D VG_(am_get_filename)( (NSegment*)seg );
if (!filename)
return;
=20
@@ -283,7 +320,8 @@
=20
/* .. and acquire new info. */
acquire_syms_for_range( seg->start, seg->end + 1 - seg->start,=20
- seg->offset, filename );
+ seg->offset, filename,
+ /* XCOFF only */ NULL, 0, 0, False );
=20
/* acquire_syms_for_range makes its own copy of filename, so is
safe to free it. */
@@ -313,7 +351,71 @@
discard_syms_in_range(a, len);
}
=20
+#endif /* defined(VGO_linux) */
=20
+
+/*-------------------------------------------------------------*/
+/*--- ---*/
+/*--- TOP LEVEL: NOTIFICATION (ACQUIRE/DISCARD INFO) (AIX5) ---*/
+/*--- ---*/
+/*-------------------------------------------------------------*/
+
+#if defined(VGO_aix5)
+
+/* The supplied parameters describe a code segment and its associated
+ data segment, that have recently been mapped in -- so we need to
+ read debug info for it -- or conversely, have recently been dumped,
+ in which case the relevant debug info has to be unloaded. */
+
+void VG_(di_aix5_notify_segchange)(=20
+ Addr code_start,
+ Word code_len,
+ Addr data_start,
+ Word data_len,
+ UChar* file_name,
+ UChar* mem_name,
+ Bool is_mainexe,
+ Bool acquire )
+{
+ SegInfo* si;
+
+ if (acquire) {
+
+ acquire_syms_for_range(
+ /* ALL */ code_start,=20
+ /* ALL */ code_len,
+ /* ELF only */ 0,
+ /* ALL */ file_name,
+ /* XCOFF only */ mem_name,
+ /* XCOFF only */ data_start,
+ /* XCOFF only */ data_len,
+ /* XCOFF only */ is_mainexe=20
+ );
+
+ } else {
+
+ /* Dump all the segInfos which intersect code_start/code_len. */
+ while (True) {
+ for (si =3D segInfo_list; si; si =3D si->next) {
+ if (code_start + code_len <=3D si->start
+ || si->start + si->size <=3D code_start)
+ continue; /* no overlap */
+ else=20
+ break;
+ }
+ if (si =3D=3D NULL)
+ break;
+ /* Need to delete 'si' */
+ discard_SegInfo(si);
+ }
+
+ }
+}
+ =20
+
+#endif /* defined(VGO_aix5) */
+
+
/*------------------------------------------------------------*/
/*--- ---*/
/*--- TOP LEVEL: QUERYING EXISTING DEBUG INFO ---*/
@@ -498,11 +600,25 @@
Caller supplies buf and nbuf. */
Bool VG_(get_objname) ( Addr a, Char* buf, Int nbuf )
{
+ Int used;
SegInfo* si;
=20
+ vg_assert(nbuf > 0);
for (si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
if (si->start <=3D a && a < si->start+si->size) {
VG_(strncpy_safely)(buf, si->filename, nbuf);
+ if (si->memname) {
+ used =3D VG_(strlen)(buf);
+ if (used < nbuf)=20
+ VG_(strncpy_safely)(&buf[used], "(", nbuf-used);
+ used =3D VG_(strlen)(buf);
+ if (used < nbuf)=20
+ VG_(strncpy_safely)(&buf[used], si->memname, nbuf-used);
+ used =3D VG_(strlen)(buf);
+ if (used < nbuf)=20
+ VG_(strncpy_safely)(&buf[used], ")", nbuf-used);
+ }
+ buf[nbuf-1] =3D 0;
return True;
}
}
@@ -589,6 +705,43 @@
}
=20
=20
+/* Map a function name to its entry point and toc pointer. Is done by
+ sequential search of all symbol tables, so is very slow. To
+ mitigate the worst performance effects, you may specify a soname
+ pattern, and only objects matching that pattern are searched.
+ Therefore specify "*" to search all the objects. On TOC-afflicted
+ platforms, a symbol is deemed to be found only if it has a nonzero
+ TOC pointer. */
+Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, Addr* pEnt, Add=
r* pToc)
+{
+ Bool require_pToc =3D False;
+ Int i;
+ SegInfo* si;
+ Bool debug =3D False;
+# if defined(VG_PLAT_USES_PPCTOC)
+ require_pToc =3D True;
+# endif
+ for (si =3D segInfo_list; si; si =3D si->next) {
+ if (debug)
+ VG_(printf)("lookup_symbol_SLOW: considering %s\n", si->soname)=
;
+ if (!VG_(string_match)(sopatt, si->soname)) {
+ if (debug)
+ VG_(printf)(" ... skip\n");
+ continue;
+ }
+ for (i =3D 0; i < si->symtab_used; i++) {
+ if (0=3D=3DVG_(strcmp)(name, si->symtab[i].name)
+ && (require_pToc ? si->symtab[i].tocptr : True)) {
+ *pEnt =3D si->symtab[i].addr;
+ *pToc =3D si->symtab[i].tocptr;
+ return True;
+ }
+ }
+ }
+ return False;
+}
+
+
/* Print into buf info on code address, function name and filename */
=20
static Int putStr ( Int n, Int n_buf, Char* buf, Char* str )=20
@@ -631,7 +784,9 @@
static UChar buf_srcloc[BUF_LEN];
static UChar buf_dirname[BUF_LEN];
Bool know_dirinfo =3D False;
- Bool know_fnname =3D VG_(get_fnname) (eip, buf_fn, BUF_LEN);
+ Bool know_fnname =3D VG_(clo_sym_offsets)
+ ? VG_(get_fnname_w_offset) (eip, buf_fn, BUF_LEN=
)
+ : VG_(get_fnname) (eip, buf_fn, BUF_LEN);
Bool know_objname =3D VG_(get_objname)(eip, buf_obj, BUF_LEN);
Bool know_srcloc =3D VG_(get_filename_linenum)(
eip,=20
@@ -920,13 +1075,15 @@
void VG_(seginfo_syms_getidx) ( const SegInfo *si,=20
Int idx,
/*OUT*/Addr* addr,
+ /*OUT*/Addr* tocptr,
/*OUT*/UInt* size,
/*OUT*/HChar** name )
{
vg_assert(idx >=3D 0 && idx < si->symtab_used);
- if (addr) *addr =3D si->symtab[idx].addr;
- if (size) *size =3D si->symtab[idx].size;
- if (name) *name =3D (HChar*)si->symtab[idx].name;
+ if (addr) *addr =3D si->symtab[idx].addr;
+ if (tocptr) *tocptr =3D si->symtab[idx].tocptr;
+ if (size) *size =3D si->symtab[idx].size;
+ if (name) *name =3D (HChar*)si->symtab[idx].name;
}
=20
=20
Modified: branches/AIX5/coregrind/m_debuginfo/priv_storage.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_debuginfo/priv_storage.h 2006-10-01 18:02:2=
3 UTC (rev 6128)
+++ branches/AIX5/coregrind/m_debuginfo/priv_storage.h 2006-10-01 18:07:3=
1 UTC (rev 6129)
@@ -142,6 +142,7 @@
Addr start;
UInt size;
UChar* filename; /* in mallocville */
+ UChar* memname; /* malloc'd. AIX5 only: .a member name */
OffT foffset;
UChar* soname;
=20
Modified: branches/AIX5/coregrind/m_debuginfo/readelf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_debuginfo/readelf.c 2006-10-01 18:02:23 UTC=
(rev 6128)
+++ branches/AIX5/coregrind/m_debuginfo/readelf.c 2006-10-01 18:07:31 UTC=
(rev 6129)
@@ -35,6 +35,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcassert.h"
@@ -737,8 +738,8 @@
if (fd.isError)
return 0;
=20
- if (VG_(fstat)(fd.val, &stat_buf) !=3D 0) {
- VG_(close)(fd.val);
+ if (VG_(fstat)(fd.res, &stat_buf) !=3D 0) {
+ VG_(close)(fd.res);
return 0;
}
=20
@@ -748,23 +749,23 @@
*size =3D stat_buf.st_size;
=20
sres =3D VG_(am_mmap_file_float_valgrind)
- ( *size, VKI_PROT_READ, fd.val, 0 );
+ ( *size, VKI_PROT_READ, fd.res, 0 );
=20
- VG_(close)(fd.val);
+ VG_(close)(fd.res);
=20
if (sres.isError)
return 0;
=20
- calccrc =3D calc_gnu_debuglink_crc32(0, (UChar*)sres.val, *size);
+ calccrc =3D calc_gnu_debuglink_crc32(0, (UChar*)sres.res, *size);
if (calccrc !=3D crc) {
- SysRes res =3D VG_(am_munmap_valgrind)(sres.val, *size);
+ SysRes res =3D VG_(am_munmap_valgrind)(sres.res, *size);
vg_assert(!res.isError);
if (VG_(clo_verbosity) > 1)
VG_(message)(Vg_DebugMsg, "... CRC mismatch (computed %08x wanted %08x=
)", calccrc, crc);
return 0;
}
=20
- return sres.val;
+ return sres.res;
}
=20
/*
@@ -837,17 +838,17 @@
return False;
}
=20
- n_oimage =3D VG_(fsize)(fd.val);
+ n_oimage =3D VG_(fsize)(fd.res);
if (n_oimage < 0) {
ML_(symerr)("Can't stat .so/.exe (to determine its size)?!");
- VG_(close)(fd.val);
+ VG_(close)(fd.res);
return False;
}
=20
sres =3D VG_(am_mmap_file_float_valgrind)
- ( n_oimage, VKI_PROT_READ, fd.val, 0 );
+ ( n_oimage, VKI_PROT_READ, fd.res, 0 );
=20
- VG_(close)(fd.val);
+ VG_(close)(fd.res);
=20
if (sres.isError) {
VG_(message)(Vg_UserMsg, "warning: mmap failed on %s", si->filenam=
e );
@@ -855,7 +856,7 @@
return False;
}
=20
- oimage =3D sres.val;
+ oimage =3D sres.res;
=20
/* Ok, the object image is safely in oimage[0 .. n_oimage-1].=20
Now verify that it is a valid ELF .so or executable image.
Modified: branches/AIX5/coregrind/m_debuginfo/storage.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_debuginfo/storage.c 2006-10-01 18:02:23 UTC=
(rev 6128)
+++ branches/AIX5/coregrind/m_debuginfo/storage.c 2006-10-01 18:07:31 UTC=
(rev 6129)
@@ -562,7 +562,7 @@
ranges do not overlap. This facilitates using binary search to map
addresses to locations when we come to query the table.
*/
-static Int compare_RiLoc ( void* va, void* vb )=20
+static Int compare_DiLoc ( void* va, void* vb )=20
{
DiLoc* a =3D (DiLoc*)va;
DiLoc* b =3D (DiLoc*)vb;
@@ -583,7 +583,7 @@
=20
/* Sort by start address. */
VG_(ssort)(si->loctab, si->loctab_used,=20
- sizeof(*si->loctab), compare_RiLoc);
+ sizeof(*si->loctab), compare_DiLoc);
=20
/* If two adjacent entries overlap, truncate the first. */
for (i =3D 0; i < ((Int)si->loctab_used)-1; i++) {
|
|
From: <sv...@va...> - 2006-10-01 18:02:27
|
Author: sewardj
Date: 2006-10-01 19:02:23 +0100 (Sun, 01 Oct 2006)
New Revision: 6128
Log:
Interface changes for m_debuginfo:
- new fn VG_(di_aix5_notify_segchange) to notify XCOFF loads/unloads
- new fn VG_(lookup_symbol_SLOW) for looking up the address of a fn
given its name and soname
Modified:
branches/AIX5/coregrind/pub_core_debuginfo.h
branches/AIX5/include/pub_tool_debuginfo.h
Modified: branches/AIX5/coregrind/pub_core_debuginfo.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_debuginfo.h 2006-10-01 17:57:12 UTC =
(rev 6127)
+++ branches/AIX5/coregrind/pub_core_debuginfo.h 2006-10-01 18:02:23 UTC =
(rev 6128)
@@ -39,18 +39,39 @@
=20
#include "pub_tool_debuginfo.h"
=20
-/* Notify the debuginfo system about a new mapping. This is the way
- new debug information gets loaded. If allow_SkFileV is True, it
- will try load debug info if the mapping at 'a' belongs to Valgrind;
- whereas normally (False) it will not do that. This allows us to
- carefully control when the thing will read symbols from the
- Valgrind executable itself. */
+/* LINUX: Notify the debuginfo system about a new mapping, or the
+ disappearance of such, or a permissions change on an existing
+ mapping. This is the way new debug information gets loaded. If
+ allow_SkFileV is True, it will try load debug info if the mapping
+ at 'a' belongs to Valgrind; whereas normally (False) it will not do
+ that. This allows us to carefully control when the thing will read
+ symbols from the Valgrind executable itself. */
+#if defined(VGO_linux)
extern void VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV );
=20
extern void VG_(di_notify_munmap)( Addr a, SizeT len );
=20
extern void VG_(di_notify_mprotect)( Addr a, SizeT len, UInt prot );
+#endif
=20
+#if defined(VGO_aix5)
+/* AIX5: Very similar, except packaged more neatly. The supplied
+ parameters describe a code segment and its associated data segment,
+ that have recently been mapped in -- so we need to read debug info
+ for it -- or conversely, have recently been dumped, in which case
+ the relevant debug info has to be unloaded. */
+extern void VG_(di_aix5_notify_segchange)(=20
+ Addr code_start,
+ Word code_len,
+ Addr data_start,
+ Word data_len,
+ UChar* file_name,
+ UChar* mem_name,
+ Bool is_mainexe,
+ Bool acquire
+ );
+#endif
+
extern Bool VG_(get_fnname_nodemangle)( Addr a,=20
Char* fnname, Int n_fnname );
=20
@@ -72,6 +93,16 @@
extern
Bool VG_(get_fnname_Z_demangle_only) ( Addr a, Char* buf, Int nbuf );
=20
+/* Map a function name to its entry point and toc pointer. Is done by
+ sequential search of all symbol tables, so is very slow. To
+ mitigate the worst performance effects, you may specify a soname
+ pattern, and only objects matching that pattern are searched.
+ Therefore specify "*" to search all the objects. On TOC-afflicted
+ platforms, a symbol is deemed to be found only if it has a nonzero
+ TOC pointer. */
+extern
+Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, Addr* pEnt, Add=
r* pToc);
+
#endif // __PUB_CORE_DEBUGINFO_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/AIX5/include/pub_tool_debuginfo.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_debuginfo.h 2006-10-01 17:57:12 UTC (r=
ev 6127)
+++ branches/AIX5/include/pub_tool_debuginfo.h 2006-10-01 18:02:23 UTC (r=
ev 6128)
@@ -119,6 +119,7 @@
extern void VG_(seginfo_syms_getidx) ( const SegInfo *si,=20
Int idx,
/*OUT*/Addr* addr,
+ /*OUT*/Addr* tocptr,
/*OUT*/UInt* size,
/*OUT*/HChar** name );
=20
|
|
From: <sv...@va...> - 2006-10-01 17:57:15
|
Author: sewardj
Date: 2006-10-01 18:57:12 +0100 (Sun, 01 Oct 2006)
New Revision: 6127
Log:
Extend for AIX. Nothing surprising here.
Modified:
branches/AIX5/coregrind/m_machine.c
branches/AIX5/coregrind/pub_core_machine.h
branches/AIX5/include/pub_tool_machine.h
Modified: branches/AIX5/coregrind/m_machine.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_machine.c 2006-10-01 17:49:33 UTC (rev 6126=
)
+++ branches/AIX5/coregrind/m_machine.c 2006-10-01 17:57:12 UTC (rev 6127=
)
@@ -29,6 +29,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_threadstate.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcbase.h"
@@ -369,7 +370,7 @@
if (__builtin_setjmp(env_sigill)) {
have_F =3D False;
} else {
- __asm__ __volatile__("fmr 0,0");
+ __asm__ __volatile__(".long 0xFC000090"); /*fmr 0,0 */
}
=20
/* Altivec insns */
@@ -396,7 +397,7 @@
if (__builtin_setjmp(env_sigill)) {
have_FX =3D False;
} else {
- __asm__ __volatile__("fsqrt 0,0");
+ __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0 */
}
=20
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -407,7 +408,7 @@
if (__builtin_setjmp(env_sigill)) {
have_GX =3D False;
} else {
- __asm__ __volatile__("frsqrte 0,0");
+ __asm__ __volatile__(".long 0xFC000034"); /* frsqrte 0,0 */
}
=20
r =3D VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -481,7 +482,7 @@
if (__builtin_setjmp(env_sigill)) {
have_V =3D False;
} else {
- __asm__ __volatile__("vor 0,0,0");
+ __asm__ __volatile__(".long 0x10000484"); /*vor 0,0,0*/
}
=20
/* General-Purpose optional (fsqrt, fsqrts) */
@@ -491,7 +492,7 @@
if (__builtin_setjmp(env_sigill)) {
have_FX =3D False;
} else {
- __asm__ __volatile__("fsqrt 0,0");
+ __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0*/
}
=20
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -501,7 +502,7 @@
if (__builtin_setjmp(env_sigill)) {
have_GX =3D False;
} else {
- __asm__ __volatile__("frsqrte 0,0");
+ __asm__ __volatile__(".long 0xFC000034"); /*frsqrte 0,0*/
}
=20
VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -581,22 +582,18 @@
=20
=20
// Given a pointer to a function as obtained by "& functionname" in C,
-// produce a pointer to the actual entry point for the function. For
-// most platforms it's the identity function. Unfortunately, on
-// ppc64-linux it isn't (sigh).
+// produce a pointer to the actual entry point for the function.
void* VG_(fnptr_to_fnentry)( void* f )
{
-#if defined(VGP_x86_linux)
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \
+ || defined(VGP_ppc32_linux)
return f;
-#elif defined(VGP_amd64_linux)
- return f;
-#elif defined(VGP_ppc32_linux)
- return f;
-#elif defined(VGP_ppc64_linux)
- /* f is a pointer to a 3-word function descriptor, of which
- the first word is the entry address. */
- /* Don't ask me. Really. I have no idea why. */
- ULong* descr =3D (ULong*)f;
+#elif defined(VGP_ppc64_linux) || defined(VGP_ppc32_aix5) \
+ || defined(VGP_ppc64_aix5)
+ /* All other ppc variants use the AIX scheme, in which f is a
+ pointer to a 3-word function descriptor, of which the first word
+ is the entry address. */
+ UWord* descr =3D (UWord*)f;
return (void*)(descr[0]);
#else
# error "Unknown platform"
Modified: branches/AIX5/coregrind/pub_core_machine.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_machine.h 2006-10-01 17:49:33 UTC (r=
ev 6126)
+++ branches/AIX5/coregrind/pub_core_machine.h 2006-10-01 17:57:12 UTC (r=
ev 6127)
@@ -39,24 +39,33 @@
=20
#include "pub_tool_machine.h"
=20
-#if defined(VGA_x86)
+#if defined(VGP_x86_linux)
# define VG_ELF_DATA2XXX ELFDATA2LSB
# define VG_ELF_MACHINE EM_386
# define VG_ELF_CLASS ELFCLASS32
-#elif defined(VGA_amd64)
+# undef VG_PLAT_USES_PPCTOC
+#elif defined(VGP_amd64_linux)
# define VG_ELF_DATA2XXX ELFDATA2LSB
# define VG_ELF_MACHINE EM_X86_64
# define VG_ELF_CLASS ELFCLASS64
-#elif defined(VGA_ppc32)
+# undef VG_PLAT_USES_PPCTOC
+#elif defined(VGP_ppc32_linux)
# define VG_ELF_DATA2XXX ELFDATA2MSB
# define VG_ELF_MACHINE EM_PPC
# define VG_ELF_CLASS ELFCLASS32
-#elif defined(VGA_ppc64)
+# undef VG_PLAT_USES_PPCTOC
+#elif defined(VGP_ppc64_linux)
# define VG_ELF_DATA2XXX ELFDATA2MSB
# define VG_ELF_MACHINE EM_PPC64
# define VG_ELF_CLASS ELFCLASS64
+# define VG_PLAT_USES_PPCTOC 1
+#elif defined(VGO_aix5)
+# undef VG_ELF_DATA2XXX
+# undef VG_ELF_MACHINE
+# undef VG_ELF_CLASS
+# define VG_PLAT_USES_PPCTOC 1
#else
-# error Unknown arch
+# error Unknown platform
#endif
=20
#if defined(VGA_x86)
Modified: branches/AIX5/include/pub_tool_machine.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_machine.h 2006-10-01 17:49:33 UTC (rev=
6126)
+++ branches/AIX5/include/pub_tool_machine.h 2006-10-01 17:57:12 UTC (rev=
6127)
@@ -31,30 +31,45 @@
#ifndef __PUB_TOOL_MACHINE_H
#define __PUB_TOOL_MACHINE_H
=20
-#if defined(VGA_x86)
+#if defined(VGP_x86_linux)
# define VG_MIN_INSTR_SZB 1 // min length of native instructi=
on
# define VG_MAX_INSTR_SZB 16 // max length of native instructi=
on
# define VG_CLREQ_SZB 14 // length of a client request, ma=
y
// be larger than VG_MAX_INSTR_=
SZB
# define VG_STACK_REDZONE_SZB 0 // number of addressable bytes be=
low %RSP
-#elif defined(VGA_amd64)
+#elif defined(VGP_amd64_linux)
# define VG_MIN_INSTR_SZB 1
# define VG_MAX_INSTR_SZB 16
# define VG_CLREQ_SZB 19
# define VG_STACK_REDZONE_SZB 128
-#elif defined(VGA_ppc32)
+#elif defined(VGP_ppc32_linux)
# define VG_MIN_INSTR_SZB 4
# define VG_MAX_INSTR_SZB 4=20
# define VG_CLREQ_SZB 20
# define VG_STACK_REDZONE_SZB 0
-#elif defined(VGA_ppc64)
+#elif defined(VGP_ppc64_linux)
# define VG_MIN_INSTR_SZB 4
# define VG_MAX_INSTR_SZB 4=20
# define VG_CLREQ_SZB 20
# define VG_STACK_REDZONE_SZB 288 // number of addressable bytes be=
low R1
// from 64-bit PowerPC ELF ABI Su=
pplement 1.7
+#elif defined(VGP_ppc32_aix5)
+# define VG_MIN_INSTR_SZB 4
+# define VG_MAX_INSTR_SZB 4=20
+# define VG_CLREQ_SZB 20
+ /* The PowerOpen ABI actually says 220 bytes, but that is not an
+ 8-aligned number, and frequently forces Memcheck's
+ mc_{new,die}_mem_stack_N routines into slow cases by losing
+ 8-alignment of the area to be messed with. So let's just say
+ 224 instead. Gdb has a similar kludge. */
+# define VG_STACK_REDZONE_SZB 224
+#elif defined(VGP_ppc64_aix5)
+# define VG_MIN_INSTR_SZB 4
+# define VG_MAX_INSTR_SZB 4=20
+# define VG_CLREQ_SZB 20
+# define VG_STACK_REDZONE_SZB 288 // is this right?
#else
-# error Unknown arch
+# error Unknown platform
#endif
=20
// Guest state accessors
|
|
From: <sv...@va...> - 2006-10-01 17:49:38
|
Author: sewardj
Date: 2006-10-01 18:49:33 +0100 (Sun, 01 Oct 2006)
New Revision: 6126
Log:
New option --sym-offsets=3Dyes|no [no], which causes all symbols to be
shown in the form 'name+offset'. Mostly useful for debugging Valgrind
itself.
Also move command-line-error functions from m_main into m_options.
Modified:
branches/AIX5/coregrind/m_options.c
branches/AIX5/coregrind/pub_core_options.h
branches/AIX5/include/pub_tool_options.h
Modified: branches/AIX5/coregrind/m_options.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_options.c 2006-10-01 17:45:35 UTC (rev 6125=
)
+++ branches/AIX5/coregrind/m_options.c 2006-10-01 17:49:33 UTC (rev 6126=
)
@@ -31,6 +31,8 @@
=20
#include "pub_core_basics.h"
#include "pub_core_options.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_libcprint.h"
=20
// See pub_{core,tool}_options.h for explanations of all these.
=20
@@ -68,6 +70,7 @@
Int VG_(clo_dump_error) =3D 0;
Int VG_(clo_backtrace_size) =3D 12;
Char* VG_(clo_sim_hints) =3D NULL;
+Bool VG_(clo_sym_offsets) =3D False;
Bool VG_(clo_run_libc_freeres) =3D True;
Bool VG_(clo_track_fds) =3D False;
Bool VG_(clo_show_below_main)=3D False;
@@ -79,6 +82,41 @@
HChar* VG_(clo_kernel_variant) =3D NULL;
=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 Command line errors =
=3D=3D=3D*/
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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 void revert_to_stderr ( void )
+{
+ vg_assert( !VG_(logging_to_socket) );
+ VG_(clo_log_fd) =3D 2; /* stderr */
+}
+
+void VG_(err_bad_option) ( Char* opt )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: Bad option '%s'; aborting.\n", opt);
+ VG_(printf)("valgrind: Use --help for more information.\n");
+ VG_(exit)(1);
+}
+
+void VG_(err_missing_prog) ( void )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: no program specified\n");
+ VG_(printf)("valgrind: Use --help for more information.\n");
+ VG_(exit)(1);
+}
+
+void VG_(err_config_error) ( Char* msg )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: Startup or configuration error:\n %s\n", msg=
);
+ VG_(printf)("valgrind: Unable to start up properly. Giving up.\n");
+ VG_(exit)(1);
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end m_options.c ---*/
/*--------------------------------------------------------------------*/
Modified: branches/AIX5/coregrind/pub_core_options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_options.h 2006-10-01 17:45:35 UTC (r=
ev 6125)
+++ branches/AIX5/coregrind/pub_core_options.h 2006-10-01 17:49:33 UTC (r=
ev 6126)
@@ -127,6 +127,8 @@
extern Int VG_(clo_backtrace_size);
/* Engage miscellaneous weird hacks needed for some progs. */
extern Char* VG_(clo_sim_hints);
+/* Show symbols in the form 'name+offset' ? Default: NO */
+extern Bool VG_(clo_sym_offsets);
=20
/* Track open file descriptors? */
extern Bool VG_(clo_track_fds);
Modified: branches/AIX5/include/pub_tool_options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_options.h 2006-10-01 17:45:35 UTC (rev=
6125)
+++ branches/AIX5/include/pub_tool_options.h 2006-10-01 17:49:33 UTC (rev=
6126)
@@ -75,15 +75,24 @@
XML output, in between <usercomment> tags. */
extern HChar* VG_(clo_xml_user_comment);
=20
-/* Call this if a recognised option was bad for some reason.
- Note: don't use it just because an option was unrecognised -- return =
'False'
- from VG_(tdict).tool_process_cmd_line_option) to indicate that. */
-extern void VG_(bad_option) ( Char* opt );
-
/* Vex iropt control. Tool-visible so tools can make Vex optimise
less aggressively if that is needed (callgrind needs this). */
extern VexControl VG_(clo_vex_control);
=20
+/* Call this if a recognised option was bad for some reason. Note:
+ don't use it just because an option was unrecognised -- return
+ 'False' from VG_(tdict).tool_process_cmd_line_option) to indicate
+ that. This function prints an error message, then shuts down the
+ entire system. */
+extern void VG_(err_bad_option) ( Char* opt );
+
+/* Similarly - complain that the executable is missing, then stop. */
+extern void VG_(err_missing_prog) ( void );
+
+/* Similarly - complain about some config error. */
+extern void VG_(err_config_error) ( Char* msg );
+
+
#endif // __PUB_TOOL_OPTIONS_H
=20
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2006-10-01 17:45:38
|
Author: sewardj
Date: 2006-10-01 18:45:35 +0100 (Sun, 01 Oct 2006)
New Revision: 6125
Log:
Function-wrapping macros and associated stuff, for AIX.
Modified:
branches/AIX5/include/valgrind.h
Modified: branches/AIX5/include/valgrind.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/valgrind.h 2006-10-01 17:43:48 UTC (rev 6124)
+++ branches/AIX5/include/valgrind.h 2006-10-01 17:45:35 UTC (rev 6125)
@@ -79,31 +79,37 @@
we can't use C++ style "//" comments nor the "asm" keyword (instead
use "__asm__"). */
=20
-/* Derive some tags indicating what the target architecture is. Note
+/* Derive some tags indicating what the target platform is. Note
that in this file we're using the compiler's CPP symbols for
identifying architectures, which are different to the ones we use
within the rest of Valgrind. Note, __powerpc__ is active for both
32 and 64-bit PPC, whereas __powerpc64__ is only active for the
- latter. */
-#undef ARCH_x86
-#undef ARCH_amd64
-#undef ARCH_ppc32
-#undef ARCH_ppc64
+ latter (on Linux, that is). */
+#undef PLAT_x86_linux
+#undef PLAT_amd64_linux
+#undef PLAT_ppc32_linux
+#undef PLAT_ppc64_linux
=20
-#if defined(__i386__)
-# define ARCH_x86 1
-#elif defined(__x86_64__)
-# define ARCH_amd64 1
-#elif defined(__powerpc__) && !defined(__powerpc64__)
-# define ARCH_ppc32 1
-#elif defined(__powerpc__) && defined(__powerpc64__)
-# define ARCH_ppc64 1
+#if !defined(_AIX) && defined(__i386__)
+# define PLAT_x86_linux 1
+#elif !defined(_AIX) && defined(__x86_64__)
+# define PLAT_amd64_linux 1
+#elif !defined(_AIX) && defined(__powerpc__) && !defined(__powerpc64__)
+# define PLAT_ppc32_linux 1
+#elif !defined(_AIX) && defined(__powerpc__) && defined(__powerpc64__)
+# define PLAT_ppc64_linux 1
+#elif defined(_AIX) && defined(__64BIT__)
+# define PLAT_ppc64_aix5 1
+#elif defined(_AIX) && !defined(__64BIT__)
+# define PLAT_ppc32_aix5 1
#endif
=20
-/* If we're not compiling for our target architecture, don't generate
+
+/* If we're not compiling for our target platform, don't generate
any inline asms. */
-#if !defined(ARCH_x86) && !defined(ARCH_amd64) \
- && !defined(ARCH_ppc32) && !defined(ARCH_ppc64)
+#if !defined(PLAT_x86_linux) && !defined(PLAT_amd64_linux) \
+ && !defined(PLAT_ppc32_linux) && !defined(PLAT_ppc64_linux) \
+ && !defined(PLAT_ppc32_aix5) && !defined(PLAT_ppc64_aix5)
# if !defined(NVALGRIND)
# define NVALGRIND 1
# endif
@@ -164,9 +170,9 @@
inline asm stuff to be useful.
*/
=20
-/* ---------------------------- x86 ---------------------------- */
+/* ------------------------- x86-linux ------------------------- */
=20
-#if defined(ARCH_x86)
+#if defined(PLAT_x86_linux)
=20
typedef
struct {=20
@@ -216,11 +222,11 @@
__SPECIAL_INSTRUCTION_PREAMBLE \
/* call-noredir *%EAX */ \
"xchgl %%edx,%%edx\n\t"
-#endif /* ARCH_x86 */
+#endif /* PLAT_x86_linux */
=20
-/* --------------------------- amd64 --------------------------- */
+/* ------------------------ amd64-linux ------------------------ */
=20
-#if defined(ARCH_amd64)
+#if defined(PLAT_amd64_linux)
=20
typedef
struct {=20
@@ -270,11 +276,11 @@
__SPECIAL_INSTRUCTION_PREAMBLE \
/* call-noredir *%RAX */ \
"xchgq %%rdx,%%rdx\n\t"
-#endif /* ARCH_amd64 */
+#endif /* PLAT_amd64_linux */
=20
-/* --------------------------- ppc32 --------------------------- */
+/* ------------------------ ppc32-linux ------------------------ */
=20
-#if defined(ARCH_ppc32)
+#if defined(PLAT_ppc32_linux)
=20
typedef
struct {=20
@@ -326,11 +332,11 @@
__SPECIAL_INSTRUCTION_PREAMBLE \
/* branch-and-link-to-noredir *%R11 */ \
"or 3,3,3\n\t"
-#endif /* ARCH_ppc32 */
+#endif /* PLAT_ppc32_linux */
=20
-/* --------------------------- ppc64 --------------------------- */
+/* ------------------------ ppc64-linux ------------------------ */
=20
-#if defined(ARCH_ppc64)
+#if defined(PLAT_ppc64_linux)
=20
typedef
struct {=20
@@ -392,15 +398,159 @@
/* branch-and-link-to-noredir *%R11 */ \
"or 3,3,3\n\t"
=20
-#endif /* ARCH_ppc64 */
+#endif /* PLAT_ppc64_linux */
=20
-/* Insert assembly code for other architectures here... */
+/* ------------------------ ppc32-aix5 ------------------------- */
=20
+#if defined(PLAT_ppc32_aix5)
+
+typedef
+ struct {=20
+ unsigned int nraddr; /* where's the code? */
+ unsigned int r2; /* what tocptr do we need? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
+ "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned int _zzq_args[7]; \
+ register unsigned int _zzq_result; \
+ register unsigned int* _zzq_ptr; \
+ _zzq_args[0] =3D (unsigned int)(_zzq_request); \
+ _zzq_args[1] =3D (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] =3D (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] =3D (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] =3D (unsigned int)(_zzq_arg4); \
+ _zzq_args[5] =3D (unsigned int)(_zzq_arg5); \
+ _zzq_args[6] =3D (unsigned int)(_zzq_default); \
+ _zzq_ptr =3D _zzq_args; \
+ __asm__ volatile("mr 4,%1\n\t" \
+ "lwz 3, 24(4)\n\t" \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D client_request ( %R4 ) */ \
+ "or 1,1,1\n\t" \
+ "mr %0,3" \
+ : "=3Db" (_zzq_result) \
+ : "b" (_zzq_ptr) \
+ : "r3", "r4", "cc", "memory"); \
+ _zzq_rlval =3D _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig =3D &(_zzq_rlval); \
+ register unsigned int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D guest_NRADDR */ \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=3Db" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr =3D __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D guest_NRADDR_GPR2 */ \
+ "or 4,4,4\n\t" \
+ "mr %0,3" \
+ : "=3Db" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->r2 =3D __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+
+#endif /* PLAT_ppc32_aix5 */
+
+/* ------------------------ ppc64-aix5 ------------------------- */
+
+#if defined(PLAT_ppc64_aix5)
+
+typedef
+ struct {=20
+ unsigned long long int nraddr; /* where's the code? */
+ unsigned long long int r2; /* what tocptr do we need? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
+ "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned long long int _zzq_args[7]; \
+ register unsigned long long int _zzq_result; \
+ register unsigned long long int* _zzq_ptr; \
+ _zzq_args[0] =3D (unsigned int long long)(_zzq_request); \
+ _zzq_args[1] =3D (unsigned int long long)(_zzq_arg1); \
+ _zzq_args[2] =3D (unsigned int long long)(_zzq_arg2); \
+ _zzq_args[3] =3D (unsigned int long long)(_zzq_arg3); \
+ _zzq_args[4] =3D (unsigned int long long)(_zzq_arg4); \
+ _zzq_args[5] =3D (unsigned int long long)(_zzq_arg5); \
+ _zzq_args[6] =3D (unsigned int long long)(_zzq_default); \
+ _zzq_ptr =3D _zzq_args; \
+ __asm__ volatile("mr 4,%1\n\t" \
+ "ld 3, 48(4)\n\t" \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D client_request ( %R4 ) */ \
+ "or 1,1,1\n\t" \
+ "mr %0,3" \
+ : "=3Db" (_zzq_result) \
+ : "b" (_zzq_ptr) \
+ : "r3", "r4", "cc", "memory"); \
+ _zzq_rlval =3D _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig =3D &(_zzq_rlval); \
+ register unsigned long long int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D guest_NRADDR */ \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=3Db" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr =3D __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 =3D guest_NRADDR_GPR2 */ \
+ "or 4,4,4\n\t" \
+ "mr %0,3" \
+ : "=3Db" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->r2 =3D __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+
+#endif /* PLAT_ppc64_aix5 */
+
+/* Insert assembly code for other platforms here... */
+
#endif /* NVALGRIND */
=20
=20
/* ------------------------------------------------------------------ */
-/* ARCHITECTURE SPECIFICS for FUNCTION WRAPPING. This is all very */
+/* PLATFORM SPECIFICS for FUNCTION WRAPPING. This is all very */
/* ugly. It's the least-worst tradeoff I can think of. */
/* ------------------------------------------------------------------ */
=20
@@ -456,9 +606,9 @@
do { volatile unsigned long _junk; \
CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
=20
-/* ---------------------------- x86 ---------------------------- */
+/* ------------------------- x86-linux ------------------------- */
=20
-#if defined(ARCH_x86)
+#if defined(PLAT_x86_linux)
=20
/* These regs are trashed by the hidden call. No need to mention eax
as gcc can already see that, plus causes gcc to bomb. */
@@ -851,11 +1001,11 @@
lval =3D (__typeof__(lval)) _res; \
} while (0)
=20
-#endif /* ARCH_x86 */
+#endif /* PLAT_x86_linux */
=20
-/* --------------------------- amd64 --------------------------- */
+/* ------------------------ amd64-linux ------------------------ */
=20
-#if defined(ARCH_amd64)
+#if defined(PLAT_amd64_linux)
=20
/* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */
=20
@@ -1242,11 +1392,11 @@
lval =3D (__typeof__(lval)) _res; \
} while (0)
=20
-#endif /* ARCH_amd64 */
+#endif /* PLAT_amd64_linux */
=20
-/* --------------------------- ppc32 --------------------------- */
+/* ------------------------ ppc32-linux ------------------------ */
=20
-#if defined(ARCH_ppc32)
+#if defined(PLAT_ppc32_linux)
=20
/* This is useful for finding out about the on-stack stuff:
=20
@@ -1709,11 +1859,11 @@
lval =3D (__typeof__(lval)) _res; \
} while (0)
=20
-#endif /* ARCH_ppc32 */
+#endif /* PLAT_ppc32_linux */
=20
-/* --------------------------- ppc64 --------------------------- */
+/* ------------------------ ppc64-linux ------------------------ */
=20
-#if defined(ARCH_ppc64)
+#if defined(PLAT_ppc64_linux)
=20
/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
=20
@@ -2233,9 +2383,1131 @@
lval =3D (__typeof__(lval)) _res; \
} while (0)
=20
-#endif /* ARCH_ppc64 */
+#endif /* PLAT_ppc64_linux */
=20
+/* ------------------------ ppc32-aix5 ------------------------- */
=20
+#if defined(PLAT_ppc32_aix5)
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* Expand the stack frame, copying enough info that unwinding
+ still works. Trashes r3. */
+
+#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
+ "addi 1,1,-" #_n_fr "\n\t" \
+ "lwz 3," #_n_fr "(1)\n\t" \
+ "stw 3,0(1)\n\t"
+
+#define VG_CONTRACT_FRAME_BY(_n_fr) \
+ "addi 1,1," #_n_fr "\n\t"
+
+/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
+ long) =3D=3D 4. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ _argvec[2+8] =3D (unsigned long)arg8; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ _argvec[2+8] =3D (unsigned long)arg8; \
+ _argvec[2+9] =3D (unsigned long)arg9; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(64) \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(64) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ _argvec[2+8] =3D (unsigned long)arg8; \
+ _argvec[2+9] =3D (unsigned long)arg9; \
+ _argvec[2+10] =3D (unsigned long)arg10; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(64) \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(64) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ _argvec[2+8] =3D (unsigned long)arg8; \
+ _argvec[2+9] =3D (unsigned long)arg9; \
+ _argvec[2+10] =3D (unsigned long)arg10; \
+ _argvec[2+11] =3D (unsigned long)arg11; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(72) \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,64(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(72) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ _argvec[2+4] =3D (unsigned long)arg4; \
+ _argvec[2+5] =3D (unsigned long)arg5; \
+ _argvec[2+6] =3D (unsigned long)arg6; \
+ _argvec[2+7] =3D (unsigned long)arg7; \
+ _argvec[2+8] =3D (unsigned long)arg8; \
+ _argvec[2+9] =3D (unsigned long)arg9; \
+ _argvec[2+10] =3D (unsigned long)arg10; \
+ _argvec[2+11] =3D (unsigned long)arg11; \
+ _argvec[2+12] =3D (unsigned long)arg12; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(72) \
+ /* arg12 */ \
+ "lwz 3,48(11)\n\t" \
+ "stw 3,68(1)\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,64(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(72) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_ppc32_aix5 */
+
+/* ------------------------ ppc64-aix5 ------------------------- */
+
+#if defined(PLAT_ppc64_aix5)
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* Expand the stack frame, copying enough info that unwinding
+ still works. Trashes r3. */
+
+#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
+ "addi 1,1,-" #_n_fr "\n\t" \
+ "ld 3," #_n_fr "(1)\n\t" \
+ "std 3,0(1)\n\t"
+
+#define VG_CONTRACT_FRAME_BY(_n_fr) \
+ "addi 1,1," #_n_fr "\n\t"
+
+/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
+ long) =3D=3D 8. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2] =3D (unsigned long)_orig.nraddr; \
+ _argvec[2+1] =3D (unsigned long)arg1; \
+ _argvec[2+2] =3D (unsigned long)arg2; \
+ _argvec[2+3] =3D (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=3Dr" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig =3D (orig); \
+ volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] =3D (unsigned long)_orig.r2; \
+ _argvec[2]...
[truncated message content] |
|
From: <sv...@va...> - 2006-10-01 17:43:52
|
Author: sewardj
Date: 2006-10-01 18:43:48 +0100 (Sun, 01 Oct 2006)
New Revision: 6124
Log:
- track SysRes.val -> SysRes.res/.err changes
- implement some stuff differently for AIX
- get rid of VG_(nanosleep); apparently unused.
Modified:
branches/AIX5/coregrind/m_libcproc.c
branches/AIX5/coregrind/pub_core_libcproc.h
Modified: branches/AIX5/coregrind/m_libcproc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_libcproc.c 2006-10-01 17:37:24 UTC (rev 612=
3)
+++ branches/AIX5/coregrind/m_libcproc.c 2006-10-01 17:43:48 UTC (rev 612=
4)
@@ -29,14 +29,16 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
+#include "pub_core_libcsignal.h"
#include "pub_core_mallocfree.h"
#include "pub_core_syscall.h"
#include "pub_core_clientstate.h"
-#include "vki_unistd.h"
=20
/* ---------------------------------------------------------------------
Command line and environment stuff
@@ -221,8 +223,20 @@
=20
Int VG_(waitpid)(Int pid, Int *status, Int options)
{
+# if defined(VGO_linux)
SysRes res =3D VG_(do_syscall4)(__NR_wait4, pid, (UWord)status, optio=
ns, 0);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
+# elif defined(VGO_aix5)
+ /* magic number 4 obtained by truss-ing a C program doing
+ 'waitpid'. Note status and pid args opposite way round from
+ POSIX. */
+ SysRes res =3D VG_(do_syscall5)(__NR_AIX5_kwaitpid,=20
+ (UWord)status, pid, 4 | options,0,0);
+ if (0) VG_(printf)("waitpid: got 0x%x 0x%x\n", res.res, res.err);
+ return res.isError ? -1 : res.res;
+# else
+# error Unknown OS
+# endif
}
=20
/* clone the environment */
@@ -262,7 +276,7 @@
res =3D VG_(do_syscall0)(__NR_fork);
if (res.isError)
return -1;
- pid =3D res.val;
+ pid =3D res.res;
if (pid =3D=3D 0) {
/* child */
static Char** envp =3D NULL;
@@ -286,7 +300,32 @@
VG_(exit)(1);
} else {
/* parent */
- Int zzz =3D VG_(waitpid)(pid, NULL, 0);
+ Int ir, zzz;
+ /* We have to set SIGCHLD to its default behaviour in order that
+ VG_(waitpid) works (at least on AIX). According to the Linux
+ man page for waitpid:
+
+ POSIX.1-2001 specifies that if the disposition of SIGCHLD is
+ set to SIG_IGN or the SA_NOCLDWAIT flag is set for SIGCHLD
+ (see sigaction(2)), then children that terminate do not
+ become zombies and a call to wait() or waitpid() will block
+ until all children have terminated, and then fail with errno
+ set to ECHILD. (The original POSIX standard left the
+ behaviour of setting SIGCHLD to SIG_IGN unspecified.)
+ */
+ struct vki_sigaction sa, saved_sa;
+ VG_(memset)( &sa, 0, sizeof(struct vki_sigaction) );
+ VG_(sigemptyset)(&sa.sa_mask);
+ sa.ksa_handler =3D VKI_SIG_DFL;
+ sa.sa_flags =3D 0;
+ ir =3D VG_(sigaction)(VKI_SIGCHLD, &sa, &saved_sa);
+ vg_assert(ir =3D=3D 0);
+
+ zzz =3D VG_(waitpid)(pid, NULL, 0);
+
+ ir =3D VG_(sigaction)(VKI_SIGCHLD, &saved_sa, NULL);
+ vg_assert(ir =3D=3D 0);
+
return zzz =3D=3D -1 ? -1 : 0;
}
}
@@ -303,9 +342,9 @@
# ifdef __NR_ugetrlimit
res =3D VG_(do_syscall2)(__NR_ugetrlimit, resource, (UWord)rlim);
# endif
- if (res.isError && res.val =3D=3D VKI_ENOSYS)
+ if (res.isError && res.err =3D=3D VKI_ENOSYS)
res =3D VG_(do_syscall2)(__NR_getrlimit, resource, (UWord)rlim);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
}
=20
=20
@@ -315,7 +354,7 @@
SysRes res;
/* res =3D setrlimit( resource, rlim ); */
res =3D VG_(do_syscall2)(__NR_setrlimit, resource, (UWord)rlim);
- return res.isError ? -1 : res.val;
+ return res.isError ? -1 : res.res;
}
=20
/* ---------------------------------------------------------------------
@@ -324,9 +363,18 @@
=20
Int VG_(gettid)(void)
{
+# if defined(VGO_aix5)
+ SysRes res;
+ Int r;
+ vg_assert(__NR_AIX5__thread_self !=3D __NR_AIX5_UNKNOWN);
+ res =3D VG_(do_syscall0)(__NR_AIX5__thread_self);
+ r =3D res.res;
+ return r;
+
+# else
SysRes res =3D VG_(do_syscall0)(__NR_gettid);
=20
- if (res.isError && res.val =3D=3D VKI_ENOSYS) {
+ if (res.isError && res.res =3D=3D VKI_ENOSYS) {
Char pid[16]; =20
/*
* The gettid system call does not exist. The obvious assumption
@@ -344,44 +392,53 @@
=20
res =3D VG_(do_syscall3)(__NR_readlink, (UWord)"/proc/self",
(UWord)pid, sizeof(pid));
- if (!res.isError && res.val > 0) {
- pid[res.val] =3D '\0';
- res.val =3D VG_(atoll)(pid);
+ if (!res.isError && res.res > 0) {
+ pid[res.res] =3D '\0';
+ res.res =3D VG_(atoll)(pid);
}
}
=20
- return res.val;
+ return res.res;
+# endif
}
=20
/* You'd be amazed how many places need to know the current pid. */
Int VG_(getpid) ( void )
{
/* ASSUMES SYSCALL ALWAYS SUCCEEDS */
- return VG_(do_syscall0)(__NR_getpid) . val;
+ return VG_(do_syscall0)(__NR_getpid) . res;
}
=20
Int VG_(getpgrp) ( void )
{
/* ASSUMES SYSCALL ALWAYS SUCCEEDS */
- return VG_(do_syscall0)(__NR_getpgrp) . val;
+ return VG_(do_syscall0)(__NR_getpgrp) . res;
}
=20
Int VG_(getppid) ( void )
{
/* ASSUMES SYSCALL ALWAYS SUCCEEDS */
- return VG_(do_syscall0)(__NR_getppid) . val;
+ return VG_(do_syscall0)(__NR_getppid) . res;
}
=20
Int VG_(geteuid) ( void )
{
/* ASSUMES SYSCALL ALWAYS SUCCEEDS */
- return VG_(do_syscall0)(__NR_geteuid) . val;
+# if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ return VG_(do_syscall1)(__NR_AIX5_getuidx, 1) . res;
+# else
+ return VG_(do_syscall0)(__NR_geteuid) . res;
+# endif
}
=20
Int VG_(getegid) ( void )
{
/* ASSUMES SYSCALL ALWAYS SUCCEEDS */
- return VG_(do_syscall0)(__NR_getegid) . val;
+# if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ return VG_(do_syscall1)(__NR_AIX5_getgidx, 1) . res;
+# else
+ return VG_(do_syscall0)(__NR_getegid) . res;
+# endif
}
=20
/* Get supplementary groups into list[0 .. size-1]. Returns the
@@ -399,18 +456,19 @@
sres =3D VG_(do_syscall2)(__NR_getgroups, size, (Addr)list16);
if (sres.isError)
return -1;
- if (sres.val > size)
+ if (sres.res > size)
return -1;
- for (i =3D 0; i < sres.val; i++)
+ for (i =3D 0; i < sres.res; i++)
list[i] =3D (UInt)list16[i];
- return sres.val;
+ return sres.res;
=20
-# elif defined(VGP_amd64_linux) || defined(VGP_ppc64_linux)
+# elif defined(VGP_amd64_linux) || defined(VGP_ppc64_linux) \
+ || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
SysRes sres;
sres =3D VG_(do_syscall2)(__NR_getgroups, size, (Addr)list);
if (sres.isError)
return -1;
- return sres.val;
+ return sres.res;
=20
# else
# error "VG_(getgroups): needs implementation on this platform"
@@ -427,7 +485,7 @@
res =3D VG_(do_syscall4)(__NR_ptrace, request, pid, (UWord)addr, (UWo=
rd)data);
if (res.isError)
return -1;
- return res.val;
+ return res.res;
}
=20
/* ---------------------------------------------------------------------
@@ -440,7 +498,7 @@
res =3D VG_(do_syscall0)(__NR_fork);
if (res.isError)
return -1;
- return res.val;
+ return res.res;
}
=20
/* ---------------------------------------------------------------------
@@ -449,14 +507,35 @@
=20
UInt VG_(read_millisecond_timer) ( void )
{
+ /* 'now' and 'base' are in microseconds */
static ULong base =3D 0;
+ ULong now;
+
+# if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ /* AIX requires a totally different implementation since
+ sys_gettimeofday doesn't exist. We use the POWER real-time
+ register facility. This will SIGILL on PowerPC 970 on AIX,
+ since PowerPC doesn't support these instructions. */
+ UWord nsec, sec1, sec2;
+ while (1) {
+ __asm__ __volatile__ ("\n"
+ "\tmfspr %0,4\n" /* 4=3D=3DRTCU */
+ "\tmfspr %1,5\n" /* 5=3D=3DRTCL */
+ "\tmfspr %2,4\n" /* 4=3D=3DRTCU */
+ : "=3Db" (sec1), "=3Db" (nsec), "=3Db" (sec2)
+ );
+ if (sec1 =3D=3D sec2) break;
+ }
+ vg_assert(nsec < 1000*1000*1000);
+ now =3D ((ULong)sec1) * 1000000ULL;
+ now +=3D (ULong)(nsec / 1000);
+# else
+
struct vki_timeval tv_now;
- ULong now;
SysRes res;
-
res =3D VG_(do_syscall2)(__NR_gettimeofday, (UWord)&tv_now, (UWord)NU=
LL);
- =20
now =3D tv_now.tv_sec * 1000000ULL + tv_now.tv_usec;
+# endif
=20
if (base =3D=3D 0)
base =3D now;
@@ -464,12 +543,6 @@
return (now - base) / 1000;
}
=20
-
-void VG_(nanosleep)(struct vki_timespec *ts)
-{
- (void)VG_(do_syscall2)(__NR_nanosleep, (UWord)ts, (UWord)NULL);
-}
-
/* ---------------------------------------------------------------------
A trivial atfork() facility for Valgrind's internal use
------------------------------------------------------------------ */
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/pub_core_libcproc.h 2006-10-01 17:37:24 UTC (=
rev 6123)
+++ branches/AIX5/coregrind/pub_core_libcproc.h 2006-10-01 17:43:48 UTC (=
rev 6124)
@@ -76,7 +76,6 @@
extern Char **VG_(env_clone) ( Char **env_clone );
=20
// misc
-extern void VG_(nanosleep) ( struct vki_timespec * );
extern Int VG_(getgroups)( Int size, UInt* list );
extern Int VG_(ptrace)( Int request, Int pid, void *addr, void *data );
extern Int VG_(fork)( void );
|
|
From: <sv...@va...> - 2006-10-01 17:37:27
|
Author: sewardj
Date: 2006-10-01 18:37:24 +0100 (Sun, 01 Oct 2006)
New Revision: 6123
Log:
Extensions for unwinding stacks on ppc32-aix5 and ppc64-aix5. Also,
extend the mechanism developed for ppc64-linux for fishing return
addresses out of the thread's redirection-stack when needed.
Modified:
branches/AIX5/coregrind/m_stacktrace.c
Modified: branches/AIX5/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
--- branches/AIX5/coregrind/m_stacktrace.c 2006-10-01 17:27:36 UTC (rev 6=
122)
+++ branches/AIX5/coregrind/m_stacktrace.c 2006-10-01 17:37:24 UTC (rev 6=
123)
@@ -29,6 +29,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h"
#include "pub_core_aspacemgr.h" // For VG_(is_addressable)()
@@ -59,7 +60,8 @@
Addr ip, Addr sp, Addr fp, Addr lr,
Addr fp_min, Addr fp_max_orig )
{
-#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
+#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux) \
+ || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
Bool lr_is_first_RA =3D False; /* ppc only */
#endif
Bool debug =3D False;
@@ -153,7 +155,7 @@
continue;
}
=20
- /* That didn't work out, so see if there is any CFI info to hand
+ /* That didn't work out, so see if there is any CF info to hand
which can be used. */
if ( VG_(use_CF_info)( &ip, &sp, &fp, fp_min, fp_max ) ) {
ips[i++] =3D ip;
@@ -234,26 +236,45 @@
break;
}
=20
-# elif defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
+# elif defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux) \
+ || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
=20
/*--------------------- ppc32/64 ---------------------*/
=20
/* fp is %r1. ip is %cia. Note, ppc uses r1 as both the stack and
frame pointers. */
=20
-# if defined(VGP_ppc64_linux)
+# if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+ Word redir_stack_size =3D VEX_GUEST_PPC64_REDIR_STACK_SIZE;
+ Word redirs_used =3D 0;
+# elif defined(VGP_ppc32_aix5)
+ Word redir_stack_size =3D VEX_GUEST_PPC32_REDIR_STACK_SIZE;
+ Word redirs_used =3D 0;
+# endif
+
+# if defined(VG_PLAT_USES_PPCTOC)
/* Deal with bogus LR values caused by function
- interception/wrapping; see comment on similar code a few lines
- further down. */
- if (lr =3D=3D (Addr)&VG_(ppc64_linux_magic_redirect_return_stub)
+ interception/wrapping on ppc-TOC platforms; see comment on
+ similar code a few lines further down. */
+ if (ULong_to_Ptr(lr) =3D=3D (void*)&VG_(ppctoc_magic_redirect_return_=
stub)
&& VG_(is_valid_tid)(tid_if_known)) {
- Long hsp =3D VG_(threads)[tid_if_known].arch.vex.guest_REDIR_SP;
- if (hsp >=3D 1 && hsp < VEX_GUEST_PPC64_REDIR_STACK_SIZE)
+ Word hsp =3D VG_(threads)[tid_if_known].arch.vex.guest_REDIR_SP;
+ redirs_used++;
+ if (hsp >=3D 1 && hsp < redir_stack_size)
lr =3D VG_(threads)[tid_if_known]
.arch.vex.guest_REDIR_STACK[hsp-1];
}
# endif
=20
+ /* We have to determine whether or not LR currently holds this fn
+ (call it F)'s return address. It might not if F has previously
+ called some other function, hence overwriting LR with a pointer
+ to some part of F. Hence if LR and IP point to the same
+ function then we conclude LR does not hold this function's
+ return address; instead the LR at entry must have been saved in
+ the stack by F's prologue and so we must get it from there
+ instead. Note all this guff only applies to the innermost
+ frame. */
lr_is_first_RA =3D False;
{
# define M_VG_ERRTXT 1000
@@ -275,10 +296,11 @@
=20
while (True) {
=20
- /* on ppc64-linux (ppc64-elf, really), the lr save slot is 2
- words back from sp, whereas on ppc32-elf(?) it's only one
- word back. */
-# if defined(VGP_ppc64_linux)
+ /* On ppc64-linux (ppc64-elf, really), and on AIX, the lr save
+ slot is 2 words back from sp, whereas on ppc32-elf(?) it's
+ only one word back. */
+# if defined(VGP_ppc64_linux) \
+ || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
const Int lr_offset =3D 2;
# else
const Int lr_offset =3D 1;
@@ -297,19 +319,23 @@
else
ip =3D (((UWord*)fp)[lr_offset]);
=20
-# if defined(VGP_ppc64_linux)
+# if defined(VG_PLAT_USES_PPCTOC)
/* Nasty hack to do with function replacement/wrapping on
- ppc64-linux. If LR points to our magic return stub,
- then we are in a wrapped or intercepted function, in
- which LR has been messed with. The original LR will
- have been pushed onto the thread's hidden REDIR stack
- one down from the top (top element is the saved R2) and
- so we should restore the value from there instead. */
- if (i =3D=3D 1=20
- && ip =3D=3D (Addr)&VG_(ppc64_linux_magic_redirect_retur=
n_stub)
+ ppc64-linux/ppc64-aix/ppc32-aix. If LR points to our
+ magic return stub, then we are in a wrapped or
+ intercepted function, in which LR has been messed with.
+ The original LR will have been pushed onto the thread's
+ hidden REDIR stack one down from the top (top element
+ is the saved R2) and so we should restore the value
+ from there instead. Since nested redirections can and
+ do happen, we keep track of the number of nested LRs
+ used by the unwinding so far with 'redirs_used'. */
+ if (ip =3D=3D (Addr)&VG_(ppctoc_magic_redirect_return_stub)
&& VG_(is_valid_tid)(tid_if_known)) {
- Long hsp =3D VG_(threads)[tid_if_known].arch.vex.guest_RE=
DIR_SP;
- if (hsp >=3D 1 && hsp < VEX_GUEST_PPC64_REDIR_STACK_SIZE)
+ Word hsp =3D VG_(threads)[tid_if_known].arch.vex.guest_RE=
DIR_SP;
+ hsp -=3D 2 * redirs_used;
+ redirs_used ++;
+ if (hsp >=3D 1 && hsp < redir_stack_size)
ip =3D VG_(threads)[tid_if_known]
.arch.vex.guest_REDIR_STACK[hsp-1];
}
|
|
From: <sv...@va...> - 2006-10-01 17:27:38
|
Author: sewardj
Date: 2006-10-01 18:27:36 +0100 (Sun, 01 Oct 2006)
New Revision: 6122
Log:
'-C0' for diff is a GNU-ism; apparently.
Modified:
branches/AIX5/tests/vg_regtest.in
Modified: branches/AIX5/tests/vg_regtest.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
--- branches/AIX5/tests/vg_regtest.in 2006-10-01 17:26:50 UTC (rev 6121)
+++ branches/AIX5/tests/vg_regtest.in 2006-10-01 17:27:36 UTC (rev 6122)
@@ -255,8 +255,8 @@
($f_exp eq "/dev/null") or die "Unexpected .exp file: $f_exp=
\n";
}
=20
- #print("diff -C0 $f_exp $name.$mid.out > $name.$mid.diff$n\n");
- mysystem("diff -C0 $f_exp $name.$mid.out > $name.$mid.diff$n");
+ #print("diff $f_exp $name.$mid.out > $name.$mid.diff$n\n");
+ mysystem("diff $f_exp $name.$mid.out > $name.$mid.diff$n");
=20
if (not -s "$name.$mid.diff$n") {
# A match; remove .out and any previously created .diff fil=
es.
|
|
From: <sv...@va...> - 2006-10-01 17:26:54
|
Author: sewardj
Date: 2006-10-01 18:26:50 +0100 (Sun, 01 Oct 2006)
New Revision: 6121
Log:
Don't define uchar; it might already be defined.
Modified:
branches/AIX5/perf/bz2.c
Modified: branches/AIX5/perf/bz2.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/perf/bz2.c 2006-10-01 17:23:57 UTC (rev 6120)
+++ branches/AIX5/perf/bz2.c 2006-10-01 17:26:50 UTC (rev 6121)
@@ -5946,7 +5946,7 @@
=20
#define M_BLOCK 1000000
=20
-typedef unsigned char uchar;
+//typedef unsigned char UChar;
=20
#define M_BLOCK_OUT (M_BLOCK + 1000000)
char inbuf[M_BLOCK];
@@ -5981,7 +5981,7 @@
{
int byteno =3D bit / 8;
int bitno =3D bit % 8;
- uchar mask =3D 1 << bitno;
+ UChar mask =3D 1 << bitno;
//fprintf ( stderr, "(byte %d bit %d mask %d)",
// byteno, bitno, (int)mask );
zbuf[byteno] ^=3D mask;
|
|
From: <sv...@va...> - 2006-10-01 17:24:00
|
Author: sewardj
Date: 2006-10-01 18:23:57 +0100 (Sun, 01 Oct 2006)
New Revision: 6120
Log:
Get rid of VG_(sigtimedwait) and replace it a simpler version,
VG_(sigtimedwait_zero), which polls for signals and returns
immediately. AIX doesn't have a sigtimedwait syscall, so in that case
try and implement VG_(sigtimedwait_zero) using various other signal
syscalls.
Modified:
branches/AIX5/coregrind/m_libcsignal.c
branches/AIX5/include/pub_tool_libcsignal.h
Modified: branches/AIX5/coregrind/m_libcsignal.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_libcsignal.c 2006-10-01 17:19:52 UTC (rev 6=
119)
+++ branches/AIX5/coregrind/m_libcsignal.c 2006-10-01 17:23:57 UTC (rev 6=
120)
@@ -29,14 +29,18 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_debuglog.h"
+#include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcsignal.h"
#include "pub_core_syscall.h"
-#include "vki_unistd.h"
=20
/* sigemptyset, sigfullset, sigaddset and sigdelset return 0 on
success and -1 on error. */
+/* I believe the indexing scheme in ->sig[] is also correct for
+ 32- and 64-bit AIX (verified 27 July 06). */
=20
Int VG_(sigfillset)( vki_sigset_t* set )
{
@@ -121,7 +125,6 @@
return 0;
}
=20
-
/* Add all signals in src to dst. */
void VG_(sigaddset_from_set)( vki_sigset_t* dst, vki_sigset_t* src )
{
@@ -163,14 +166,6 @@
}
=20
=20
-Int VG_(sigtimedwait)( const vki_sigset_t *set, vki_siginfo_t *info,=20
- const struct vki_timespec *timeout )
-{
- SysRes res =3D VG_(do_syscall4)(__NR_rt_sigtimedwait, (UWord)set, (UW=
ord)info,=20
- (UWord)timeout, sizeof(*set));
- return res.isError ? -1 : res.val;
-}
-=20
Int VG_(signal)(Int signum, void (*sighandler)(Int))
{
SysRes res;
@@ -178,7 +173,9 @@
struct vki_sigaction sa;
sa.ksa_handler =3D sighandler;
sa.sa_flags =3D VKI_SA_ONSTACK | VKI_SA_RESTART;
+# if !defined(VGO_aix5)
sa.sa_restorer =3D NULL;
+# endif
n =3D VG_(sigemptyset)( &sa.sa_mask );
vg_assert(n =3D=3D 0);
res =3D VG_(do_syscall4)(__NR_rt_sigaction, signum, (UWord)&sa, (UWor=
d)NULL,
@@ -197,21 +194,134 @@
Int VG_(tkill)( ThreadId tid, Int signo )
{
SysRes res =3D VG_(mk_SysRes_Error)(VKI_ENOSYS);
+ res =3D VG_(do_syscall2)(__NR_tkill, tid, signo);
+ if (res.isError && res.err =3D=3D VKI_ENOSYS)
+ res =3D VG_(do_syscall2)(__NR_kill, tid, signo);
+ return res.isError ? -1 : 0;
+}
=20
-#if 0
- /* This isn't right because the client may create a process
- structure with multiple thread groups */
- res =3D VG_(do_syscall3)(__NR_tgkill, VG_(getpid)(), tid, signo);
-#endif
=20
- res =3D VG_(do_syscall2)(__NR_tkill, tid, signo);
+/* A cut-down version of POSIX sigtimedwait: poll for pending signals
+ mentioned in the sigset_t, and if any are present, select one
+ arbitrarily, return its number (which must be > 0), and put
+ auxiliary info about it in the siginfo_t, and make it
+ not-pending-any-more. If none are pending, return zero. The _zero
+ refers to the fact that there is zero timeout, so if no signals are
+ pending it returns immediately. Perhaps a better name would be
+ 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0
+ if signal n was selected.=20
=20
- if (res.isError && res.val =3D=3D VKI_ENOSYS)
- res =3D VG_(do_syscall2)(__NR_kill, tid, signo);
+ The Linux implementation is trivial: do the corresponding syscall.
=20
- return res.isError ? -1 : 0;
+ The AIX implementation is horrible and probably broken in a dozen
+ obscure ways. I suspect it's only thread-safe because V forces
+ single-threadedness. */
+
+#if defined(VGO_linux)
+Int VG_(sigtimedwait_zero)( const vki_sigset_t *set,=20
+ vki_siginfo_t *info )
+{
+ static const struct vki_timespec zero =3D { 0, 0 };
+ SysRes res =3D VG_(do_syscall4)(__NR_rt_sigtimedwait, (UWord)set, (UW=
ord)info,=20
+ (UWord)&zero, sizeof(*set));
+ return res.isError ? -1 : res.res;
}
=20
+#elif defined(VGO_aix5)
+/* The general idea is:
+ - use sigpending to find out which signals are pending
+ - choose one
+ - temporarily set its handler to sigtimedwait_zero_handler
+ - use sigsuspend atomically unblock it and wait for the signal.
+ Upon return, sigsuspend restores the signal mask to what it
+ was to start with.
+ - Restore the handler for the signal to whatever it was before.
+*/
+
+/* A signal handler which does nothing (it doesn't need to). It does
+ however check that it's not handing a sync signal for which
+ returning is meaningless. */
+static void sigtimedwait_zero_handler ( Int sig )=20
+{=20
+ vg_assert(sig !=3D VKI_SIGILL);
+ vg_assert(sig !=3D VKI_SIGSEGV);
+ vg_assert(sig !=3D VKI_SIGBUS);
+ vg_assert(sig !=3D VKI_SIGTRAP);
+ /* do nothing */=20
+}
+
+Int VG_(sigtimedwait_zero)( const vki_sigset_t *set,=20
+ vki_siginfo_t *info )
+{
+ Int i, ir;
+ SysRes sr;
+ vki_sigset_t pending, blocked, allbutone;
+ struct vki_sigaction sa, saved_sa;
+
+ /* Find out what's pending: AIX _sigpending */
+ sr =3D VG_(do_syscall1)(__NR__sigpending, (UWord)&pending);
+ vg_assert(!sr.isError);
+
+ /* don't try for signals not in 'set' */
+ /* pending =3D pending `intersect` set */
+ for (i =3D 0; i < _VKI_NSIG_WORDS; i++)
+ pending.sig[i] &=3D set->sig[i];
+
+ /* don't try for signals not blocked at the moment */
+ ir =3D VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &blocked);
+ vg_assert(ir =3D=3D 0);
+
+ /* pending =3D pending `intersect` blocked */
+ for (i =3D 0; i < _VKI_NSIG_WORDS; i++)
+ pending.sig[i] &=3D blocked.sig[i];
+
+ /* decide which signal we're going to snarf */
+ for (i =3D 1; i < _VKI_NSIG; i++)
+ if (VG_(sigismember)(&pending,i))
+ break;
+
+ if (i =3D=3D _VKI_NSIG)
+ return 0;
+
+ /* fetch signal i.
+ pre: i is blocked and pending
+ pre: we are the only thread running=20
+ */
+ /* Set up alternative signal handler */
+ VG_(sigfillset)(&allbutone);
+ VG_(sigdelset)(&allbutone, i);
+ sa.sa_mask =3D allbutone;
+ sa.ksa_handler =3D &sigtimedwait_zero_handler;
+ sa.sa_flags =3D 0;
+ ir =3D VG_(sigaction)(i, &sa, &saved_sa);
+ vg_assert(ir =3D=3D 0);
+
+ /* Switch signal masks and wait for the signal. This should happen
+ immediately, since we've already established it is pending and
+ blocked. */
+ sr =3D VG_(do_syscall1)(__NR__sigsuspend, (UWord)&allbutone);
+ vg_assert(sr.isError);
+ if (0)
+ VG_(debugLog)(0, "libcsignal",
+ "sigtimedwait_zero: sigsuspend got res %ld err %ld=
\n",=20
+ sr.res, sr.err);
+ vg_assert(sr.res =3D=3D (UWord)-1);
+
+ /* Restore signal's handler to whatever it was before */
+ ir =3D VG_(sigaction)(i, &saved_sa, NULL);
+ vg_assert(ir =3D=3D 0);
+
+ /* This is bogus - we could get more info from the sighandler. */
+ VG_(memset)( info, 0, sizeof(*info) );
+ info->si_signo =3D i;
+
+ return i;
+}
+
+#else
+# error Unknown OS
+#endif
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/AIX5/include/pub_tool_libcsignal.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_libcsignal.h 2006-10-01 17:19:52 UTC (=
rev 6119)
+++ branches/AIX5/include/pub_tool_libcsignal.h 2006-10-01 17:23:57 UTC (=
rev 6120)
@@ -40,6 +40,17 @@
extern Int VG_(sigprocmask) ( Int how, const vki_sigset_t* set,
vki_sigset_t* oldset );
=20
+/* A cut-down version of POSIX sigtimedwait: poll for pending signals
+ mentioned in the sigset_t, and if any are present, select one
+ arbitrarily, return its number (which must be > 0), and put
+ auxiliary info about it in the siginfo_t, and make it
+ not-pending-any-more. If none are pending, return zero. The _zero
+ refers to the fact that there is zero timeout, so if no signals are
+ pending it returns immediately. Perhaps a better name would be
+ 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0
+ if signal n was selected. */
+extern Int VG_(sigtimedwait_zero)( const vki_sigset_t *, vki_siginfo_t *=
);
+
#endif // __PUB_TOOL_LIBCBSIGNAL_H
=20
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2006-10-01 17:19:54
|
Author: sewardj
Date: 2006-10-01 18:19:52 +0100 (Sun, 01 Oct 2006)
New Revision: 6119
Log:
Changes to this interface to facilitate actions needed by AIX5.
Modified:
branches/AIX5/coregrind/pub_core_aspacemgr.h
branches/AIX5/include/pub_tool_aspacemgr.h
Modified: branches/AIX5/coregrind/pub_core_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_aspacemgr.h 2006-10-01 17:16:53 UTC =
(rev 6118)
+++ branches/AIX5/coregrind/pub_core_aspacemgr.h 2006-10-01 17:19:52 UTC =
(rev 6119)
@@ -66,13 +66,14 @@
// Querying current status
=20
/* Finds the segment containing 'a'. Only returns file/anon/resvn
- segments. */
+ segments. This returns a 'NSegment const *' - a pointer to
+ readonly data. */
// Is in tool-visible header file.
-// extern NSegment* VG_(am_find_nsegment) ( Addr a );
+// extern NSegment const * VG_(am_find_nsegment) ( Addr a );
=20
/* Find the next segment along from 'here', if it is a file/anon/resvn
segment. */
-extern NSegment* VG_(am_next_nsegment) ( NSegment* here, Bool fwds );
+extern NSegment const* VG_(am_next_nsegment) ( NSegment* here, Bool fwds=
);
=20
/* Is the area [start .. start+len-1] validly accessible by the=20
client with at least the permissions 'prot' ? To find out
@@ -181,7 +182,6 @@
address range. */
extern Bool VG_(am_notify_munmap)( Addr start, SizeT len );
=20
-
/* Hand a raw mmap to the kernel, without aspacem updating the segment
array. THIS FUNCTION IS DANGEROUS -- it will cause aspacem's view
of the address space to diverge from that of the kernel. DO NOT
@@ -192,6 +192,51 @@
=20
=20
//--------------------------------------------------------------
+// Functions pertaining to AIX5-specific notifications.
+
+/* Describes followup actions that need to be done following a call to
+ VG_(am_aix5_reread_procmap). When acquire=3D=3DTrue, the specified
+ code and data segments have been mapped into the process, and so
+ m_debuginfo needs to read info for it; also m_redir needs to know,
+ and the tool needs to be told. When acquire=3D=3DFalse, the specifie=
d
+ segments have been unloaded and m_debuginfo, m_redir and the tool
+ (and m_transtab?) need to notified appropriately. */
+typedef
+ struct {
+ Addr code_start;
+ Word code_len;
+ Addr data_start;
+ Word data_len;
+ UChar* file_name;
+ UChar* mem_name;
+ Bool is_mainexe;
+ Bool acquire;
+ }
+ AixCodeSegChange;
+
+/* Tell aspacem that /proc/<pid>/map may have changed (eg following
+ __loadx) and so it should be re-read, and the code/data segment
+ list updated accordingly. The resulting array of AixCodeChangeSeg
+ directives are written to 'directives', and the number of entries
+ to *ndirectives. */
+extern void VG_(am_aix5_reread_procmap)
+ ( /*OUT*/AixCodeSegChange* directives, /*OUT*/Int* ndirectives );
+
+/* Find out the size of the AixCodeSegChange that must be
+ presented to VG_(am_aix5_reread_procmap). */
+extern Int VG_(am_aix5_reread_procmap_howmany_directives)(void);
+
+/* Tell aspacem where the initial client stack is, so that it
+ can later produce a faked-up NSegment in response to
+ VG_(am_find_nsegment) for athat address, if asked. */
+extern void VG_(am_aix5_set_initial_client_sp)( Addr );
+
+/* The AIX5 aspacem implementation needs to be told when it is and
+ isn't allowed to use sbrk to allocate memory. Hence: */
+extern Bool VG_(am_aix5_sbrk_allowed);
+
+
+//--------------------------------------------------------------
// Dealing with mappings which do not arise directly from the
// simulation of the client. These are typically used for
// loading the client and building its stack/data segment, before
@@ -209,15 +254,32 @@
extern SysRes VG_(am_mmap_anon_fixed_client)
( Addr start, SizeT length, UInt prot );
=20
+
/* Map anonymously at an unconstrained address for the client, and
update the segment array accordingly. */
extern SysRes VG_(am_mmap_anon_float_client) ( SizeT length, Int prot );
=20
+/* Similarly, acquire new address space for the client but with
+ considerable restrictions on what can be done with it: (1) the
+ actual protections may exceed those stated in 'prot', (2) the
+ area's protections cannot be later changed using any form of
+ mprotect, and (3) the area cannot be freed using any form of
+ munmap. On Linux this behaves the same as
+ VG_(am_mmap_anon_float_client). On AIX5 this *may* allocate memory
+ by using sbrk, so as to make use of large pages on AIX. */
+extern SysRes VG_(am_sbrk_anon_float_client) ( SizeT length, Int prot );
+
+
/* Map anonymously at an unconstrained address for V, and update the
segment array accordingly. This is fundamentally how V allocates
itself more address space when needed. */
extern SysRes VG_(am_mmap_anon_float_valgrind)( SizeT cszB );
=20
+/* Same comments apply as per VG_(am_sbrk_anon_float_client). On
+ Linux this behaves the same as VG_(am_mmap_anon_float_valgrind). */
+extern SysRes VG_(am_sbrk_anon_float_valgrind)( SizeT cszB );
+
+
/* Map a file at an unconstrained address for V, and update the
segment array accordingly. This is used by V for transiently
mapping in object files to read their debug info. */
@@ -238,6 +300,19 @@
suitable segment. */
extern Bool VG_(am_change_ownership_v_to_c)( Addr start, SizeT len );
=20
+/* 'seg' must be NULL or have been obtained from
+ VG_(am_find_nsegment), and still valid. If non-NULL, and if it
+ denotes a SkAnonC (anonymous client mapping) area, set the .isCH
+ (is-client-heap) flag for that area. Otherwise do nothing.
+ (Bizarre interface so that the same code works for both Linux and
+ AIX and does not impose inefficiencies on the Linux version.) */
+extern void VG_(am_set_segment_isCH_if_SkAnonC)( NSegment* seg );
+
+/* Same idea as VG_(am_set_segment_isCH_if_SkAnonC), except set the
+ segment's hasT bit (has-cached-code) if this is SkFileC or SkAnonC
+ segment. */
+extern void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( NSegment* );
+
/* --- --- --- reservations --- --- --- */
=20
/* Create a reservation from START .. START+LENGTH-1, with the given
Modified: branches/AIX5/include/pub_tool_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_aspacemgr.h 2006-10-01 17:16:53 UTC (r=
ev 6118)
+++ branches/AIX5/include/pub_tool_aspacemgr.h 2006-10-01 17:19:52 UTC (r=
ev 6119)
@@ -134,7 +134,7 @@
=20
=20
// See pub_core_aspacemgr.h for description.
-extern NSegment* VG_(am_find_nsegment) ( Addr a );=20
+extern NSegment const * VG_(am_find_nsegment) ( Addr a );=20
=20
// See pub_core_aspacemgr.h for description.
extern HChar* VG_(am_get_filename)( NSegment* );
|
|
From: <sv...@va...> - 2006-10-01 17:16:55
|
Author: sewardj Date: 2006-10-01 18:16:53 +0100 (Sun, 01 Oct 2006) New Revision: 6118 Log: Rename aspacemgr.c and also remove from it stuff which is now in aspacemgr-common.c. Removed: branches/AIX5/coregrind/m_aspacemgr/aspacemgr.c Modified: branches/AIX5/coregrind/m_aspacemgr/aspacemgr-linux.c [... diff too large to include ...] |
|
From: <sv...@va...> - 2006-10-01 17:15:28
|
Author: sewardj Date: 2006-10-01 18:15:26 +0100 (Sun, 01 Oct 2006) New Revision: 6117 Log: Fix typo. Modified: branches/AIX5/coregrind/pub_core_oset.h Modified: branches/AIX5/coregrind/pub_core_oset.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/AIX5/coregrind/pub_core_oset.h 2006-10-01 17:13:25 UTC (rev = 6116) +++ branches/AIX5/coregrind/pub_core_oset.h 2006-10-01 17:15:26 UTC (rev = 6117) @@ -1,6 +1,6 @@ =20 /*--------------------------------------------------------------------*/ -/*--- An ordered set implemenation. pub_core_oset.h ---*/ +/*--- An ordered set implementation. pub_core_oset.h ---*/ /*--------------------------------------------------------------------*/ =20 /* |
|
From: <sv...@va...> - 2006-10-01 17:13:26
|
Author: sewardj Date: 2006-10-01 18:13:25 +0100 (Sun, 01 Oct 2006) New Revision: 6116 Log: Use new m_vki header. Modified: branches/AIX5/helgrind/hg_main.c Modified: branches/AIX5/helgrind/hg_main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/AIX5/helgrind/hg_main.c 2006-10-01 17:12:50 UTC (rev 6115) +++ branches/AIX5/helgrind/hg_main.c 2006-10-01 17:13:25 UTC (rev 6116) @@ -43,6 +43,7 @@ // fundamentals in each case. =20 #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_threadstate.h" #include "pub_tool_aspacemgr.h" #include "pub_tool_debuginfo.h" |
|
From: <sv...@va...> - 2006-10-01 17:12:56
|
Author: sewardj
Date: 2006-10-01 18:12:50 +0100 (Sun, 01 Oct 2006)
New Revision: 6115
Log:
Track changes of type SysRes; also renaming wibble.
Modified:
branches/AIX5/callgrind/command.c
branches/AIX5/callgrind/dump.c
branches/AIX5/callgrind/global.h
branches/AIX5/callgrind/main.c
branches/AIX5/callgrind/sim.c
Modified: branches/AIX5/callgrind/command.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/callgrind/command.c 2006-10-01 17:11:17 UTC (rev 6114)
+++ branches/AIX5/callgrind/command.c 2006-10-01 17:12:50 UTC (rev 6115)
@@ -108,7 +108,7 @@
}
}
if (!res.isError)
- fd =3D (Int) res.val;
+ fd =3D (Int) res.res;
if (fd>=3D0) {
Char buf[512];
Int i;
@@ -176,7 +176,7 @@
* to not confuse it with our special value -2
*/
if (res.isError) fd =3D -1;
- else fd =3D (Int) res.val;
+ else fd =3D (Int) res.res;
=20
return fd;
}
@@ -366,7 +366,7 @@
=20
res =3D VG_(open)(current_command_file, VKI_O_RDONLY,0);
if (!res.isError) {
- fd =3D (Int) res.val;
+ fd =3D (Int) res.res;
bytesRead =3D VG_(read)(fd,cmdBuffer,500);
cmdBuffer[500] =3D 0; /* no command overrun please */
VG_(close)(fd);
Modified: branches/AIX5/callgrind/dump.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/callgrind/dump.c 2006-10-01 17:11:17 UTC (rev 6114)
+++ branches/AIX5/callgrind/dump.c 2006-10-01 17:12:50 UTC (rev 6115)
@@ -1293,7 +1293,7 @@
file_err();
}
}
- fd =3D (Int) res.val;
+ fd =3D (Int) res.res;
=20
CLG_DEBUG(2, " new_dumpfile '%s'\n", filename);
=20
@@ -1551,7 +1551,7 @@
=20
p++;
}
- =20
+
close_dumpfile(print_buf, print_fd, CLG_(current_tid));
if (array) VG_(free)(array);
=20
@@ -1602,7 +1602,6 @@
=20
print_bbccs(trigger, only_current_thread);
=20
-
bbs_done =3D CLG_(stat).bb_executions++;
=20
if (VG_(clo_verbosity) > 1)
@@ -1707,7 +1706,7 @@
file_err();=20
}
}
- if (!res.isError) VG_(close)( (Int)res.val );
+ if (!res.isError) VG_(close)( (Int)res.res );
=20
*dir =3D base_directory;
*file =3D filename;
Modified: branches/AIX5/callgrind/global.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/callgrind/global.h 2006-10-01 17:11:17 UTC (rev 6114)
+++ branches/AIX5/callgrind/global.h 2006-10-01 17:12:50 UTC (rev 6115)
@@ -8,6 +8,7 @@
#define CLG_GLOBAL
=20
#include "pub_tool_basics.h"
+#include "pub_tool_vki.h"
#include "pub_tool_debuginfo.h"
#include "pub_tool_libcbase.h"
#include "pub_tool_libcassert.h"
Modified: branches/AIX5/callgrind/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/callgrind/main.c 2006-10-01 17:11:17 UTC (rev 6114)
+++ branches/AIX5/callgrind/main.c 2006-10-01 17:12:50 UTC (rev 6115)
@@ -924,11 +924,11 @@
/* pop all remaining items from CallStack for correct sum
*/
CLG_(forall_threads)(unwind_thread);
- =20
+
CLG_(dump_profile)(0, False);
- =20
+
CLG_(finish_command)();
- =20
+
if (VG_(clo_verbosity) =3D=3D 0) return;
=20
/* Hash table stats */
Modified: branches/AIX5/callgrind/sim.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/callgrind/sim.c 2006-10-01 17:11:17 UTC (rev 6114)
+++ branches/AIX5/callgrind/sim.c 2006-10-01 17:12:50 UTC (rev 6115)
@@ -1637,7 +1637,7 @@
return;
=20
bad:
- VG_(bad_option)(orig_opt);
+ VG_(err_bad_option)(orig_opt);
}
=20
/* Check for command line option for cache configuration.
|
|
From: <sv...@va...> - 2006-10-01 17:11:20
|
Author: sewardj
Date: 2006-10-01 18:11:17 +0100 (Sun, 01 Oct 2006)
New Revision: 6114
Log:
Track changes of type SysRes; also renaming wibble.
Modified:
branches/AIX5/cachegrind/cg_main.c
Modified: branches/AIX5/cachegrind/cg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/cachegrind/cg_main.c 2006-10-01 17:09:43 UTC (rev 6113)
+++ branches/AIX5/cachegrind/cg_main.c 2006-10-01 17:11:17 UTC (rev 6114)
@@ -30,6 +30,7 @@
*/
=20
#include "pub_tool_basics.h"
+#include "pub_tool_vki.h"
#include "pub_tool_debuginfo.h"
#include "pub_tool_libcbase.h"
#include "pub_tool_libcassert.h"
@@ -1001,7 +1002,7 @@
" ... so simulation results will be missing.");
return;
} else {
- fd =3D sres.val;
+ fd =3D sres.res;
}
=20
// "desc:" lines (giving I1/D1/L2 cache configuration). The spaces a=
fter
@@ -1287,7 +1288,7 @@
return;
=20
bad:
- VG_(bad_option)(opt);
+ VG_(err_bad_option)(opt);
}
=20
static Bool cg_process_cmd_line_option(Char* arg)
|
|
From: <sv...@va...> - 2006-10-01 17:09:46
|
Author: sewardj
Date: 2006-10-01 18:09:43 +0100 (Sun, 01 Oct 2006)
New Revision: 6113
Log:
Various minor changes to make these compile on AIX5.
Modified:
branches/AIX5/none/tests/async-sigs.c
branches/AIX5/none/tests/blockfault.c
branches/AIX5/none/tests/mq.c
branches/AIX5/none/tests/mremap.c
branches/AIX5/none/tests/mremap2.c
branches/AIX5/none/tests/pth_atfork1.c
branches/AIX5/none/tests/pth_cancel1.c
branches/AIX5/none/tests/sigstackgrowth.c
branches/AIX5/none/tests/susphello.c
branches/AIX5/none/tests/threaded-fork.c
branches/AIX5/none/tests/threadederrno.c
branches/AIX5/none/tests/threadederrno.stdout.exp
Modified: branches/AIX5/none/tests/async-sigs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/async-sigs.c 2006-10-01 17:08:16 UTC (rev 61=
12)
+++ branches/AIX5/none/tests/async-sigs.c 2006-10-01 17:09:43 UTC (rev 61=
13)
@@ -72,6 +72,7 @@
}
=20
if (pid =3D=3D 0) {
+ alarm(10); /* if something breaks, don't spin forever */
signal(caughtsig, handler);
=20
for(;;)
Modified: branches/AIX5/none/tests/blockfault.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/blockfault.c 2006-10-01 17:08:16 UTC (rev 61=
12)
+++ branches/AIX5/none/tests/blockfault.c 2006-10-01 17:09:43 UTC (rev 61=
13)
@@ -13,6 +13,10 @@
the default handler */
int main()
{
+#if defined(_AIX)
+ printf("this test hangs when run (even natively) on AIX\n");
+ return 0;
+#endif
struct sigaction sa;
sigset_t mask;
=20
@@ -25,7 +29,7 @@
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, NULL);
=20
- *(volatile int *)1234 =3D 213;
+ *(volatile int *)12345 =3D 213;
=20
return 0;
}
Modified: branches/AIX5/none/tests/mq.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mq.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mq.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
=20
#ifdef HAVE_MQUEUE_H
=20
Modified: branches/AIX5/none/tests/mremap.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mremap.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mremap.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -3,6 +3,16 @@
#include <stdio.h>
#include <stdlib.h>
=20
+#if defined(_AIX)
+
+int main ( void )
+{
+ printf("This test is Linux-specific.\n");
+ return 0;
+}
+
+#else
+
static char *mkmap(unsigned sz)
{
static char *map;
@@ -96,3 +106,5 @@
=20
return 0;
}
+
+#endif /* defined(_AIX) */
Modified: branches/AIX5/none/tests/mremap2.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mremap2.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mremap2.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -1,6 +1,17 @@
#define _GNU_SOURCE
=20
#include <stdio.h>
+
+#if defined(_AIX)
+
+int main ( void )
+{
+ printf("This test is Linux-specific.\n");
+ return 0;
+}
+
+#else
+
#include <sys/mman.h>
#include <assert.h>
#include <stdlib.h>
@@ -161,3 +172,5 @@
}
return 0;
}
+
+#endif /* defined(_AIX5) */
Modified: branches/AIX5/none/tests/pth_atfork1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/pth_atfork1.c 2006-10-01 17:08:16 UTC (rev 6=
112)
+++ branches/AIX5/none/tests/pth_atfork1.c 2006-10-01 17:09:43 UTC (rev 6=
113)
@@ -18,13 +18,28 @@
Boston, MA 02111-1307, USA. */
=20
#include <errno.h>
-#include <error.h>
+#if !defined(_AIX)
+# include <error.h>
+#endif
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
=20
+#if defined(_AIX)
+#include <string.h> /* strerror */
+static void error (int status, int errnum, char* msg)
+{
+ fprintf(stderr, "%s%s%s\n",
+ msg,
+ errnum ? ": " : "",
+ errnum ? strerror(errnum) : "");
+ if (errnum)
+ exit(errnum);
+}
+#endif
+
enum
{
PREPARE_BIT =3D 1,
Modified: branches/AIX5/none/tests/pth_cancel1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/pth_cancel1.c 2006-10-01 17:08:16 UTC (rev 6=
112)
+++ branches/AIX5/none/tests/pth_cancel1.c 2006-10-01 17:09:43 UTC (rev 6=
113)
@@ -5,7 +5,7 @@
=20
static void thread_cleanup(void *arg)
{
- printf("cleaning up %p\n", arg);
+ printf("cleaning up 0x%lx\n", (long)arg);
=20
return;
}
Modified: branches/AIX5/none/tests/sigstackgrowth.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/sigstackgrowth.c 2006-10-01 17:08:16 UTC (re=
v 6112)
+++ branches/AIX5/none/tests/sigstackgrowth.c 2006-10-01 17:09:43 UTC (re=
v 6113)
@@ -4,6 +4,10 @@
#include <sys/types.h>
#include <unistd.h>
=20
+#if defined(_AIX) && !defined(SA_NOMASK)
+# define SA_NOMASK 0
+#endif
+
static char *deep;
=20
#define SIZE (4*1024*1024)
Modified: branches/AIX5/none/tests/susphello.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/susphello.c 2006-10-01 17:08:16 UTC (rev 611=
2)
+++ branches/AIX5/none/tests/susphello.c 2006-10-01 17:09:43 UTC (rev 611=
3)
@@ -18,7 +18,7 @@
#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
-#include <sys/syscall.h>
+//#include <sys/syscall.h>
#include <dlfcn.h>
=20
=20
@@ -132,7 +132,12 @@
sa.sa_flags =3D SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction =3D ptiSrSigHandler;
sigfillset(&sa.sa_mask);
+
+# if !defined(_AIX)
+ /* jrs 20060615: is this important? I don't know. */
sigdelset(&sa.sa_mask, (__SIGRTMIN+1));
+# endif
+
if (sigaction(srSignal, &sa, 0) =3D=3D -1) {
perror("sigaction");
exit(1);
@@ -163,7 +168,11 @@
}
=20
void takedown_altstack(void* stack) {
+# if defined(_AIX)
+ stack_t ss;
+# else
struct sigaltstack ss;
+# endif
int result;
=20
ss.ss_flags =3D SS_DISABLE;
Modified: branches/AIX5/none/tests/threaded-fork.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threaded-fork.c 2006-10-01 17:08:16 UTC (rev=
6112)
+++ branches/AIX5/none/tests/threaded-fork.c 2006-10-01 17:09:43 UTC (rev=
6113)
@@ -14,6 +14,7 @@
=20
int main( int argc, char **argv )
{
+ int ctr;
pid_t childpid;
pthread_t childthread;
void *res;
@@ -36,8 +37,15 @@
}
=20
pthread_join( childthread, &res );
- while(waitpid(childpid, &status, 0) !=3D childpid)
- ;
+ ctr =3D 0;
+ while(waitpid(childpid, &status, 0) !=3D childpid) {
+ sleep(1);
+ ctr++;
+ if (ctr >=3D 10) {
+ printf("FAILED - timeout waiting for child\n");
+ return 0;
+ }
+ }
=20
printf("PASS\n");
=20
Modified: branches/AIX5/none/tests/threadederrno.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threadederrno.c 2006-10-01 17:08:16 UTC (rev=
6112)
+++ branches/AIX5/none/tests/threadederrno.c 2006-10-01 17:09:43 UTC (rev=
6113)
@@ -8,14 +8,14 @@
void* thr2 ( void* v )
{
FILE* f =3D fopen("bogus2", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
return NULL;
}
=20
void* thr3 ( void* v )
{
FILE* f =3D fopen("bogus3", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
return NULL;
}
=20
@@ -27,7 +27,7 @@
pthread_create(&tid2, NULL, &thr2, NULL);
pthread_create(&tid3, NULL, &thr3, NULL);
f =3D fopen("bogus", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
pthread_join(tid2, NULL);
pthread_join(tid3, NULL);
return 0;
Modified: branches/AIX5/none/tests/threadederrno.stdout.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threadederrno.stdout.exp 2006-10-01 17:08:16=
UTC (rev 6112)
+++ branches/AIX5/none/tests/threadederrno.stdout.exp 2006-10-01 17:09:43=
UTC (rev 6113)
@@ -1,3 +1,3 @@
-f =3D (nil), errno =3D 2 (No such file or directory)
-f =3D (nil), errno =3D 2 (No such file or directory)
-f =3D (nil), errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
|