1. RE: Invalid Page Fault and Safe.e
Chris Bensler wrote:
> Your testing your program with safe.e through Judith's IDE. Obviously
> the IDE contains some memory access flaws, but that's not all that
> unnatural. Maybe Judith should address those.
>
> The IDE doesn't run your prograam until you execute it, which you can't
> do with safe.e
> If you want to test your program ,you need to run it seperate from the
>
> IDE.
>
> Chris
Chris,
I'm not running the program through Judith's IDE, unless you mean that
I'm running it from the same folder that the IDE is in. I have them in
a folder called "Judith's IDE Version 0.10.3". This is not just a
problem with my program either. I've tried it with a lot of the
programs that come with Win32Lib and get the same results. Sometimes
the message is a little different, but it's usually exactly the same as
far as I can see. I've tried this on 3 different computers and got the
same results on all 3. Maybe I'm just missing something really basic
that I'm supposed to do before (or while) running a program with Safe.e.
I don't know.
Thanks for the response.
Virtual B
>
> Virtual B wrote:
> > Hi All,
> >
> > I seem to be having a problem similar to Kat's invalid page fault
> > problem. I have had a few of these from time to time with a Win32
> > program I've been working on, and figured I'd try Safe.e also. Here's
> > the message I get:
> >
> > C:\EUPHORIA\Judith's IDE Version 0.10.3\machine.e:181 in procedure die()
> >
> > >
> > attempt to divide by 0
> > msg = {66'B',65'A',68'D',32' ',80'P',79'O',75'K',69'E',32' ',65'A',
> > 68'D',68'D',82'R',69'E',83'S',83'S',33'!',33'!',33'!',33'!',32' ',55'7',
> > 54'6',55'7',53'5',57'9',49'1',54'6',32' ',40'(',35'#',48'0',48'0',55'7',
> > 53'5',50'2',48'0',48'0',67'C',41')'}
> > t = 5.29
> > i = 7
> >
> > ... called from C:\EUPHORIA\Judith's IDE Version 0.10.3\machine.e:278 in
> >
> >
> > procedure poke()
> > a = 7675916
> > v =
> > {99'c',111'o',109'm',109'm',100'd',108'l',103'g',95'_',70'F',105'i',
> > 110'n',100'd',82'R',101'e',112'p',108'l',97'a',99'c',101'e'}
> > len = 19
> >
> > ... called from C:\EUPHORIA\Judith's IDE Version 0.10.3\tk_mem.e:97 in
> > function acquire_mem()
> > pOwner = 0
> > pData =
> > {99'c',111'o',109'm',109'm',100'd',108'l',103'g',95'_',70'F',
> > 105'i',110'n',100'd',82'R',101'e',112'p',108'l',97'a',99'c',101'e'}
> > at = 7675916
> >
> > ... called from C:\EUPHORIA\Judith's IDE Version 0.10.3\Win32Lib.ew:681
> >
> >
> > I don't see a reference to my program anywhere in here. And what
> > confuses me even more is that I get the same error when running ANY
> > windows program with Safe.e. I'm a newbie, so I'm probably missing
> > something really obvious, but could someone give me a clue here? I'm
> > really stumped.
> >
> > Thanks,
> >
> > Virtual B
<snip>
2. RE: Invalid Page Fault and Safe.e
Robert Craig wrote:
> Virtual B. writes:
> > This is not just a problem with my program either.
> > I've tried it with a lot of the programs that come with
> > Win32Lib and get the same results.
>
> Safe.e can't be used with Win32Lib.
>
> A long time ago safe.e was able to catch subtle
> memory corruption bugs in Win32Lib-based programs,
> but that is no longer possible for two reasons:
>
> 1. The implementors of Win32Lib decided not to use
> Euphoria's allocate() and free() but instead to
> develop their own heap routines using direct calls to
> WIN32 API routines. The reasons for this are not clear to me.
>
> 2. There are some places where Win32Lib
> picks up the address of a block of memory from a call
> to a C routine. They would have to call register_block()
> and unregister_block() in safe.e to track this.
> I'm not sure how much work would be involved here.
> I've recently added a switch to safe.e that allows you
> to not bother registering any external blocks, in exchange for
> having a much weaker check on memory. In this case it
> only checks the "gutter" areas just before and just after
> each allocated block for corruption. Addresses that are
> far removed from any allocated block would be
> assumed safe. However this requires that
> allocate() and free() actually be used (point #1).
>
> Regards,
> Rob Craig
> Rapid Deployment Software
> http://www.RapidEuphoria.com
>
>
>
Thanks Rob. I still don't know what's causing the occasional invalid
page fault, but at least I know I can't use Safe.e with Win32Lib apps.
I thought something was seriously wrong on this end. I appreciate the
input.
Virtual B
3. RE: Invalid Page Fault and Safe.e
Wolf wrote:
> Yer' right, you can't use safe.e with win32lib, ver.0.55.1.
> It uses it's own 'stack' of memory which EU is unaware of.
>
> This is really Derek's territory, but you could try the following patch
> to
> tk_mem.e. It should work OK for small programs, at least.
>
> ...in function myAllocate(), you have the following lines, after which
> you
> have to add the next !!
>
> lAddr=c_func(xHeapAlloc,{pHeap,HEAP_ZERO_MEMORY,pSize})
> if lAddr !=0 then
> register_block(lAddr,16000) --- ADD THIS LINE !!
>
>
>
> All this does is register the initial win32lib 'stack' with EU, so
> machine.e is aware of this memory block. However, if this stack 'grows'
> larger than 16k., you'll have the same problem again.
Wolf,
Thanks for the input. I'll probably try that if I have problems with a
smaller program, but this one's too big.
Thanks again.
Virtual B
>
>