|
From: <sv...@va...> - 2006-08-28 12:17:45
|
Author: sewardj
Date: 2006-08-28 13:17:41 +0100 (Mon, 28 Aug 2006)
New Revision: 6021
Log:
Merge r5979 (fix for: Can't stat .so/.exe error while reading symbols)
Modified:
branches/VALGRIND_3_2_BRANCH/coregrind/m_debuginfo/readelf.c
branches/VALGRIND_3_2_BRANCH/coregrind/m_libcfile.c
Modified: branches/VALGRIND_3_2_BRANCH/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/VALGRIND_3_2_BRANCH/coregrind/m_debuginfo/readelf.c 2006-08-=
28 12:13:19 UTC (rev 6020)
+++ branches/VALGRIND_3_2_BRANCH/coregrind/m_debuginfo/readelf.c 2006-08-=
28 12:17:41 UTC (rev 6021)
@@ -821,7 +821,6 @@
Addr dimage =3D 0;
UInt n_dimage =3D 0;
OffT offset_dimage =3D 0;
- struct vki_stat stat_buf;
=20
oimage =3D (Addr)NULL;
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
@@ -832,16 +831,16 @@
line number info out of it. It will be munmapped immediately
thereafter; it is only aboard transiently. */
=20
- fd =3D VG_(stat)(si->filename, &stat_buf);
+ fd =3D VG_(open)(si->filename, VKI_O_RDONLY, 0);
if (fd.isError) {
- ML_(symerr)("Can't stat .so/.exe (to determine its size)?!");
+ ML_(symerr)("Can't open .so/.exe to read symbols?!");
return False;
}
- n_oimage =3D stat_buf.st_size;
=20
- fd =3D VG_(open)(si->filename, VKI_O_RDONLY, 0);
- if (fd.isError) {
- ML_(symerr)("Can't open .so/.exe to read symbols?!");
+ n_oimage =3D VG_(fsize)(fd.val);
+ if (n_oimage < 0) {
+ ML_(symerr)("Can't stat .so/.exe (to determine its size)?!");
+ VG_(close)(fd.val);
return False;
}
=20
Modified: branches/VALGRIND_3_2_BRANCH/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/VALGRIND_3_2_BRANCH/coregrind/m_libcfile.c 2006-08-28 12:13:=
19 UTC (rev 6020)
+++ branches/VALGRIND_3_2_BRANCH/coregrind/m_libcfile.c 2006-08-28 12:17:=
41 UTC (rev 6021)
@@ -133,8 +133,13 @@
=20
Int VG_(fsize) ( Int fd )
{
+#ifdef __NR_fstat64
+ struct vki_stat64 buf;
+ SysRes res =3D VG_(do_syscall2)(__NR_fstat64, fd, (UWord)&buf);
+#else
struct vki_stat buf;
SysRes res =3D VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
+#endif
return res.isError ? (-1) : buf.st_size;
}
=20
|