Do not kill the debug window
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Do not kill the debug window
When Testing under debug, you might have to kill your app if 'things go wrong'. however, when you do, PB closes the debug window, which contains the debug info you have sent to help you solve the issue.........
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Do not kill the debug window
You might be able to use the stand-alone debugger instead.
Re: Do not kill the debug window
As Demivec said, use use the stand-alone debugger.
If you still want to use the internal debbugeur it is also possible:
Send debug output in error log window instead of debug output window
Preferences > Debugger > Individual Settings > [X] Display debug output in the error log
Sample crash code:
Log window with error log:
Another solution: use SaveDebugOutput() before dangerous action (but the last action will not be save)
Note for SaveDebugOutput()
- SaveDebugOutput() can be use as many times as you want (replace auto)
- Use little delay(100) before call it and exit prog.
If you still want to use the internal debbugeur it is also possible:
Send debug output in error log window instead of debug output window
Preferences > Debugger > Individual Settings > [X] Display debug output in the error log
Sample crash code:
Code: Select all
Debug "Hello World!"
PokeS(123, "Write to protected memory error here!")
Code: Select all
Waiting for executable to start...
Executable type: Windows - x64 (64bit, Unicode)
Executable started.
[Debug] Hello World!
[ERROR] Debug_Save.pb (Line: 3)
[ERROR] Invalid memory access. (write error at address 123)
The Program was killed.
Note for SaveDebugOutput()
- SaveDebugOutput() can be use as many times as you want (replace auto)
- Use little delay(100) before call it and exit prog.
Re: Do not kill the debug window
It's less hassle just to keep the debug window open. 

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Do not kill the debug window
Thanks for the tips guys.

That's a good work-around, though when there is a lot of info it's a pita to copy. Also, in the worst case, the IDE could be locked-up or crashed, so keeping the debug window up is a life saver.Send debug output in error log window instead of debug output window
I don't like the stand-alone debugger but you are absolutely right, it is currently the best answer, so I had better learn to like it when the unexpected happensYou might be able to use the stand-alone debugger instead.

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Do not kill the debug window
The problem is: I think that debug window is a child window of IDE, so if IDE freezes, crash, or close, debug output will do the same
PB should do as some others IDE: Automatically save debug output in a log file.
Additional advantage: it is possible to use powerful log file analysis tools (ie: have syntax highlighting)


PB should do as some others IDE: Automatically save debug output in a log file.
Additional advantage: it is possible to use powerful log file analysis tools (ie: have syntax highlighting)

Re: Do not kill the debug window
We're not talking about crashes, though. We mean when we purposely kill the running compiled exe. The IDE is still perfectly functional in such a case, and therefore it'd be nice if the Debug window stayed open.Marc56us wrote:debug window is a child window of IDE, so if IDE freezes, crash, or close, debug output will do the same
That introduces slowdown though, if you're compiling from slow media (like I do at times).Marc56us wrote:PB should do as some others IDE: Automatically save debug output in a log file
Regardless, the Debug window stays open when a compiled exe ends normally, so it should also stay open if we choose to kill the exe instead.
Re: Do not kill the debug window
Dude wrote: We're not talking about crashes, though. [...]IdeasVacuum wrote: [...] Also, in the worst case, the IDE could be locked-up or crashed [...]
Yes and no: Unless you work on floppy disk speed writing (in an opened file) is not an issue.Dude wrote: That introduces slowdown though, if you're compiling from slow media (like I do at times).
PB (and the host OS Windows/Linux/Mac) write a lot of files all the time. Write a file will not slow down.
(Anyway, the Debug outputs must be limited to useful information.)
I agree that the debug window should remain open, and I hope so too. But I think that if that is so, maybe it's because this is not possible.

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Do not kill the debug window
It is possible - in fact, it possibly already has it's own thread, so if the IDE fails, the debug window could stay on screen. It could also be launched as a seperate exe.maybe it's because this is not possible
The point is, a debug window is there to help you fix your bugs, so it is important that the only thing that can close it is you.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Do not kill the debug window
Why not just pause the program, do your debugging and then kill it?
The problem with keeping the window open is that then you will have to manually close it every time you kill your debug session to quickly get back to coding. This will get annoying very fast.
The problem with keeping the window open is that then you will have to manually close it every time you kill your debug session to quickly get back to coding. This will get annoying very fast.
quidquid Latine dictum sit altum videtur
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Do not kill the debug window
When that works - i.e, IDE is not locked-up, it is still a pita - you have to keep switching it on and off.Why not just pause the program, do your debugging and then kill it?
A single click to close is no bother at all compared to losing the window when you most need it.The problem with keeping the window open is that then you will have to manually close it every time you kill your debug session
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Do not kill the debug window
Let your customers be the judge of what's annoying.freak wrote:The problem with keeping the window open is that then you will have to manually close it every time you kill your debug session to quickly get back to coding. This will get annoying very fast.

And besides, like I said, it already stays open when an app exits normally, so your argument is invalid.

Re: Do not kill the debug window
Why not the best of both worlds... a checkbox "Don't Close Me" on the top of the Window?
Normally, the debug Window operates exactly as it does now.
When you're having problems, check "Don't Close Me" before you kill the program.
It stays open, and you'll have your information.
Normally, the debug Window operates exactly as it does now.
When you're having problems, check "Don't Close Me" before you kill the program.
It stays open, and you'll have your information.
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Re: Do not kill the debug window
I prefer the debug/variables/memory windows stay open as they do when my app terminates normally.
When there is too much clutter, I run this as a tool(Windows only) to close all non-ide windows.
When there is too much clutter, I run this as a tool(Windows only) to close all non-ide windows.
Code: Select all
EnableExplicit
Structure winINFO
hW.i ; handle
left.i
top.i
right.i
bottom.i
Wd.i
Ht.i
wT$ ; window title
EndStructure
Global NewList wil.winINFO() ; Window Info list
#COLON2$ = "::"
#MB_USERICON = $80 ; Disable system Beep -> MessageRequester("","", | #MB_USERICON)
Macro PB_CP
ProgramFilename() + #COLON2$ + #PB_Compiler_Procedure
EndMacro
Macro MRE(txt, NoBeep=0) ; MessageBox x Error = #MB_ICONHAND | #MB_ICONSTOP | #MB_ICONERROR
MessageRequester(PB_CP, txt, #MB_ICONERROR | (#MB_USERICON * NoBeep))
EndMacro
Procedure RestoreX(DataLabel.i)
CompilerSelect #PB_Compiler_Processor
CompilerCase #PB_Processor_x86
!MOV eax, [p.v_DataLabel] ; instead of -> !MOV eax, [esp+8]
!MOV [PB_DataPointer], eax
CompilerCase #PB_Processor_x64
!MOV rax, [p.v_DataLabel] ; instead of -> !MOV rax, [rsp+64]
!MOV [PB_DataPointer], rax
CompilerDefault
MRE("Error: Unknown Processor.")
CompilerEndSelect
EndProcedure
Procedure.i win_GetInfo_CB(hW.i, lp.i)
Protected$ wt$ = Space(#MAX_PATH)
Protected wp.WINDOWPLACEMENT
If hW
AddElement(wil())
wil()\hW = hW
If IsWindowVisible_(hW)
GetWindowText_(hW, @wt$, #MAX_PATH)
If wt$
wil()\wT$ = wt$
Debug wt$
GetWindowPlacement_(hW, @wp)
wil()\left = wp\rcNormalPosition\left
wil()\top = wp\rcNormalPosition\top
wil()\right = wp\rcNormalPosition\right
wil()\bottom = wp\rcNormalPosition\bottom
wil()\Wd = wil()\right - wil()\left
wil()\Ht = wil()\bottom - wil()\top
EndIf
EndIf
ProcedureReturn 1 ; Continue search
Else
ProcedureReturn 0 ; Done
EndIf
EndProcedure
Procedure.i ct_CloseExtraPBWin(DataLabel.i)
; Create list of existing windows + handles.
; Then cycle through and close them.
; Attempts to close via callback fails for some windows.
; CRITICAL: Delay() cmd after SendMessage_() for settling time.
Protected.i ri
Protected$ winToClose$
ClearList(wil())
EnumWindows_(@win_GetInfo_CB(), 0)
; Cycle through retrieved window list and close PB window types.
ResetList(wil())
ForEach wil()
RestoreX(DataLabel)
Repeat ; Enumerate all PB Window types
Read$ winToClose$
If FindString(wil()\wT$, winToClose$)
;ri = SendMessage_(wil()\hW, #WM_CLOSE, 0, 0) ; This fails in some cases
ri = SendMessage_(wil()\hW, #WM_SYSCOMMAND, #SC_CLOSE, 0)
Delay(50)
If ri = #S_OK
ri = 1
Else
MRE("Unable to close -> " + wil()\wT$)
ri = -1
EndIf
Break
EndIf
Until winToClose$ = "Q"
Next
ClearList(wil())
ProcedureReturn ri
EndProcedure
ct_CloseExtraPBWin(?ds_PBWindowNames)
;-{ DATASECTION
DataSection
ds_PBWindowNames:
Data$ "Asm Debugger", "Data Breakpoints", "Debug Output", "Library Viewer", "Memory Viewer"
Data$ "Procedure Callstack", "Profiler Settings", "Profiler", "Purifier Settings", "Structure Viewer"
Data$ "Variable Viewer", "Watch List", "HTML Help", "Find in files", "Platform SDK Collection"
Data$ "Q" ; Quit
EndDataSection
;-} DATASECTION
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum