1. RE: EXW Crashes!

Yep, Kat, you have it.
My program was calling code after the memory had been de-allocated!
So with a catch-all around it with a flag telling me if it has been set 
or freed I avoid that. Sorry I blamed EXW!! Mea culpa,...
Andy.

Kat wrote:
> On 28 Apr 2001, at 7:59, Derek Parnell wrote:
> 
> 
> > 
> > ----- Original Message -----
> > From: "Andy Drummond" <kestrelandy at xalt.co.uk>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Friday, April 27, 2001 11:39 PM
> > Subject: EXW Crashes!
> > 
> > 
> > > The first is that when I get an error with sequence subscripts out of
> > > range - like reading 20th element of a sequence of length 19 - I don't
> > > get a ex.err file generated. This is particularly annoying as the
> > > DOS-style dump is just not enough lines to show the place where the
> > > error occurred. Any ideas?
> > 
> > Forgive my abruptness but can you prove this assertion? For example:
> > 
> >   sequence x x = repeat(0,19)
> >   x[20] = 1
> > 
> > Does this fail or succeed?
> > 
> > > The second is worse. The advertising for Euphoria tells me it won't
> > > crash and when it finds a fault it will produce a meaningful message.
> > > Not so. I keep getting errors with EXW trying to access 0xffffffff,
> > > which the OS doesn't care for.  The "details" from the Win98 crash
> > > message is as follows. Should it go to RDS do you think?
> > >
> > This sounds like you have an atom with the value of -1 and are using 
> > that as an
> > address. eg.
> >  atom memadr
> > 
> >   memadr = -1
> >   poke (memadr, 0)
> > 
> > Can I suggest that if you are using poke() anywhere, that you surround 
> > this with
> > trace(1) statements and trace the code execution.  If you are not using 
> > poke(),
> > then you can send the code directly to me and I'll try to locate the 
> > error for
> > you.
> 
> Or, if there are too many, or it runs too fast, preceed the poke()s with
> 
>  puts(1,somelinenumber&"  "&address&"  "&data&"\n\n")
> ( might need some sprintf()s in there )
<snip>

new topic     » topic index » view message » categorize

2. RE: EXW Crashes!

Hi there,

>> I keep getting errors with EXW trying to access 0xffffffff

Yes, as others had mentioned you are probably trying to poke a 
value into memory that your code hadnt yet allocated.
This is something you have to be very strict with.

You cant allocate 8 bytes and poke 9:
    atom addr
    addr=allocate(8)
    poke(addr,{1,2,3,4,5,6,7,8,9})--triggers error
    maybe_call_a_function()
    free(addr)

A simple way to troubleshoot this kind of problem is
to insert a few traces into the program such as:

1   with trace
2   atom addr
3   ?1
4   trace(1)
5   addr=allocate(8)
6   poke(addr,{1,2,3,4,5,6,7,8,9})
7   maybe_call_a_function()
8   free(addr)
9   ?2
10  trace(1)

