Author Topic: A useful debugging tool  (Read 549 times)

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool
« Reply #15 on: January 10, 2023, 11:56:35 AM »
My mention of 4DOS was only a side comment, but it points out how wrong the people in the "you must only use the latest software" crowd are. Coming up on 30 years old and it still does its job admirably.

But basically it does exactly the same thing as cmd.exe: run batch files. (Well, that's its primary use where assembling and linking our software is concerned. I use Windows Explorer for all my file-system moving-stuff-around work. Only die-hard Unix geeks sit there at the command prompt typing "copy myfile.asm thisfolder" or whatever.)

How many people here don't run batch files from the command line, but instead use some kind of IDE? Apart from JJ's minions who use MasmBasic, I don't think there are too many. Batch files are what I use.

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool
« Reply #16 on: January 10, 2023, 12:00:10 PM »
OK, so here's the latest and greatest. Now with log file writing! Slightly better-looking toolbar buttons (those are all homemade, so give me a break; and I kinda actually like that mid-1990s look.) Use it and let me know whatcha think.

I'll post complete code later if anyone's interested. My first DLL!

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: A useful debugging tool
« Reply #17 on: January 10, 2023, 12:04:29 PM »
How many people here don't run batch files from the command line, but instead use some kind of IDE? Apart from JJ's minions who use MasmBasic, I don't think there are too many. Batch files are what I use.

David,

Many forum members use QEditor, which has a project menu with a decent number of building options.

Btw I don't have "minions". Nobody in this forum has, we are all grown ups. You seem to be really p*ssed off, what's wrong?

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool
« Reply #18 on: January 10, 2023, 12:06:46 PM »
[Foghorn Leghorn voice] It was a, a, it was a joke, son. [/Foghorn Leghorn voice]

So you can assemble and link from Qeditor? Didn't know that. Wonder how many here use that.

OK, just looked at it. So you can open a command window from it: big deal. Handy, yes, but that's exactly the same "workflow" I use (edit file, then go to command window to assemble & link). Not really an IDE.

But it's handy, I'll grant you that. I could add that to my editor. (Which I've been using regularly, btw. Only a few annoying things in it that need fixed.)

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool: New version here
« Reply #19 on: January 24, 2023, 11:34:32 AM »
Here's LogBuddy, all nicely packaged up ready to use. There's even a manual. New features: Now with Message Inclusion and Exclusion! Works nicely.

If you use it let me know how it works for you.

Aaaaargh; updated because I forgot the .def file to make the DLL.

Ideas for future additions:
  • Timing, probably using QueryPerformanceCounter(). Would this be useful to anyone?
  • Inclusion of classes of messages
Inclusions now are handled by a list of messages you want to see, so only those specific messages are logged. There is exclusion by class: cursor messages, window size/move messages, etc. Could make inclusion work the same way ("show me all mouse-related messages").
« Last Edit: January 24, 2023, 02:40:27 PM by NoCforMe »

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10313
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: A useful debugging tool
« Reply #20 on: January 24, 2023, 11:59:32 AM »
David,

> Not really an IDE

QE is not an IDE, its an ASCII editor for writing code. It run a batch file to build apps directly off the menu.

Why a batch file ?
So anyone can edit the build process.  :biggrin:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: A useful debugging tool: New version here
« Reply #21 on: January 24, 2023, 12:02:46 PM »
Here's LogBuddy, all nicely packaged up ready to use

makelogbuddytest.bat is not so useful, because you assume that certain environment variables are set, but strangely enough, simply hitting F6 in RichMasm does the job. Works fine :thumbsup:

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool: New new version
« Reply #22 on: January 25, 2023, 12:08:19 PM »
Just for fun I added a timestamp logging function to LogBuddy:

Code: [Select]
CALL LogBuddyPutTime

You can see the output in the attached picture. It's obviously not good for pinpoint accuracy when analyzing small code fragments, more appropriate for timing code that takes some time, like file I/O or a long computation. Still, it was easy to code up and may be useful to someone.

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: A useful debugging tool
« Reply #23 on: January 25, 2023, 07:53:06 PM »
Works fine :thumbsup:

What I would miss is an option to exclude certain messages, similar to the NoDebMsg option:

Code: [Select]
WndProc proc uses esi edi ebx hWnd, uMsg, wParam:WPARAM, lParam:LPARAM
  inc msgCount
  NoDebMsg CATSTR NoDebMsg, <, WM_ENTERIDLE, WM_SETCURSOR, WM_MOUSEMOVE> ; don't show these messages
  deb 4, "msg", chg:msgCount

Especially WM_SETCURSOR and WM_MOUSEMOVE in your example deserve to be excluded ;-)

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool
« Reply #24 on: January 25, 2023, 08:14:54 PM »
I thought about that, and I could easily add it, but I'm not sure it would be that useful since there would still be a flood of other messages. It does have message exclusion by class (mouse, cursor, non-client, move/size). Maybe I'll just put your suggestion in.

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: A useful debugging tool
« Reply #25 on: January 25, 2023, 08:21:18 PM »
I need the exclusion all the time when I am searching for particular messages. You don't want to see a steady flow of WM_SETCURSOR, WM_MOUSEMOVE, WM_SETICON messages unless you are specifically looking for them :cool:

My defaults:
NoDebMsg equ <WM_MOUSEMOVE, WM_NCHITTEST, WM_SETCURSOR, WM_GETICON, WM_NCMOUSEMOVE, WM_MOVING>

All messages allowed, moving the mouse over a window's client area. Kind of boring, isn't it?
Code: [Select]
msg     2130  04E50B48 02000002 WM_SETCURSOR
msg     2131  00000002 00A603D5 WM_NCMOUSEMOVE
msg     2132  00000000 00A603CD WM_NCHITTEST
msg     2133  04E50B48 02000002 WM_SETCURSOR
msg     2134  00000002 00A603CD WM_NCMOUSEMOVE
msg     2135  00000000 00A603C7 WM_NCHITTEST
msg     2136  04E50B48 02000002 WM_SETCURSOR
msg     2137  00000002 00A603C7 WM_NCMOUSEMOVE
msg     2138  00000000 00A603C1 WM_NCHITTEST
msg     2139  04E50B48 02000002 WM_SETCURSOR
msg     2140  00000002 00A603C1 WM_NCMOUSEMOVE
msg     2141  00000000 00A603BD WM_NCHITTEST
msg     2142  04E50B48 02000002 WM_SETCURSOR
msg     2143  00000002 00A603BD WM_NCMOUSEMOVE
msg     2144  00000000 00A603B9 WM_NCHITTEST
msg     2145  04E50B48 02000002 WM_SETCURSOR
msg     2146  00000002 00A603B9 WM_NCMOUSEMOVE
msg     2147  00000000 00A603B6 WM_NCHITTEST
msg     2148  04E50B48 02000002 WM_SETCURSOR
msg     2149  00000002 00A603B6 WM_NCMOUSEMOVE
msg     2150  00000000 00A603B4 WM_NCHITTEST
msg     2151  04E50B48 02000002 WM_SETCURSOR
msg     2152  00000002 00A603B4 WM_NCMOUSEMOVE
msg     2153  00000000 00A603B2 WM_NCHITTEST
msg     2154  04E50B48 02000002 WM_SETCURSOR
msg     2155  00000002 00A603B2 WM_NCMOUSEMOVE
msg     2156  00000000 00A603B1 WM_NCHITTEST
msg     2157  04E50B48 02000002 WM_SETCURSOR
msg     2158  00000002 00A603B1 WM_NCMOUSEMOVE
msg     2159  00000000 00A603AF WM_NCHITTEST
msg     2160  04E50B48 02000002 WM_SETCURSOR
msg     2161  00000002 00A603AF WM_NCMOUSEMOVE
msg     2162  00000000 00A603AD WM_NCHITTEST
msg     2163  04E50B48 02000002 WM_SETCURSOR
msg     2164  00000002 00A603AD WM_NCMOUSEMOVE
msg     2165  00000000 00A603AB WM_NCHITTEST
msg     2166  04E50B48 02000002 WM_SETCURSOR
msg     2167  00000002 00A603AB WM_NCMOUSEMOVE
msg     2168  00000000 00A603A9 WM_NCHITTEST
msg     2169  04E50B48 02000002 WM_SETCURSOR
msg     2170  00000002 00A603A9 WM_NCMOUSEMOVE
msg     2171  00000000 00A603A6 WM_NCHITTEST
msg     2172  04E50B48 02000002 WM_SETCURSOR
msg     2173  00000002 00A603A6 WM_NCMOUSEMOVE
msg     2174  00000000 00A603A4 WM_NCHITTEST
msg     2175  04E50B48 02000002 WM_SETCURSOR
msg     2176  00000002 00A603A4 WM_NCMOUSEMOVE
msg     2177  00000000 00A603A0 WM_NCHITTEST
msg     2178  04E50B48 02000002 WM_SETCURSOR
msg     2179  00000002 00A603A0 WM_NCMOUSEMOVE
msg     2180  00000000 00A6039C WM_NCHITTEST
msg     2181  04E50B48 02000002 WM_SETCURSOR
msg     2182  00000002 00A6039C WM_NCMOUSEMOVE
msg     2183  00000000 00A60398 WM_NCHITTEST
msg     2184  04E50B48 02000002 WM_SETCURSOR
msg     2185  00000002 00A60398 WM_NCMOUSEMOVE
msg     2186  00000000 00A60394 WM_NCHITTEST
msg     2187  04E50B48 02000002 WM_SETCURSOR
msg     2188  00000002 00A60394 WM_NCMOUSEMOVE
msg     2189  00000000 00A90390 WM_NCHITTEST
msg     2190  04E50B48 02000002 WM_SETCURSOR
msg     2191  00000002 00A90390 WM_NCMOUSEMOVE
msg     2192  00000000 00A9038D WM_NCHITTEST
msg     2193  04E50B48 02000002 WM_SETCURSOR
msg     2194  00000002 00A9038D WM_NCMOUSEMOVE
msg     2195  00000000 00A9038C WM_NCHITTEST
msg     2196  04E50B48 02000002 WM_SETCURSOR
msg     2197  00000002 00A9038C WM_NCMOUSEMOVE
msg     2198  00000000 00A90389 WM_NCHITTEST
msg     2199  04E50B48 02000002 WM_SETCURSOR
msg     2200  00000002 00A90389 WM_NCMOUSEMOVE
msg     2201  00000000 00A90388 WM_NCHITTEST
msg     2202  04E50B48 02000002 WM_SETCURSOR
msg     2203  00000002 00A90388 WM_NCMOUSEMOVE
msg     2204  00000000 00A90386 WM_NCHITTEST
msg     2205  04E50B48 02000002 WM_SETCURSOR
msg     2206  00000002 00A90386 WM_NCMOUSEMOVE
msg     2207  00000000 00A90385 WM_NCHITTEST
msg     2208  04E50B48 02000002 WM_SETCURSOR
msg     2209  00000002 00A90385 WM_NCMOUSEMOVE
msg     2210  00000000 00A90384 WM_NCHITTEST
msg     2211  04E50B48 02000002 WM_SETCURSOR
msg     2212  00000002 00A90384 WM_NCMOUSEMOVE
msg     2213  00000000 00A90382 WM_NCHITTEST
msg     2214  04E50B48 02000002 WM_SETCURSOR
msg     2215  00000002 00A90382 WM_NCMOUSEMOVE
msg     2216  00000000 00A90380 WM_NCHITTEST
msg     2217  04E50B48 02000002 WM_SETCURSOR
msg     2218  00000002 00A90380 WM_NCMOUSEMOVE
msg     2219  00000000 00A9037F WM_NCHITTEST
msg     2220  04E50B48 02000002 WM_SETCURSOR
msg     2221  00000002 00A9037F WM_NCMOUSEMOVE
msg     2222  00000000 00A9037B WM_NCHITTEST
msg     2223  04E50B48 02000002 WM_SETCURSOR
msg     2224  00000002 00A9037B WM_NCMOUSEMOVE
msg     2225  00000000 00A90376 WM_NCHITTEST
msg     2226  04E50B48 02000002 WM_SETCURSOR
msg     2227  00000002 00A90376 WM_NCMOUSEMOVE
msg     2228  00000000 00A90371 WM_NCHITTEST
msg     2229  04E50B48 02000002 WM_SETCURSOR
msg     2230  00000002 00A90371 WM_NCMOUSEMOVE
msg     2231  00000000 00A9036A WM_NCHITTEST
msg     2232  04E50B48 02000002 WM_SETCURSOR
msg     2233  00000002 00A9036A WM_NCMOUSEMOVE
msg     2234  00000000 00000000 WM_GETICON
msg     2235  00000000 00A80364 WM_NCHITTEST
msg     2236  04E50B48 02000002 WM_SETCURSOR
msg     2237  00000002 00A80364 WM_NCMOUSEMOVE
msg     2238  00000000 00A80364 WM_NCHITTEST
msg     2239  04E50B48 02000002 WM_SETCURSOR
msg     2240  00000002 00A80364 WM_NCMOUSEMOVE
msg     2241  00000000 00A8035F WM_NCHITTEST
msg     2242  04E50B48 02000002 WM_SETCURSOR
msg     2243  00000002 00A8035F WM_NCMOUSEMOVE
msg     2244  00000000 00A80359 WM_NCHITTEST
msg     2245  04E50B48 02000002 WM_SETCURSOR
msg     2246  00000002 00A80359 WM_NCMOUSEMOVE
msg     2247  00000000 00A80355 WM_NCHITTEST
msg     2248  04E50B48 02000002 WM_SETCURSOR
msg     2249  00000002 00A80355 WM_NCMOUSEMOVE
msg     2250  00000000 00A70352 WM_NCHITTEST
msg     2251  04E50B48 02000002 WM_SETCURSOR
msg     2252  00000002 00A70352 WM_NCMOUSEMOVE
msg     2253  00000000 00A7034F WM_NCHITTEST
msg     2254  04E50B48 02000002 WM_SETCURSOR
msg     2255  00000002 00A7034F WM_NCMOUSEMOVE
msg     2256  00000000 00A7034E WM_NCHITTEST
msg     2257  04E50B48 02000002 WM_SETCURSOR
msg     2258  00000002 00A7034E WM_NCMOUSEMOVE
msg     2259  00000000 00A7034D WM_NCHITTEST
msg     2260  04E50B48 02000002 WM_SETCURSOR
msg     2261  00000002 00A7034D WM_NCMOUSEMOVE
msg     2262  00000000 00A7034C WM_NCHITTEST
msg     2263  04E50B48 02000002 WM_SETCURSOR
msg     2264  00000002 00A7034C WM_NCMOUSEMOVE
msg     2265  00000000 00A7034A WM_NCHITTEST
msg     2266  04E50B48 02000002 WM_SETCURSOR
msg     2267  00000002 00A7034A WM_NCMOUSEMOVE
msg     2268  00000000 00A70347 WM_NCHITTEST
msg     2269  04E50B48 02000002 WM_SETCURSOR
msg     2270  00000002 00A70347 WM_NCMOUSEMOVE
msg     2271  00000000 00A70345 WM_NCHITTEST
msg     2272  04E50B48 02000002 WM_SETCURSOR
msg     2273  00000002 00A70345 WM_NCMOUSEMOVE
msg     2274  00000000 00A70344 WM_NCHITTEST
msg     2275  04E50B48 02000002 WM_SETCURSOR
msg     2276  00000002 00A70344 WM_NCMOUSEMOVE
msg     2277  00000000 00A70343 WM_NCHITTEST
msg     2278  04E50B48 02000002 WM_SETCURSOR
msg     2279  00000002 00A70343 WM_NCMOUSEMOVE
msg     2280  00000000 00A70341 WM_NCHITTEST
msg     2281  04E50B48 02000002 WM_SETCURSOR
msg     2282  00000002 00A70341 WM_NCMOUSEMOVE
msg     2283  00000000 00A7033F WM_NCHITTEST
msg     2284  04E50B48 02000002 WM_SETCURSOR
msg     2285  00000002 00A7033F WM_NCMOUSEMOVE
msg     2286  00000000 00A7033D WM_NCHITTEST
msg     2287  04E50B48 02000002 WM_SETCURSOR
msg     2288  00000002 00A7033D WM_NCMOUSEMOVE
msg     2289  00000000 00A7033B WM_NCHITTEST
msg     2290  04E50B48 02000002 WM_SETCURSOR
msg     2291  00000002 00A7033B WM_NCMOUSEMOVE
msg     2292  00000000 00A7033A WM_NCHITTEST
msg     2293  04E50B48 02000002 WM_SETCURSOR
msg     2294  00000002 00A7033A WM_NCMOUSEMOVE
msg     2295  00000000 00A70338 WM_NCHITTEST
msg     2296  04E50B48 02000002 WM_SETCURSOR
msg     2297  00000002 00A70338 WM_NCMOUSEMOVE
msg     2298  00000000 00A70336 WM_NCHITTEST
msg     2299  04E50B48 02000002 WM_SETCURSOR
msg     2300  00000002 00A70336 WM_NCMOUSEMOVE
msg     2301  00000000 00A70333 WM_NCHITTEST
msg     2302  04E50B48 02000002 WM_SETCURSOR
msg     2303  00000002 00A70333 WM_NCMOUSEMOVE
msg     2304  00000000 00A70332 WM_NCHITTEST
msg     2305  04E50B48 02000002 WM_SETCURSOR
msg     2306  00000002 00A70332 WM_NCMOUSEMOVE
msg     2307  00000000 00A70331 WM_NCHITTEST
msg     2308  04E50B48 02000002 WM_SETCURSOR
msg     2309  00000002 00A70331 WM_NCMOUSEMOVE
msg     2310  00000000 00A70330 WM_NCHITTEST
msg     2311  04E50B48 02000002 WM_SETCURSOR
msg     2312  00000002 00A70330 WM_NCMOUSEMOVE
msg     2313  00000000 00000000 WM_GETICON
msg     2314  00000000 00A70330 WM_NCHITTEST
msg     2315  04E50B48 02000002 WM_SETCURSOR
msg     2316  00000002 00A70330 WM_NCMOUSEMOVE
msg     2317  00000000 00A7032E WM_NCHITTEST
msg     2318  04E50B48 02000002 WM_SETCURSOR
msg     2319  00000002 00A7032E WM_NCMOUSEMOVE
msg     2320  00000000 00A7032B WM_NCHITTEST
msg     2321  04E50B48 02000002 WM_SETCURSOR
msg     2322  00000002 00A7032B WM_NCMOUSEMOVE
msg     2323  00000000 00A70327 WM_NCHITTEST
msg     2324  04E50B48 02000002 WM_SETCURSOR
msg     2325  00000002 00A70327 WM_NCMOUSEMOVE
msg     2326  00000000 00A70323 WM_NCHITTEST
msg     2327  04E50B48 02000002 WM_SETCURSOR
msg     2328  00000002 00A70323 WM_NCMOUSEMOVE
msg     2329  00000000 00A70320 WM_NCHITTEST
msg     2330  04E50B48 02000002 WM_SETCURSOR
msg     2331  00000002 00A70320 WM_NCMOUSEMOVE
msg     2332  00000000 00A7031C WM_NCHITTEST
msg     2333  04E50B48 02000002 WM_SETCURSOR
msg     2334  00000002 00A7031C WM_NCMOUSEMOVE
msg     2335  00000000 00A70319 WM_NCHITTEST
msg     2336  04E50B48 02000002 WM_SETCURSOR
msg     2337  00000002 00A70319 WM_NCMOUSEMOVE
msg     2338  00000000 00A70317 WM_NCHITTEST
msg     2339  04E50B48 02000002 WM_SETCURSOR
msg     2340  00000002 00A70317 WM_NCMOUSEMOVE
msg     2341  00000000 00A70315 WM_NCHITTEST
msg     2342  04E50B48 02000002 WM_SETCURSOR
msg     2343  00000002 00A70315 WM_NCMOUSEMOVE
msg     2344  00000000 00A50311 WM_NCHITTEST
msg     2345  04E50B48 02000002 WM_SETCURSOR
msg     2346  00000002 00A50311 WM_NCMOUSEMOVE
msg     2347  00000000 00A3030D WM_NCHITTEST
msg     2348  04E50B48 02000002 WM_SETCURSOR
msg     2349  00000002 00A3030D WM_NCMOUSEMOVE
msg     2350  00000000 009F0308 WM_NCHITTEST
msg     2351  04E50B48 02000002 WM_SETCURSOR
msg     2352  00000002 009F0308 WM_NCMOUSEMOVE
msg     2353  00000000 009B0303 WM_NCHITTEST
msg     2354  04E50B48 0200000C WM_SETCURSOR
msg     2355  0000000C 009B0303 WM_NCMOUSEMOVE
msg     2356  00000000 00990301 WM_NCHITTEST
msg     2357  04E50B48 0200000C WM_SETCURSOR
msg     2358  0000000C 00990301 WM_NCMOUSEMOVE
msg     2359  00000000 009602FD WM_NCHITTEST

daydreamer

  • Member
  • *****
  • Posts: 2305
  • my kind of REAL10 Blonde
Re: A useful debugging tool
« Reply #26 on: January 25, 2023, 09:39:17 PM »
but it points out how wrong the people in the "you must only use the latest software"
There are 32bit old software that lately been released free, also saves money not getting latest 64bit version which still uses 90%+ older functions
I use mostly qeditor which have masm32 "wizards",masm32 oriented help files in help menu,and uses. Bat file when building project, which is very useful when some want to edit to use their favourite assembler or newer. Ml version, or newer linker version
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: A useful debugging tool
« Reply #27 on: January 26, 2023, 12:58:44 PM »
My defaults:
NoDebMsg equ <WM_MOUSEMOVE, WM_NCHITTEST, WM_SETCURSOR, WM_GETICON, WM_NCMOUSEMOVE, WM_MOVING>

It's done. Your wish is my command. Besides, it was incredibly easy to code up. (I'm waiting to post the new version in case other changes need to be made.)
Code: [Select]
; Prepare list of messages we want to exclude:
MOV msgList, -2
MOV msgList + 4, WM_MOUSEMOVE
MOV msgList + 8, WM_NCHITTEST
MOV msgList + 12, WM_SETCURSOR
MOV msgList + 16, WM_SETCURSOR
MOV msgList + 20, WM_GETICON
MOV msgList + 24, WM_NCMOUSEMOVE
MOV msgList + 28, WM_MOVING
MOV msgList + 32, 0 ;List terminator

INVOKE LogBuddyLogMsg, uMsg, wParam, lParam, ADDR msgList

I'm sure you can cook up a macro to make it even easier to use, probably all on one line.

Question: For the elasped-time logging function, should I display the elapsed time in mS? in addition to the raw hex of QueryPerformanceCounter(), or in place of it? How much resolution would be realistic and useful here?