Keep debug window open after program ends

Working on new editor enhancements?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Keep debug window open after program ends

Post by jassing »

Is there a way to keep the debug window open after a program ends? or at east, not loose what's in there (so you can use debugger->debugger output to view it?
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Keep debug window open after program ends

Post by Allen »

Hi Jassing,

May be you could try to use the standalone debugger.

Thanks

Allen
User avatar
spikey
Enthusiast
Enthusiast
Posts: 749
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Keep debug window open after program ends

Post by spikey »

There are two options in the IDE preferences under Menu → Preferences → Debugger. The second will preserve the current content of the debugger windows until you manually end the program:
"Stop execution at program start"
"Stop execution before program end"

Or you can put "CallDebugger" at the end of the code.

Or there is SaveDebugOutput which will write the content of the window to a file.
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Keep debug window open after program ends

Post by mk-soft »

Preferences -> Debugger -> Enable: Keep all debugger windows on top
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
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Keep debug window open after program ends

Post by Michael Vogel »

Maybe the following macro could be useful, but then you need to modify all debug lines

Code: Select all

Macro Log(log)
	If OpenFile(666,#PB_Compiler_FilePath+"Debug.log",#PB_File_Append)
		Debug RSet(Str(#PB_Compiler_Line),4)+" | "+log
		WriteStringN(666,FormatDate("%DD.%MM.%YYYY %HH:%II:%SS #",Date())+RSet(Str(#PB_Compiler_Line),5,"0")+":"+LSet(#PB_Compiler_Procedure,10)+"| "+log)
		CloseFile(666)
	EndIf
EndMacro

Procedure Test(a,e)
	For i=a To e
		Log(Str(i))
	Next i
EndProcedure

Log("Start")
test(1,5)
Log("Stop")
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Keep debug window open after program ends

Post by mk-soft »

In my case, the debug window remains open after exiting with my setting.
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
Axolotl
Enthusiast
Enthusiast
Posts: 798
Joined: Wed Dec 31, 2008 3:36 pm

Re: Keep debug window open after program ends

Post by Axolotl »

Michael Vogel wrote: Wed May 01, 2024 1:06 pm Maybe the following macro could be useful, but then you need to modify all debug lines

Code: Select all

Macro Log(log)
...

Please bear in mind that Log() is a Math-Lib command and overlaying existing commands can lead to problems later on. (smartass alert) :oops:
BTW: Sometimes I use OutputDebugString_() while "debugging" release versions.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Keep debug window open after program ends

Post by jassing »

mk-soft wrote: Wed May 01, 2024 3:12 pm In my case, the debug window remains open after exiting with my setting.

If the program crashes, or you stop it - the debug window closes.

Here's an example.
When it crashes, you cannot review the debug output, and it closes.

Code: Select all

For x = 1 To 300
  Debug Random(20000,1)/Random(10,1)
Next
RaiseError(#ERROR_INVALID_ADDRESS)
BarryG
Addict
Addict
Posts: 4122
Joined: Thu Apr 18, 2019 8:17 am

Re: Keep debug window open after program ends

Post by BarryG »

The Debug Output window stays open here with your example, Jassing. It only closes if I click the "Kill Program" button (red X).
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Keep debug window open after program ends

Post by jassing »

BarryG wrote: Fri May 03, 2024 1:17 am The Debug Output window stays open here with your example, Jassing. It only closes if I click the "Kill Program" button (red X).

OK -- Still, would be useful to still have this output available.
BarryG
Addict
Addict
Posts: 4122
Joined: Thu Apr 18, 2019 8:17 am

Re: Keep debug window open after program ends

Post by BarryG »

jassing wrote: Sat May 11, 2024 1:17 amwould be useful to still have this output available
You can send the debug output to the IDE so that it's always available and not lose it. You can copy the output from there, too.

Image
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Keep debug window open after program ends

Post by jassing »

BarryG wrote: Sat May 11, 2024 1:53 am You can send the debug output to the IDE so that it's always available and not lose it. You can copy the output from there, too.
sure, but that's not the same as just leaving the debug window open...
Post Reply