Now when you run the program, it prints a '1' to the screen
and then starts tracing at the first trace command.
Now you hit 'Q' and the program crashes BEFORE printing the
'2', so you know the error occurred between the place where
the '1' is being printed (line #3) and where the '2'
is being printed (line #9).
Now you run the program again only
this time after the program prints the '1' and starts tracing,
instead of hitting 'Q' you hit ENTER and trace through
it line by line.  When you get to the line that causes the error
and you hit enter, the program crashes.  Now you know the line
that caused the error at least.  You then have to start
examining the code up to that point in the program to find
what may be responsible for the error.  In this example you would
have to recognize the fact that there are 9 items being 
poked into successive locations when only 8 have been allocated.

Sometimes thats the only way to locate an error.

Oh you could try WinDebug which is on the Euphoria site download
area, but the procedure is somewhat the same.

Good luck with it.
--Al

new topic     » goto parent     » topic index » view message » categorize

3. RE: EXW Crashes!

Thanks for the suggestion. Unfortunately when I use safe.e in place of 
machine.e it crashes immediately. Comes up saying 'Using debug ....' 
etc, press Enter & instantly Bang! fails at 7675916 (#0075200C). For any 
and all .EXW programs. So either I have a buggy EXW or a buggy Safe.e or 
a buggy PC or a buggy brain.

I will look, in the meantime, for any possible poke of illegal data or 
calls to poked code after the memory has been released etc etc.

Any further comments (polite ones, even) welcome. I will re-install 
Euphoria from the disk - I'm glad I got a disk and not just a 
download...

Andy

Chris Bensler wrote:
> I don't know why your not getting Ex.err for subscript out of bounds..
> You should, I do...
> 
> The secoond error isn't a Euphoria error at all.. It means that you 
> tried to make an invalid memory assignment. It's a problem in your 
> code.. (usually your trying to poke data to unallocated memory..)
> 
> A lot of times when you get those errors, you can run your program using 
> 
> safe.e instead of machine.e, and it will tell you what the problem is..
> 
> To use safe.e, just rename safe.e to machine.e. Make sure you rename the 
> 
> original machine.e first though..
> 
> I don't know how well safe.e will work with win32lib though... don't 
> have experience with it..
> 
> Chris
> 
> 
> Andy Drummond wrote:
> > I have two problems with EXW which maybe someone can shed some light on.
> > 
> > The first is that when I get an error with sequence subscripts out of 
> > range - like reading 20th element of a sequence of length 19 - I don't 
> > get a ex.err file generated. This is particularly annoying as the 
> > DOS-style dump is just not enough lines to show the place where the 
> > error occurred. Any ideas?
> > 
> > The second is worse. The advertising for Euphoria tells me it won't 
> > crash and when it finds a fault it will produce a meaningful message. 
> > Not so. I keep getting errors with EXW trying to access 0xffffffff, 
> > which the OS doesn't care for.  The "details" from the Win98 crash 
> > message is as follows. Should it go to RDS do you think?
> > 
> > 
> > EXW caused an invalid page fault in
> > module <unknown> at 0000:007f83e0.
> > Registers:
> > EAX=00000001 CS=0167 EIP=007f83e0 EFLGS=00010216
> > EBX=007f83e0 SS=016f ESP=0056f940 EBP=0056f94e
> > ECX=008569c4 DS=016f ESI=007f83e0 FS=3faf
> > EDX=007f8290 ES=016f EDI=00000008 GS=0000
> > Bytes at CS:EIP:
> > 20 00 7e 00 fc 84 7f 00 ba f3 83 7f 00 88 02 5a 
> > Stack dump:
> > 0041454c 0056f998 bff7363b 00000544 00000020 00000544 02000001 89961317 
> > 00000000 00000000 00000000 00000000 00000000 007f83e0 007f846b 005689b6 
> > 
<snip>

new topic     » goto parent     » topic index » view message » categorize

4. RE: EXW Crashes!

> The second is worse. The advertising for Euphoria tells me it won't 
> crash and when it finds a fault it will produce a meaningful message. 
> Not so. I keep getting errors with EXW trying to access 0xffffffff, 
> which the OS doesn't care for.  The "details" from the Win98 crash 
> message is as follows. Should it go to RDS do you think?

Andy,

I don't know if this helps but I have run across some problems with 
using Win98/Win32Lib that actually is not a fault of exw.exe but the 
problem is in Win32Lib.  Don't get me wrong, I'm not downing Win32Lib 
because I think it's GREAT but when something is in a development stage 
like Win32Lib these things will happen.

Here's a suggestion...when you get the crash and if you get the Windows 
message box that tells you your program did a no-no, see if there is a 
"Details" button on the dialog.  If there is, click it and see if the 
details mentions the fault was caused in comctl32.dll.  If so, the 
problem might not be in exw.exe but a bug in Win32Lib.  You might even 
submit the program to this list and see if the Win32Lib guys have seen 
it.  This has solved my problems on more than one occasion.

HTH,

Jonas

new topic     » goto parent     » topic index » view message » categorize

5. RE: EXW Crashes!

I'll try the WinDebug, I think, but all bets are off for the weekend as 
I'm tied up (English phrase, don't take it literally). But thanks for 
everyone's help, especially Jonas for telling me that Win32Lib won't 
work with Safe.e - and I use Win32Lib through and through - and yes it 
is WONDERFUL - as is Judith's IDE!!
Andy.

Al Getz wrote:
> Hi there,
> 
> >> I keep getting errors with EXW trying to access 0xffffffff
> 
> Yes, as others had mentioned you are probably trying to poke a 
> value into memory that your code hadnt yet allocated.
> This is something you have to be very strict with.
> 
> You cant allocate 8 bytes and poke 9:
>     atom addr
>     addr=allocate(8)
>     poke(addr,{1,2,3,4,5,6,7,8,9})--triggers error
>     maybe_call_a_function()
>     free(addr)
> 
> A simple way to troubleshoot this kind of problem is
> to insert a few traces into the program such as:
> 
> 1   with trace
> 2   atom addr
> 3   ?1
> 4   trace(1)
> 5   addr=allocate(8)
> 6   poke(addr,{1,2,3,4,5,6,7,8,9})
> 7   maybe_call_a_function()
> 8   free(addr)
> 9   ?2
> 10  trace(1)
> 
> Now when you run the program, it prints a '1' to the screen
> and then starts tracing at the first trace command.
> Now you hit 'Q' and the program crashes BEFORE printing the
> '2', so you know the error occurred between the place where
> the '1' is being printed (line #3) and where the '2'
> is being printed (line #9).
> Now you run the program again only
> this time after the program prints the '1' and starts tracing,
> instead of hitting 'Q' you hit ENTER and trace through
> it line by line.  When you get to the line that causes the error
> and you hit enter, the program crashes.  Now you know the line
> that caused the error at least.  You then have to start
> examining the code up to that point in the program to find
> what may be responsible for the error.  In this example you would
> have to recognize the fact that there are 9 items being 
> poked into successive locations when only 8 have been allocated.
> 
> Sometimes thats the only way to locate an error.
> 
> Oh you could try WinDebug which is on the Euphoria site download
> area, but the procedure is somewhat the same.
<snip>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu