Page 1 of 1

Debugger quitting unexpectedly with C backend?

Posted: Mon Jul 21, 2025 10:47 am
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.

Re: Debugger quitting unexpectedly with C backend?

Posted: Mon Jul 21, 2025 10:48 pm
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

Re: Debugger quitting unexpectedly with C backend?

Posted: Tue Jul 22, 2025 6:58 am
by infratec
@mk-soft

It was not the point to find a fix for the code :wink:

Re: Debugger quitting unexpectedly with C backend?

Posted: Tue Jul 22, 2025 9:42 am
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?

Re: Debugger quitting unexpectedly with C backend?

Posted: Wed Jul 23, 2025 8:44 am
by Joubarbe
For information, I do not use threads.