Where can I find some documentation on using the Debugger with the -p ProcessID command line switch

As per the title really, where can I find some document that states how to use the -p ProcessID command line switch?

Following what Alexey has put elsewhere on here, but I consistently keep getting a crash error from the debugger.

The problem I have is, sometimes the debugger pops up a window with a list of clarion app processes to select and othertimes I dont, so I’ve getting variable behaviour, and nothing consistent.

Edit.
So this is what I get if I use the cladb.exe:File->File To Debug method → Set a Breakpoint

Corrupt block/Unknown block type freed.  This is probably caused by freeing a static variable or a bad pointer.
Process PID=11672  Image: C:\MyBrowserExtensionUsingClarion\v1\claappname.exe
Thread 1  Handle=0000025C  TID=4284

Stack frame: 0019FD60

Call Stack:
0110DD25
0040116D
010CD8F7
010CD3E1
776BD1AB
776BD131

D32.log

Started 
Heap handle: 07760000
start process 
Debug active process 00002D98
event 00000000
Redirection file :> 
CREATE_PROCESS_DEBUG_EVENT  ! No image name found
g.debug_name 
BaseOfImage                00400000
CREATE_PROCESS_DEBUG_EVENT: process main thread tid=000010BC
thread handle=00000658
ntdll.dll Loaded at: 77650000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00001F3C
thread handle=00000680
CREATE_THREAD_DEBUG_EVENT: tid=000006E8
thread handle=00000684
CREATE_THREAD_DEBUG_EVENT: tid=000004D4
thread handle=00000688
KERNEL32.dll Loaded at: 75E00000
No debug information
KERNELBASE.dll Loaded at: 750F0000
No debug information
SHELL32.dll Loaded at: 769C0000
No debug information
msvcp_win.dll Loaded at: 767C0000
No debug information
ucrtbase.dll Loaded at: 757D0000
No debug information
USER32.dll Loaded at: 76300000
No debug information
win32u.dll Loaded at: 76190000
No debug information
GDI32.dll Loaded at: 750C0000
No debug information
ClaRUN.dll Loaded at: 01000000
WslDb$$NotifyDebugger 010E0C9C
gdi32full.dll Loaded at: 76500000
No debug information
ADVAPI32.dll Loaded at: 758F0000
No debug information
WinTypes.dll Loaded at: 75540000
No debug information
msvcrt.dll Loaded at: 77450000
No debug information
combase.dll Loaded at: 75F00000
No debug information
SECHOST.dll Loaded at: 75A40000
No debug information
RPCRT4.dll Loaded at: 76900000
No debug information
COMDLG32.dll Loaded at: 75980000
No debug information
SHCORE.dll Loaded at: 75C40000
No debug information
COMCTL32.dll Loaded at: 6B5B0000
No debug information
SHLWAPI.dll Loaded at: 753C0000
No debug information
ole32.dll Loaded at: 75AE0000
No debug information
OLEAUT32.dll Loaded at: 75420000
No debug information
MPR.dll Loaded at: 73720000
No debug information
oledlg.dll Loaded at: 6E530000
No debug information
WINSPOOL.DRV Loaded at: 6E570000
No debug information
CFGMGR32.dll Loaded at: 73460000
No debug information
ClaTPS.dll Loaded at: 00B10000
No debug information
IMM32.dll Loaded at: 764D0000
No debug information
MSIMG32.dll Loaded at: 6E520000
No debug information
UxTheme.dll Loaded at: 729D0000
No debug information
TextShaping.dll Loaded at: 6DFA0000
No debug information
MSCTF.dll Loaded at: 77520000
No debug information
AppCore.dll Loaded at: 74880000
No debug information
bcryptPrimitives.dll Loaded at: 75D90000
No debug information
TextInputFramework.dll Loaded at: 6E730000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00000B88
thread handle=00000720
EXIT_THREAD_DEBUG_EVENT: tid=00000B88
Command line :> "C:\Clarion11\bin\Cladb.exe"   -p 11672
Command line :> "C:\MyBrowserExtensionUsingClarion\v1\ClaAppName.exe" 11672
Redirection file :> 
CREATE_PROCESS_DEBUG_EVENT  ! No image name found
g.debug_name C:\MyBrowserExtensionUsingClarion\v1\ClaAppName.exe
BaseOfImage                00400000
CREATE_PROCESS_DEBUG_EVENT: process main thread tid=00002DB0
thread handle=0000112C
ntdll.dll Loaded at: 77650000
No debug information
KERNEL32.dll Loaded at: 75E00000
No debug information
KERNELBASE.dll Loaded at: 750F0000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00002190
thread handle=00000770
SHELL32.dll Loaded at: 769C0000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=000015E0
thread handle=00000D3C
msvcp_win.dll Loaded at: 767C0000
No debug information
ClaRUN.dll Loaded at: 01000000
WslDb$$NotifyDebugger 010E0C9C
ucrtbase.dll Loaded at: 757D0000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=000005E0
thread handle=00000D98
ADVAPI32.dll Loaded at: 758F0000
No debug information
ClaTPS.dll Loaded at: 00580000
No debug information
USER32.dll Loaded at: 76300000
No debug information
msvcrt.dll Loaded at: 77450000
No debug information
UNLOAD_DLL_DEBUG_EVENT: BaseOfDll 00580000
SECHOST.dll Loaded at: 75A40000
No debug information
win32u.dll Loaded at: 76190000
No debug information
GDI32.dll Loaded at: 750C0000
No debug information
RPCRT4.dll Loaded at: 76900000
No debug information
gdi32full.dll Loaded at: 76500000
No debug information
COMDLG32.dll Loaded at: 75980000
No debug information
WinTypes.dll Loaded at: 75540000
No debug information
combase.dll Loaded at: 00B00000
No debug information
combase.dll Loaded at: 75F00000
No debug information
UNLOAD_DLL_DEBUG_EVENT: BaseOfDll 00B00000
COMCTL32.dll Loaded at: 6B5B0000
No debug information
SHCORE.dll Loaded at: 75C40000
No debug information
SHLWAPI.dll Loaded at: 753C0000
No debug information
ole32.dll Loaded at: 75AE0000
No debug information
OLEAUT32.dll Loaded at: 75420000
No debug information
MPR.dll Loaded at: 73720000
No debug information
oledlg.dll Loaded at: 6E530000
No debug information
WINSPOOL.DRV Loaded at: 6E570000
No debug information
CFGMGR32.dll Loaded at: 73460000
No debug information
ClaTPS.dll Loaded at: 00580000
No debug information
IMM32.dll Loaded at: 764D0000
No debug information
MSIMG32.dll Loaded at: 6E520000
No debug information
number of processes: 00000002
list window 000E054C
fill_list window 000E054C
fill_list str_num 00000000
fill_list window 000E054C
fill_list str_num 00000001
CREATE_THREAD_DEBUG_EVENT: tid=00001EEC
thread handle=00000428
CREATE_THREAD_DEBUG_EVENT: tid=00000590
thread handle=000004D8

If I use cladb.exe:Window->Source->Select ClaAppName.clw (where wxeh.cpp is also listed)-> Set Breakpoint.

I dont get the Corrupt block/Unknown block type freed GPF message and the debugger works as expected.

D32.log

Started 
Heap handle: 06D90000
start process 
Debug active process 00001D70
event 00000000
Redirection file :> 
CREATE_PROCESS_DEBUG_EVENT  ! No image name found
g.debug_name 
BaseOfImage                00400000
CREATE_PROCESS_DEBUG_EVENT: process main thread tid=00002634
thread handle=000005E4
ntdll.dll Loaded at: 77650000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00001268
thread handle=00000600
CREATE_THREAD_DEBUG_EVENT: tid=00002EC8
thread handle=00000614
CREATE_THREAD_DEBUG_EVENT: tid=00002918
thread handle=00000618
KERNEL32.dll Loaded at: 75E00000
No debug information
KERNELBASE.dll Loaded at: 750F0000
No debug information
SHELL32.dll Loaded at: 769C0000
No debug information
msvcp_win.dll Loaded at: 767C0000
No debug information
ucrtbase.dll Loaded at: 757D0000
No debug information
ClaRUN.dll Loaded at: 01000000
WslDb$$NotifyDebugger 010E0C9C
USER32.dll Loaded at: 76300000
No debug information
ADVAPI32.dll Loaded at: 758F0000
No debug information
win32u.dll Loaded at: 76190000
No debug information
msvcrt.dll Loaded at: 77450000
No debug information
GDI32.dll Loaded at: 750C0000
No debug information
SECHOST.dll Loaded at: 75A40000
No debug information
gdi32full.dll Loaded at: 76500000
No debug information
WinTypes.dll Loaded at: 75540000
No debug information
RPCRT4.dll Loaded at: 76900000
No debug information
combase.dll Loaded at: 75F00000
No debug information
COMDLG32.dll Loaded at: 75980000
No debug information
COMCTL32.dll Loaded at: 6B5B0000
No debug information
SHCORE.dll Loaded at: 75C40000
No debug information
SHLWAPI.dll Loaded at: 753C0000
No debug information
ole32.dll Loaded at: 75AE0000
No debug information
OLEAUT32.dll Loaded at: 75420000
No debug information
MPR.dll Loaded at: 73720000
No debug information
oledlg.dll Loaded at: 6E530000
No debug information
WINSPOOL.DRV Loaded at: 6E570000
No debug information
CFGMGR32.dll Loaded at: 73460000
No debug information
ClaTPS.dll Loaded at: 00630000
No debug information
IMM32.dll Loaded at: 764D0000
No debug information
MSIMG32.dll Loaded at: 6E520000
No debug information
UxTheme.dll Loaded at: 729D0000
No debug information
TextShaping.dll Loaded at: 6DFA0000
No debug information
MSCTF.dll Loaded at: 77520000
No debug information
AppCore.dll Loaded at: 74880000
No debug information
bcryptPrimitives.dll Loaded at: 75D90000
No debug information
TextInputFramework.dll Loaded at: 6E730000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00000944
thread handle=00000720
EXIT_THREAD_DEBUG_EVENT: tid=00000944
CREATE_THREAD_DEBUG_EVENT: tid=000022F8
thread handle=00000590
CREATE_THREAD_DEBUG_EVENT: tid=00000350
thread handle=0000071C
EXIT_THREAD_DEBUG_EVENT: tid=00002918
EXIT_THREAD_DEBUG_EVENT: tid=00002EC8
EXIT_THREAD_DEBUG_EVENT: tid=00001268
CoreMessaging.dll Loaded at: 6A9E0000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00000950
thread handle=00000C50
CoreUIComponents.dll Loaded at: 6A740000
No debug information
CRYPTBASE.dll Loaded at: 705A0000
No debug information
CREATE_THREAD_DEBUG_EVENT: tid=00001D48
thread handle=00000D40
CREATE_THREAD_DEBUG_EVENT: tid=00002AD4
thread handle=00000748

