Mail Archives: djgpp-workers/2001/12/09/05:55:37
Hello.
Charles Sandmann wrote:
> Profiling isn't going to work in a DXE so we should stub out at a higher
> level by adding the following line to emudummy.c:
>
> void mcount(int _to) {}
You beauty! That worked. Below is a diff for the fixes for src/libemu. OK
to commit?
I tested emu387.dxe briefly on my box in a DOS windows with COMMAND.COM as
shell using:
set EMU387=c:/develop/djgpp.rw/bin/emu387.dxe
set 387=n
and this test program:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main (void)
{
double d = atan(0.123);
printf("%g\n", d);
return(EXIT_SUCCESS);
}
Using the math co-pro (387 not set or set to y) gives a result of
0.122385; using a patched emu387.dxe gives a result of 0.1. Shouldn't the
results be the same or at least a little closer?
Also if I run the test with 387=y, rerun the test with 387=n and finally
rerun the test with set 387=y, I get an 'Exiting due to signal SIGNOFP'
error. The program gets stuck in a loop, repeatedly crashing with SIGNOFP.
Here's a symify'd traceback for a crash in the middle of the loop:
Coprocessor not available at eip=0000b120
eax=00000002 ebx=00004dd0 ecx=00000003 edx=00010ec4 esi=00000002
edi=00004dd3
ebp=0004f064 esp=0004f058 program=C:\TEMP\TEST\M.EXE
cs: sel=00a7 base=83b1d000 limit=0009ffff
ds: sel=00af base=83b1d000 limit=0009ffff
es: sel=00af base=83b1d000 limit=0009ffff
fs: sel=0087 base=0001dab0 limit=0000ffff
gs: sel=00bf base=00000000 limit=0010ffff
ss: sel=00af base=83b1d000 limit=0009ffff
App stack: [00095488..00015488] Exceptn stack: [00015338..000133f8]
Call frame traceback EIPs:
0x0000b120 __clear87
0x00005277 __mcount_init+2391
0x0000557c ___djgpp_traceback_exit+92
0x00005665 _raise+101
0x000056f9 ___djgpp_exception_processor+41
0x00000002 0x2
0x00005277 __mcount_init+2391
0x0000557c ___djgpp_traceback_exit+92
0x00005665 _raise+101
0x000056f9 ___djgpp_exception_processor+41
0x00000002 0x2
Exiting due to signal SIGNOFP
I tried this with another CVS copy of the sources and a similar problem
occurred. The traceback was slightly different this time:
Exiting due to signal SIGNOFP
Coprocessor not available at eip=00009f50
eax=00000002 ebx=000048a3 ecx=00000003 edx=00000000 esi=00000002
edi=000048a6
ebp=00089a24 esp=00089a18 program=C:\TEMP\TEST\M.EXE
cs: sel=00a7 base=83b1d000 limit=0009ffff
ds: sel=00af base=83b1d000 limit=0009ffff
es: sel=00af base=83b1d000 limit=0009ffff
fs: sel=0087 base=0001dab0 limit=0000ffff
gs: sel=00bf base=00000000 limit=0010ffff
ss: sel=00af base=83b1d000 limit=0009ffff
App stack: [00092de8..00012de8] Exceptn stack: [00012ca8..00010d68]
Call frame traceback EIPs:
0x00009f50 __clear87
0x00004d42 _strlen+2370
0x00005022 ___djgpp_traceback_exit+82
0x000050fd _raise+93
0x0000517f ___djgpp_exception_processor+31
0x00000002 0x2
0x00004d42 _strlen+2370
0x00005022 ___djgpp_traceback_exit+82
0x000050fd _raise+93
0x0000517f ___djgpp_exception_processor+31
0x00000002 0x2
Any ideas were I should look [next weekend/later in the week] to debug
this? It feels like there may be some stale exception handler state left
over from the 387=n case, but then again I know nothing about exception
handlers!
> I think this should allow the DXE which is built to work, but allow the
> library built with profiling to also work inside an image. The DXE
> would have some dead code in it, and no more useful than the standard
> DXE, but would at least hopefully link without problems.
Well, there's hardly any dead code, so it doesn't seem worth worrying
about it IMHO.
> If we are calling any new functions other than mcount we would have to
> add them to the emudummy.c also.
mcount() was the only one that needed stubbing.
Thanks for the help! Bye, Rich =]
--
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/
Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.102
diff -p -c -3 -r1.102 wc204.txi
*** src/docs/kb/wc204.txi 2001/12/02 11:59:19 1.102
--- src/docs/kb/wc204.txi 2001/12/09 10:11:15
*************** The types @code{blksize_t} and @code{blk
*** 690,698 ****
@code{blksize_t} is now used for the @code{st_blksize} member of
@code{struct stat}.
@cindex libc and profiling
@cindex libm and profiling
@cindex @file{gcc.opt}, and profiling
The build system for the C libraries was modified, so that profiling
versions can be built. Profiling options in @file{gcc.opt} are ignored
! for certain files in the C libraries' sources.
--- 690,702 ----
@code{blksize_t} is now used for the @code{st_blksize} member of
@code{struct stat}.
+ @cindex C libraries and profiling
@cindex libc and profiling
@cindex libm and profiling
+ @cindex @file{emu387.dxe} and profiling
@cindex @file{gcc.opt}, and profiling
The build system for the C libraries was modified, so that profiling
versions can be built. Profiling options in @file{gcc.opt} are ignored
! for certain files in the C libraries' sources. The build system for
! @file{emu387.dxe}, the math co-processor emulation library, was also
! modified, so that it can be built against a profiled version of libc.
Index: src/libemu/src/makefile
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libemu/src/makefile,v
retrieving revision 1.3
diff -p -c -3 -r1.3 makefile
*** src/libemu/src/makefile 1999/06/03 17:27:40 1.3
--- src/libemu/src/makefile 2001/12/09 10:11:15
*************** SRC += npxsetup.o
*** 8,10 ****
--- 8,16 ----
EXTRA_OBJS += emudummy.o
include $(TOP)/../makefile.inc
+
+ %.o : %.cc
+ $(XNOPGGCC) -c -fno-exceptions $<
+
+ %.o : %.c
+ $(XNOPGGCC) -c $<
Index: src/libemu/src/emudummy.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libemu/src/emudummy.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 emudummy.c
*** src/libemu/src/emudummy.c 1997/11/02 19:54:30 1.1
--- src/libemu/src/emudummy.c 2001/12/09 10:11:15
***************
*** 1,14 ****
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
! /* Dummy routines to enable building of emu387.dxe from libemu.a - since
we
! can't do I/O, dummy the I/O routines out. */
! void vsprintf(void);
! void _write(void);
! void vsprintf(void) {}
! void _write(void) {}
int __djgpp_exception_state_ptr;
--- 1,39 ----
+ /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
!
! /* Dummy routines to enable building of emu387.dxe from libemu.a.
! *
! * Since we can't do I/O, dummy the I/O routines out. Since we can't
link
! * against a profiled libc, dummy the profiling functions out.
! */
!
! #include <stdio.h>
! #include <stdarg.h>
! #include <io.h>
! #include <libc/dosio.h>
! #include <errno.h>
! int
! vsprintf (char *buf, const char *fmt, va_list args)
! {
! return 0;
! }
!
! ssize_t
! _write (int fd, const void *buf, size_t nbyte)
! {
! errno = EACCES;
! return -1;
! }
!
! void mcount (int _to);
! void
! mcount (int _to)
! {
! }
int __djgpp_exception_state_ptr;
- Raw text -