Debugger quitting unexpectedly with C backend?

Just starting out? Need help? Post your questions and find answers here.
Joubarbe
Enthusiast
Enthusiast
Posts: 710
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Debugger quitting unexpectedly with C backend?

Post by Joubarbe »

So it took me a while to switch to C backend because the debugger seems to quit unexpectedly most of the time when the program crashes. For instance:

Code: Select all

DeclareModule bar
  Declare ShowFoo()
EndDeclareModule

Module bar
  Global NewList *foo()
  
  Procedure ShowFoo()
    FirstElement(*foo())
    Debug *foo()
  EndProcedure
EndModule

OpenWindow(0, 0, 0, 1920, 1080, "", #PB_Window_BorderLess)

Repeat
  bar::ShowFoo()  
Until WaitWindowEvent() = #PB_Event_CloseWindow
This crashes in a correct way, ie. line 11 is highlighted and the compiler tells me that the list doesn't have a current element. Fine. However, I have basically the same code architecture in my game (of course a lot more complex), and every time, the debugger quits unexpectedly and doesn't catch the error (same error as in this example – and it does catch the error with ASM backend).

I'd like to know if other people experience the same thing? I've tried with / without optimised code, it doesn't change anything.
Last edited by Joubarbe on Tue Jul 22, 2025 8:34 am, edited 1 time in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Debugger quitting unexpectedly with C backend?

Post by mk-soft »

PB Help FirstElement ...
Returns the address of the data in the first list element if successful and zero if there if there are no elements in the list.

Code: Select all

Module bar
  Global NewList *foo()
  
  Procedure ShowFoo()
    If FirstElement(*foo())
      Debug *foo()
    EndIf
    
  EndProcedure
EndModule
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
infratec
Always Here
Always Here
Posts: 7613
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Debugger quitting unexpectedly with C backend?

Post by infratec »

@mk-soft

It was not the point to find a fix for the code :wink:
User avatar
idle
Always Here
Always Here
Posts: 5888
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Debugger quitting unexpectedly with C backend?

Post by idle »

Yes I notice that the debugger crashes out mostly with threaded code bugs.
Could it be an issue caused at linking by LTO?
Joubarbe
Enthusiast
Enthusiast
Posts: 710
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Debugger quitting unexpectedly with C backend?

Post by Joubarbe »

For information, I do not use threads.
Post Reply