There is a copy of CLARION110.RED in the C:\MyBrowserExtensionUsingClarion\v1\ folder.

So does anyone know what the correct way is to step into a process and debug it?

TIA

Posterity: GitHub - Intelligent-Silicon/Call-Clarion-Debugger-from-running-App

Not very useful, and still says C6, but there’s \Clarion\bin\ClaDebugger.chm

Theres a C60dbx.chm here but no ClaDebugger.chm, I know I had seen some help-type docs somewhere but couldnt find any. I’ll spin up a win10x32 with ntvdm installed (as its not installed by default) and see what the C60dbx.chm file is.

Surprised there isnt anything in the C11 docs, but at least I can use the debugger reliably with the Attach To Process ID method now.

Russ Eggen Presentation from Aussie Devcon 2006

1 Like

Thanks Jeff.

The Clarion debugger has quite a few command line options. Here is the list:
C60DBX [redirection file] [ INI file ] [-s dllname [-s dllname …]] program.EXE [parameters]
C60DBX [redirection file] [ INI file ] -p PID [-e EventNo]

I think the C60DBX.chm is the file I need to look at then but Win10 doesnt do CHM out the box now, so back to XP to gain access to the file, although I’ll give this a go…

Find the CHM file you want to open, and either double-click it or right-click and select “Open with”. If “Microsoft HTML Help Executable” is available, choose it.

If you don’t see the Microsoft HTML Help Executable option in the “Open with” menu, you might need to locate the file manually. It is usually located at C:\Windows\hh.exe. If the file is missing, you can download and install the “HTML Help Workshop and Documentation” from Microsoft support which will include the necessary hh.exe

