Mail Archives: cygwin-developers/1998/06/05/19:09:35
Any thoughts on where to hook in gprof support? Currently I add the
gprof routines (gmon, mcount, and profil) to the cygwin dll, which is
probably not ideal. I added a gcrt0 which is a clone of crt0 except
it calls cygwin_gcrt0 in libccrt0.cc. One thought was to have a
separate library for gprof. This is what linux does.
Index: Makefile.in
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/Makefile.in,v
retrieving revision 1.100
diff -u -p -u -r1.100 Makefile.in
--- Makefile.in 1998/04/21 19:39:02 1.100
+++ Makefile.in 1998/06/04 19:47:12
@@ -244,12 +244,14 @@ DLL_OFILES = $(EXTRA_DLL_OFILES) \
fhandler.o \
fork.o \
glob.o \
+ gmon.o \
grp.o \
heap.o \
hinfo.o \
init.o \
ioctl.o \
malloc.o \
+ mcount.o \
mmap.o \
net.o \
ntea.o \
@@ -257,6 +259,7 @@ DLL_OFILES = $(EXTRA_DLL_OFILES) \
path.o \
pinfo.o \
pipe.o \
+ profil.o \
registry.o \
resource.o \
security.o \
Index: cygwin.din
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/cygwin.din,v
retrieving revision 1.74
diff -u -p -u -r1.74 cygwin.din
--- cygwin.din 1998/04/21 19:18:45 1.74
+++ cygwin.din 1998/06/04 19:47:14
@@ -423,6 +423,8 @@ mbstowcs
_mbstowcs = mbstowcs
mbtowc
_mbtowc = mbtowc
+mcount
+_mcount = mcount
memchr
_memchr = memchr
memcmp
@@ -444,6 +446,8 @@ _mktemp = mktemp
mktime
_mktime = mktime
mmap
+monstartup
+_monstartup = monstartup
mprotect
msync
munmap
@@ -475,6 +479,8 @@ powf
_powf = powf
printf
_printf = printf
+profil
+_profil = profil
putc
_putc = putc
putchar
@@ -943,4 +949,4 @@ dlsym
dlerror
dlfork
sigpause
-cygwin32_attach_handle_to_fd
+cygwin32_attach_handle_to_fd
Index: libccrt0.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/libccrt0.cc,v
retrieving revision 1.24
diff -u -p -u -r1.24 libccrt0.cc
--- libccrt0.cc 1998/02/21 22:43:57 1.24
+++ libccrt0.cc 1998/06/04 19:47:15
@@ -99,6 +99,22 @@ void cygwin_crt0 (MainFunc f)
dll_crt0 (&cygwin_statu);
}
+/* for main module */
+extern u_char etext asm("etext");
+extern u_char eprol asm("eprol");
+extern void _mcleanup();
+void cygwin_gcrt0 (MainFunc f)
+{
+ cygwin_crt0_common (f);
+
+ monstartup((u_long)&eprol, (u_long)&etext);
+
+ /* Jump into the dll. */
+ dll_crt0 (&cygwin_statu);
+}
+asm(".text");
+asm("eprol:");
+
/* for a loaded dll */
int cygwin32_attach_dll (HMODULE h, MainFunc f)
{
- Raw text -