• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

zTrace 1.52 (debugging utility)

Started by Patrice Terrier, April 05, 2009, 12:43:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

#15
I did it already!
(because i had the same need myself)

But i didn't took the time to post it there, i shall do it tomorrow  8)

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Eddy Van Esch

Splendid, Patrice !!   :)
Thanks a lot !

Kind regards
Eddy

Eddy Van Esch

Thanks again, Patrice !!

Kind regards
Eddy

Dominique Bodin

Thank's a lot patrice.

I see the .bas isn't updated in the first post .zip . . .
Thank's

Dominique

Patrice Terrier

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com


Eddy Van Esch

If you would like to change the background color of zTrace, make following changes to the source code:

Add the line in bold:
Quote#COMPILE DLL "zTrace.dll"

#INCLUDE "WIN32API.INC"

'----------------------------------------------------------------------
%zTrace_BGColor = &HF4F4F4   'zTrace background color
%dwStyle = %WS_VISIBLE OR %WS_CLIPSIBLINGS OR %WS_CLIPCHILDREN OR %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME


Change the bold parts:

QuoteCASE %WM_CREATE
        'A good place to initiate things, declare variables,
        'create controls and read/set settings from a file, etc.
        '-------------------------------------------------------
         IF gnBackBrush = 0 THEN gnBackBrush = CREATESOLIDBRUSH(%zTrace_BGColor)

Quote
    CASE %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT, %WM_CTLCOLORLISTBOX, %WM_CTLCOLORSTATIC
         ' wParam is handle of control's display context (hDC)
         ' lParam is handle of control
         '------------------------------------------------------
         IF lParam = GetDlgItem(hWnd, %ID_LISTBOX) THEN
            CALL SETBKCOLOR(wParam, %zTrace_BGColor)

PS. I had to use 'quote' instead of 'code' or I could not indicate the text in bold in the code ...  :)

Kind regards
Eddy


Jim Padgett

Is ztrace thread safe ?
If I ztrace "This is from thread " & Str$(x)  from my thread function
Where x = long value passed to the thread from my  main app ..

Will this simply add another line to ztrace output from the ztrace window previously opened ?


Patrice Terrier

QuoteWill this simply add another line to ztrace output from the ztrace window previously opened ?

Yes.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Paul Elliott

Patrice,

Thanks for making such a useful tool.

But I'm having problems with zTrace.
I'm running a PB CC v6.03 program that is reading all the normal INC files and capturing certain
bits of information. Normally I'm displaying on the console the files as I process them but needed
a bit more information under strange conditions ( strange based on what I'm trying to capture ...
but the file processing is fairly straight open /read/close ).
So I saw your tool and thought that it would solve my problem and it does the first time thru.
But if when my program is about to end and it's waiting for me to press a key, I change to your
window and select create zDebug output then you create the file. But if I run my program again
and your program reads the ztrace.cfg and sets the option to create the zDebug output, after
22 lines to your window my program aborts and Windows wants to run it thru a debugger.
On the run that works there are around 2000 lines in the zdebug.txt file.

I'm running on Windows XP SP3 with MS Security Essentials  with 2 gig ram.
My program has no Threads but does have up to 10 files open at once but they are all closed
before my program ends.

Do you know of anything that could be causing this?
Any suggestions for debugging it? Can I copy most of the source ( minus the DLL main stuff ) into
my CC program and compile it?


Paul Elliott

Well, it wouldn't compile including most of the zTrace.bas ( minus the dll main ).
Had to add a few variables that were missed ( am using #DIM ALL ). Even tried compiling
the DLL with Win v10.03. Then trying adding #Option AnsiAPI. No difference.

I'll just delete the CFG file and set the Debug save option right before ending my program.
It is a great tool and works for what I need ( with just a little tweaking ).


Paul Elliott

Could there be some conflict/overlap between CreateFile and PB's FreeFile?

In the main program, I keep opening (based on PB's FreeFile ) & closing files ( eventually but
they may be nested up to 9 levels ). the next file opened is based on PB's FreeFile.

The names will not overlap between main program & DLL but is it possible the underlaying
handle may get closed? If this is possible, how would I check for a handle already in use?


Paul Elliott

Ended up putting a temporary change in ( until the real reason is found ).

Zeroed gbDebug when it is read in.
In zTrace check for "*CLOSE*IT*" as input string and do the checks/loop to output the
whole listbox and close the file. I send this after I have closed all my files and right before
waiting for a keystroke.

Seems to work for me. Now on to fixing more of my other problems.


John Aadnoey

Thanks for this program. I'm definatlly gonna use it as I develop my own software.

Great stuff, Patrice