Microsoft HTML Help Downloads | Microsoft Learn.

Edit. dead links.

So wayback machine
https://web.archive.org/web/20160417010747/https://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe

Edit. More Hooplas.

Resolution

To view 32-bit Help files with the .hlp file extension in Windows, you will need to download and install WinHlp32.exe from the Microsoft Download Center.

Edit. Still more hooplas
Error opening Help in Windows-based programs: “Feature not included” or “Help not supported” - Microsoft Support

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\WinHelp
AllowProgrammaticMacros Dword 1

Edit. More Hooplas

This ^^^^^^ works like a treat. All the MS webpages, Co-pilot and Gemini… useless!

Didnt learn anything new from the C60DBX.hlp file after all that…

Edit. Log file of the hlp4win11.ps1 in action, if interested.
hlp4win11.ps1-log.txt (71.6 KB)

Updated with a better example and source files.
GitHub - Intelligent-Silicon/Call-Clarion-Debugger-from-running-App

There’s also a -s option, which I’ve used for 20 years but can’t remember why :slight_smile:

It looks like its for debugging a specific filename.dll, havent tested it yet.

But Assert() shows the PID, so simply using Assert to “pseudo breakpoint” or pause the running app, and then manually run the debugger but using Window, Source, select Filename.clw to add some breakpoints is another way to step into a running app reliably

I havent seen this Debugger: Window, Source, select Filename.clw method mentioned anywhere in the docs or online, but it works very reliably, the Debugger: File, File to Debug is flakey at best.

            ! Start the Debugger, attach to this App's ProcessID
            Run('C:\Clarion11\bin\Cladb.exe -p ' & Glo:CurrentPID, 0)
            ! In the Debugger select Window, Source, Filename.clw, Set at least one BreakPoint after the Assert.
            ! When the Assert Message appears, click the Continue button to start Debugging
            Assert(0,'False Pauses the Debugger')

From Call-Clarion-Debugger-from-running-App/Source/ClaDebugProcess.clw at main · Intelligent-Silicon/Call-Clarion-Debugger-from-running-App · GitHub

Now the brain cells are working, ISTR that -s is for when you’re debugging a new process. It’ll make it stop at the first line of executable code, which in the age of class constructors can easily be something that isn’t the first line of code in the the main executable

I’ll have a play with it ( -S ) tomorrow.

Been stuck on why the runtime crashes on exit on my machine with this code.

I thought it was because I was calling CallDebugger[NE] from the Assert(),

Compile('DebugOnly',_DEBUG_) ! Both of these Assert() cause a crash on Program Return because the CallDebugger() & CallDebuggerNE() are called.
    !    Assert(0,'Debugger, Window, Source, select Filename.clw, Breakpoint Example3(), then return here, click Continue button below.' & CallDebugger())
    !DebugOnly  

    Omit('ReleaseOnly',_DEBUG_) ! You cant debug a Release version in reality, but demonstrates how ClaDBne.exe could be called.
    !    Assert(0+CallDebuggerNE(),'Debugger, Window, Source, select Filename.clw, Breakpoint Example3(), then return here, click Continue button below.' )
    !ReleaseOnly

but its also playing up with

IF Glo:SomeCondition = True 
        ! This wont crash on Program Return.
        ! Comment one of these out.
        CallDebugger()  
        !CallDebuggerNE()
        ! You cant format an Assert() message like you can using Message(). <32,10> are ignored.
        Assert(0,'Debugger, Window, Source, select Filename.clw, Breakpoint Example3(), then return here, click Continue button below.')
    End

but now all it does is crash on Program Return, irrespective of how I call the Cladb -p PID, even from a dos window.

Its a C0000005 error on exit so I dont know if this is something in the runtime?

Any ideas?

TIA

Edit. Added ,Proc to the two Debugger calls to eliminate the Function being called as Procedure compiler warning, but still no change, its still crashes on exit.

Rehashed the source code a bit more to make it more like a lesson.

use ClaDbNe -? to get a usage

note there are two debugger with different manifests ClaDB and ClaDBNE
The NE means Not Elevated

I didnt know that existed. I’ll include it in this repo :+1:thanks.