|
From: <sv...@va...> - 2005-09-24 16:45:22
|
Author: sewardj
Date: 2005-09-24 17:45:16 +0100 (Sat, 24 Sep 2005)
New Revision: 4746
Log:
Make (g)db attaching work again.
Modified:
branches/ASPACEM/coregrind/m_clientstate.c
branches/ASPACEM/coregrind/m_libcproc.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/pub_core_clientstate.h
Modified: branches/ASPACEM/coregrind/m_clientstate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_clientstate.c 2005-09-24 12:45:15 UTC (r=
ev 4745)
+++ branches/ASPACEM/coregrind/m_clientstate.c 2005-09-24 16:45:16 UTC (r=
ev 4746)
@@ -52,7 +52,10 @@
Addr VG_(brk_base) =3D 0; /* start of brk */
Addr VG_(brk_limit) =3D 0; /* current brk */
=20
+/* A fd which refers to the client executable. */
+Int VG_(clexecfd) =3D -1;
=20
+
// Command line pieces, after they have been extracted from argv in
// m_main.main(). The payload vectors are allocated in VG_AR_TOOL
// (the default arena). They are never freed.
Modified: branches/ASPACEM/coregrind/m_libcproc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcproc.c 2005-09-24 12:45:15 UTC (rev =
4745)
+++ branches/ASPACEM/coregrind/m_libcproc.c 2005-09-24 16:45:16 UTC (rev =
4746)
@@ -46,9 +46,6 @@
envp[] as extracted from the client's stack at startup-time. */
Char** VG_(client_envp);
=20
-/* client executable file descriptor */
-Int VG_(clexecfd) =3D -1;
-
/* Path to library directory */
const Char *VG_(libdir) =3D VG_LIBDIR;
=20
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-24 12:45:15 UTC (rev 4745=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-24 16:45:16 UTC (rev 4746=
)
@@ -828,6 +828,7 @@
{
HChar* exec;
Int ret;
+ SysRes res;
=20
vg_assert( VG_(args_the_exename) !=3D NULL);
exec =3D find_executable( VG_(args_the_exename) );
@@ -843,6 +844,12 @@
VG_(exit)(127);
}
=20
+ /* Get hold of a file descriptor which refers to the client
+ executable. This is needed for attaching to GDB. */
+ res =3D VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR);
+ if (!res.isError)
+ VG_(clexecfd) =3D res.val;
+
/* Copy necessary bits of 'info' that were filled in */
*client_eip =3D info->init_eip;
VG_(brk_base) =3D VG_(brk_limit) =3D VG_PGROUNDUP(info->brkbase);
Modified: branches/ASPACEM/coregrind/pub_core_clientstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-24 12:45:15=
UTC (rev 4745)
+++ branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-24 16:45:16=
UTC (rev 4746)
@@ -51,7 +51,7 @@
extern Addr VG_(brk_base); // start of brk
extern Addr VG_(brk_limit); // current brk
=20
-// Client's executable file descriptor.
+/* A fd which refers to the client executable. */
extern Int VG_(clexecfd);
=20
// Client's original rlimit data and rlimit stack
|