Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Dec 1997 09:56:41 +1100 (EST)
From:      Andrew Reilly <reilly@zeta.org.au>
To:        bde@zeta.org.au
Cc:        reilly@zeta.org.au, freebsd-current@freebsd.org, rcarter@consys.com
Subject:   Re: xlock: caught signal 8 while running galaxy mode.
Message-ID:  <199712142256.JAA06128@gurney.reilly.home>
In-Reply-To: <199712111736.EAA17753@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12 Dec, Bruce Evans wrote:
> In old mail, Andrew wrote:
>>>>I recently tried to port some speech recognition code that runs fine on
> I wrote:
>>> Do you mean overflow?  FreeBSD masks underflow, denormal and precision
>>> exceptions by default.

You are exactly right here.  I removed the fpsetmask(0) I had inserted
to make things work, ran the program again in gdb, and did an "info
float", as you suggested below.  The result clearly says that underflow
exceptions are not enabled.  The st(0) element is larger than a float
too, so I imagine that storing that would cause an overflow exception.

What I'm not sure about is figuring out, from the gdb output, where
things have gone awry.

(gdb) run -S call.lst
Starting program: /usr/home/andrew/work/Clients/Syrinx/jun-19/sycon/unix/try/syph_ux -S call.lst
Call Setup.
RunUtterance(model:amt4.bin, speech:amt1.lin)

Program received signal SIGFPE, Arithmetic exception.
0x4a8c in CalcU () at state.c:305
305                         if (s > *pMax) *pMax = s;
(gdb) info float
u: status 0xb9aa: exceptions: DENORM OVERF LOS; flags: 0001; top 7
e: status 0x3900: flags: 0001; top 7
control 0x1272: compute to 53 bits; round NEAREST; mask: DENORM UNDERF LOS;
last instruction: opcode 0x1d0; pc 0x8:0xf01847b2; operand 0x10:0x0
 regno     tag  msb              lsb  value
%st(0) => valid c0b3bc70e9bbbb8fc000  -2.25613e+54
%st(7)    empty c018cab22e52cfe7b800  -5.31355e+07
%st(6)    empty 3ffcc54d730000000000  0.192678
%st(5)    empty 4005c77ebf0000000000  99.7476
%st(4)    empty c003a0ac010000000000  -20.084
%st(3)    empty 4002cf06f70000000000  12.9392
%st(2)    empty 403dded05e7ad6e8e6e4  8.02772e+18
%st(1)    empty 403dcae4c8dcc25ecada  7.31002e+18

Note that the FPU pc doesn't bear any resemblance (to me) to the CPU pc:
(gdb) info registers
eax            0xbb28   47912
ecx            0xb420   46112
edx            0xb9f8   47608
ebx            0x7d4b8  513208
esp            0xefbfd6f4       0xefbfd6f4
ebp            0xefbfd720       0xefbfd720
esi            0xe49d0  936400
edi            0xbb3c   47932
eip            0x4a8c   0x4a8c
eflags         0x10206  66054
cs             0x1f     31
ss             0x27     39
ds             0x27     39
es             0x27     39

Since the segment registers seem to be different.  I assume that the
0x8: after pc means code segment 8.  Maybe it doesn't.

Since it's fairly close, I tried disassembling 47b2 (the low word of
the fpu pc), but that doesn't seem a likely candidate: it's a purely
integer routine.

If the problem really is overflow, then the exceptions are doing the
right thing, and have caught a bug that I want to know about, but can
you tell from the above where I should be looking?

> `p' can't handle variables in x87 registers.  It prints the above value
> after `register float z; z = 1' here.  I think it just doesn't know
> where the variables really are.  Use `info float' to get more information.

Thinking about it, it would be quite hard for a debugger to know that
about register floats on a stack: they move around all the time.  Would
it be possible to force the compiler to ignore "register" on floats
when the "-g" flag is used?

> Not much to go wrong there.  `info float' would show the (FPU)
> pc where the exception occurred (the next FP instruction causes
> the trap but it doesn't get executed, so the pc still points
> to the previous FP instruction.

Hmmm.  I just don't don't know how to do that.

(gdb) disassemble 0x8:0xf01847b2
A syntax error in expression, near `0xf01847b2'.
(gdb) disassemble 0xf01847b2
No function contains specified address.

-- 
Andrew

"The steady state of disks is full."
				-- Ken Thompson




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712142256.JAA06128>