Stack Underflow!!!?? Please help!

Stack Underflow!!!?? Please help!

Post by Gordon McClenn » Tue, 16 May 1995 04:00:00



I'm having a VERY WEIRD problem that I'm not able to trace.  I'm
hoping that someone, out of the good of their heart, might give any
suggestions they have as to what they think the problem is.

The application:

The main application is a Visual Basic MDI application which serves as
little more than a shell to call two C DLLs.  One DLL is a serial port
driver which receives characters at 19200bps and every 260 characters
processes the data received.  The other DLL is simply a graphics drivers
which is little more than a few bitblt's and Textouts which graphs the
data recieved about twice a second.

The problem I'm getting is usually a FLOATING POINT: STACK UNDERFLOW
error.  I've used SoftIce to break on the error and trace back, and
the error is definitely coming from a floating point assembly
instruction.  

So far I have failed to trace the problem.  I have checked and
re-checked every array that I have. I could not find anything that
could be corrupting memory, though I feel that this must be the
problem.  My local heap has plenty of space (though since this is a
DLL, an overrun should not affect the stack anyway).  All my global
allocations worked with no error.  There must be something I've
missed. This application is pretty intensive -- every 200ms a lot of
floating point calculations are done within the interrupt service
routine.

I've been doing everything I know how for over a week now, and I have
been unable to turn up anything.  I'm beginning to think this is a bug
in Windows.

Questions:

Besides memory overwrites with an array, is there any other way to
corrupt memory?

Is there anything that I should be aware of concerning serial port ISR's
that might possible cause this problem?

Are there any other ways to determine if memory corruption is the problem?

No suggestion is too lame, people.  I'm hoping someone else will catch
something I missed.  Thanks for any help in advance.

Gordon

 
 
 

Stack Underflow!!!?? Please help!

Post by Tron Hvari » Wed, 17 May 1995 04:00:00



[snip]

Quote:> The application:

> The main application is a Visual Basic MDI application which serves as
> little more than a shell to call two C DLLs.  One DLL is a serial port
> driver which receives characters at 19200bps and every 260 characters
> processes the data received.  The other DLL is simply a graphics drivers
> which is little more than a few bitblt's and Textouts which graphs the
> data recieved about twice a second.

> The problem I'm getting is usually a FLOATING POINT: STACK UNDERFLOW
> error.  I've used SoftIce to break on the error and trace back, and
> the error is definitely coming from a floating point assembly
> instruction.  

> So far I have failed to trace the problem.  I have checked and
> re-checked every array that I have. I could not find anything that
> could be corrupting memory, though I feel that this must be the
> problem.  My local heap has plenty of space (though since this is a
> DLL, an overrun should not affect the stack anyway).  All my global
> allocations worked with no error.  There must be something I've
> missed. This application is pretty intensive -- every 200ms a lot of
> floating point calculations are done within the interrupt service
> routine.

Doing math in an ISR is only safe if you know that the math routines
are re-entrant. If they're not, you'll get all kinds of weird results.
And if you have an 80x87 chip (or a 486DX or better), the floating
point hardware is shared among all active programs and Windows itself.
Using it in an ISR sounds very risky to me. Try to move the math stuff
out of the ISR, if possible, and I suspect the problem will go away.

----------------------------+--------------------
Ceterum, censeo Carthaginem | Tron Hvaring

----------------------------+--------------------

 
 
 

1. std::stack underflow checking

Hi!
Could someone explain to me why std::stack<>::top() function doesn't
throw "underflow" exception? Is it right design? Are there other
reasons besides performance?
Thanks, Kirill


      [ about comp.lang.c++.moderated. First time posters: do this! ]

2. Dual Boot with 2 different fresh installs (Win98, Win2K)

3. Stack Underflow

4. Wanted: cubase audio for falcon

5. Stack Underflow error on some systems

6. Backing up IFS folders etc.. - extraterra..

7. Please help!!!!Please help!!!!Please help!!!!

8. DesignJet 755CM inks

9. Please Help me !!! Please Please Please!!!!!!!!!!!!!!!

10. Stack Corruption help please...

11. Please Help!! (Stack Frames)

12. HELP NEEDED PLEASE PLEASE PLEASE!!!!

13. Please Critque this Stack Template