When the debugger crashes...

Working on new editor enhancements?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

When the debugger crashes...

Post by Trond »

When the program crashes with the debugger enabled you must switch
to another source and back before you can "kill" the already crashed
program. This is very inconvenient when trying to isolate the cause of the problem, so I suggest it be changed in future versions of the IDE.
freak
PureBasic Team
PureBasic Team
Posts: 5941
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

What exactly do you mean by crashing ?
Do you mean an error such as "Invalid Memory Access" that is catched
by the debugger, or a downright crash without the debugger noticing ?

In the first case, the "kill" should work immediately. (at least it does here)

If it is the second case, then i'd like to know how to cause that, because
theoretically the debugger should catch any error.
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I mean a downright crash without the debugger noticing. And I can't reproduce it just now, but three days ago I could (very strange).
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I can crash the program without the debugger noticing it in PB 3.94 but that is after the program has started (so the kill command works). The problem a few days ago was that the program crashed before the "the program is running" message appeared in the error log.

To reproduce the problem in 3.94 I simply run the terrain example with the AddMaterialLayer() line not commented out. (In 4.0 the terrain example does not work because LoadTexture() always returns 0.)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I just noticed it's a similar problem with the "restart compiler" item. If the compiler crashes you can't restart it "because it is working".
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

In 4.0 the terrain example does not work because LoadTexture() always returns 0.
I had the same problem with textures as I was converting some PB 3.94 > 4.00 code. Don't know if you already did but you need to specify the texture path with 'Add3DArchive()' to fix this.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Fluid Byte wrote:
In 4.0 the terrain example does not work because LoadTexture() always returns 0.
I had the same problem with textures as I was converting some PB 3.94 > 4.00 code. Don't know if you already did but you need to specify the texture path with 'Add3DArchive()' to fix this.
If you don't know if I already did it you can check whether the terrain example does it.

By the way, here is the source that now (yet again) causes the program to crash without the debugger noticing:

Code: Select all

Procedure A()
EndProcedure
Procedure B()
EndProcedure
Procedure C()
EndProcedure
Procedure D()
EndProcedure
Procedure F()
EndProcedure
Procedure G()
EndProcedure
Procedure H()
EndProcedure
Procedure I()
EndProcedure
Procedure J()
EndProcedure
Procedure K()
EndProcedure
Procedure L()
EndProcedure
Procedure M()
EndProcedure
Procedure N()
EndProcedure
Procedure O()
EndProcedure
Procedure P()
EndProcedure
Procedure Q()
EndProcedure
Procedure R()
EndProcedure
Procedure S()
EndProcedure
Procedure T()
EndProcedure
Procedure U()
EndProcedure
Procedure V()
EndProcedure
Procedure W()
EndProcedure
Procedure X()
EndProcedure
Procedure Y()
EndProcedure
Procedure Z()
EndProcedure

Procedure AA()
EndProcedure
Procedure BB()
EndProcedure
Procedure CC()
EndProcedure
Procedure DD()
EndProcedure
Procedure EE()
EndProcedure
Procedure FF()
EndProcedure
Procedure XXX()
EndProcedure
Procedure XXY()
EndProcedure

Procedure Dummy()
  A()
  B()
  C()
  D()
  F()
  G()
  H()
  I()
  J()
  K()
  L()
  M()
  N()
  O()
  P()
  Q()
  R()
  S()
  T()
  U()
  V()
  W()
  X()
  Y()
  Z()
  AA()
  BB()
  CC()
  DD()
  EE()
  FF()
  XXX()
  ;XXY()
EndProcedure

User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

If you don't know if I already did it you can check whether the terrain example does it.
Well, I thought it was a programm of yours and not an PB 4.0 example. Haven't checked these yet. But why should I test this? You were pointing out that you have problem with 'LoadTexture()' and I tried to provide a solution for this.

However, I tested the example and it works without a flaw. Just like the code you posted. I ran it multiple times, set debugger on/of or restarted compiler. No matter how you do it, it won't crash and always lets you kill the execution on the first try. At least this is the situation for me.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I don't know if it helps to reproduce the problem, but here's my preferences file: http://home.no.net/tsg1zzn/PureBasic.prefs
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

This also makes the program crash and debugger doesn't notice anything:

Code: Select all

res64.q = 1
b32 = 10

res64 = (res64 * b32) % m32
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

When you run this program the process ends but the debugger doesn't notice anything:

Code: Select all

Procedure.l IsPrime(A.q)
EndProcedure

For a = 0 To 7
  z + IsPrime(a)
Next
MessageRequester("", "Finished")
freak
PureBasic Team
PureBasic Team
Posts: 5941
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The first one with the many procedures seems fine here. I cannot find anything wrong with it.

The second one has the problem here as well, i will check that.

The third works here, but it ends with a different stack offset
than it started with, so there is definately something wrong there.
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Yes, that with the many procedures is just strange. Today it works as expected, some days it does not. I can't remember why I didn't get the asm output when it didn't work and compared to the asm output when it works.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Code: Select all

MultiByteToUnicode_(1251, 0)
The program ends, the debugger doesn't notice it, and if you try to run the program again it will use the standalone debugger. To use the integrated debugger again you need to close and re-open the file.
Post Reply