Hello all,

I just want to share with you the problems (and the solution) that I had with MASM32 debugging.

OS: W2000
Debugger: SoftIce 4.0.5
MASM: v6 sp2

I have a dll that I want to debug with SoftIce.
How I did it:
First: If you open the SoftIce symbol loader you can find the following in the help:
"MASM 6.11
To generate Codeview debug information:
Assemble with /Zi /COFF.
Use Microsoft's 32-bit LINK.EXE to link with /DEBUG /DEBUGTYPE:CV /PDB:NONE."
I have added the map file generation option to both compiler and linker options.
(It seems that /PDB:NONE is very important.)
But with these options set there was the following linker error: "CVPACK error"
The reason for this error is that CVPACK.EXE was not present in my masm32\bin folder.
(Hutch, do you have any idea??)
So I copied the CVPACK.EXE and mspdb60.dll from the MSVC6 installation and my dll linked OK.
Next I converted the produced .map file to .sym file.
That is all...SoftIce symbol loader recognized the debug information.

I hope this is usefull for someone :)

Greetings
Maldoror
Posted on 2001-11-16 05:58:03 by Maldoror
Maldoror,

CVPACK is only found in commercial software produced by Microsoft so what you have done is probably the only way it can be done, copy it from your own version of Visual C.

I have not used Soft Ice for years because it is basically no use to me so I am not much help there. The MASM32.HLP file has an article on using Soft Ice that was contributed by "Lucifer". I don't have any further information on it and probably the best people to get it from would be NuMega.

Regards,

hutch@movsd.com
Posted on 2001-11-17 05:15:45 by hutch--
Hutch,

reading your message I asked myself "How does he debug his programs???".

What symbolic debugger do you use? WinDBG ( M$ ) - like me, or is there another good tool we all should take a look at?

Or do you simply avoid making mistakes? :grin:

CU
Posted on 2001-11-17 05:34:15 by PiT
Have a look at OllyDbg, it's a very decent debugger. I tried using
WinDbg, but I found it very slow and clumsy.
Posted on 2001-11-17 09:01:51 by f0dder
Speaking as an oldschooler, I don't feel the need for even HAVING a symbolic debugger... For me , the first phase of debugging begins with the program outlined roughly on paper, making most conflicts obvious, and laying out the logic. Next, I begin to flesh out a win32 skeleton with the logic, and generally at this point I include a vast number of MessageBoxes, generally one or two at the return of every uncertain api call. All you need is a visual feedback of some form, even console output will do. If you rely on a symbolic debugger, then your code must stink to high heaven !!! Learn to do some things for yourself, it will pay off in terms of optimizations that become obvious only in retrospect.
Posted on 2001-11-18 01:36:21 by Homer
PiT,

=============================================
Or do you simply avoid making mistakes?:grin:
=============================================

Mistakes, what are they ? :tongue:

Seriously, a long time ago I used to use the DOS codeview that came with masm and it was a very good tool to use if you could be bothered messing around with it but over time the only really reliable way I know of that will tell you what a value is at any given point in a program is to code it into your program and display it in whatever way you like. Console, MessageBox, Title bar, Status Bar or anywhere else you could display a value in the format you require.

Soft Ice is basically a driver debugger and thats what NuMega sell it as but it is less than a joy to use and I find the technique I use is a lot faster to debug with. Debuggers are "nice" toys if you haver the time to play with them but more often than not, you end up spending more time playing with them than writing reliable code.

Of the current batch, Ollydebug seems to be the most agreeable to use.

Regards,

hutch@movsd.com
Posted on 2001-11-18 02:08:32 by hutch--

If you rely on a symbolic debugger, then your code must stink to high heaven!!!

Or perhaps I'm dealing with more complicated stuff than you? Or perhaps
I feel it's too much of a hassle to add messageboxes after each and every
API that can fail, when I can just trace the code and see when it fails?
Now, due to the fact that I sit down and plan applications that are a little
more than small tools, the amount of debugging I have to do is limited.
And for minor problems, I use messageboxes. But there have been situations
where I wouldn't have liked not having a debugger... and when I toy around
with software protection (writing it myself), a ring0 debugger certainly helps.

Hutch, if you have an easy way of getting this output (ie, something that
doesn't require too much additional coding), it's a good method for a lot
of problems. I do prefer poking around in a debugger though, because it
lets me modify registers and try additional code paths, etc.

As for softice... it takes some time getting used to, I guess. I actually
enjoy it's interface :). It doesn't get in my way with too much cuddlyhuggy
GUI friendliness, and it is pretty damn powerful. Most people don't need
"that extra power" though, and they'll do fine with a ring3 debugger.
Posted on 2001-11-18 08:49:50 by f0dder
A debugger is just another tool. The message box approach is a drag. When you do discover a problem, you've got to add the code, reassemble, hope you've put the code in the right place to find the bug, fix it, remove the code, reassemble again, see if it still works...

I like Windbg myself. I haven't been able to get symbols to work with assembly on 9x (PDB version problems), but you don't really need it. I keep the listing in one window and the disassembly listing in another. Sync them up, and I know what's going on.

:)
Posted on 2001-11-18 09:55:04 by S/390
f0dder,

The approach I use for outputting data is based on a small DLL that does the display in a number of formats, DEC, HEX, BIN in a number of places that are called by a macro.

A different approach that I like as well is the new watch window that Vladimir Kim has written for MASM32.

I have always been saddled with copious quantities of parsing and a debugger is useless here, I generally need to know what is happening at stages through an algorithm and it involves string content at required locations in the algo and often multiple counters to see what they are doing under different conditions.

When I have had something particularly unusual to debug, I have tended to write small specialised DLLs for the display so that I can track the conditions I am after.

I really see SICE as a device driver debugger where many other methods will not display the data you are after but in application coding I see it as more of a hinderance than a help as it is designed for another purpose.

Regards,

hutch@movsd.com
Posted on 2001-11-18 16:17:48 by hutch--
If anyone is interested, I found a version of LINK that uses MSPDB41.DLL, the same one that WINDBG for 9x uses. It comes with VB5 (had to dust that one off). :grin:

I'm going to play with it this weekend. If I have any luck, I'll report back.

:)
Posted on 2001-11-21 11:11:40 by S/390
Posted on 2001-11-28 04:07:30 by Maldoror
f0dder,

I have used Ollydbg, and agree it is a VERY nice program. I just DLed the latest version, I believe it is version 105a. Haven't unpacked it yet, but will post my impressions after I play with it a bit. I find from time to time, some OLD dos debuggers come in handy from time to time. Why my Small 6 GIG is so low on space. One good thing I just did, after searching the web for a while, was make a bootable CD, it boots into dos, but would be great as a Emegency boot, should Windows crash BIGTIME. One reason I explored the Boot CD was I DID crash BIGTIME, and had to REINSTALL Win98. Once was enough. After finding all the info, the burn process was SIMPLE. Info on how to "Customize" the boot image required to copy from a floppy. AND, using ONLY FREE tools to creat the floppy. even though the Burner prog, that allows a boot does NOT have ANY info on creating a boot floppy. I am thinking of posting some links to sites that have the info, and links to the progs. It would be nice to see a COMP of info found here, and other places, done up as an ISO, for DL. If it was Tutors, like Iczlion's and many others found throughout the web, that would be a great reference. Thinking also about the idea of a DOS text reader, then if you DROP windows, you can still access info you might need to FIX the problem. Might fit on an emergency boot CD, and save a LOT of time, and stress. also a nice reference for calling up while programming. Nothing like data when you need it. Ramble over, switching to screen saver mode.

Have a great NEW YEAR,

Anunitu

A P.S. Some of the Newer burner progs allow you to burn a HD image to CD, and can reinstall that Image to the HD. or another HD. If your drive dies, no LONG install to get up and running. This will prob give Mr. Gates Ulcers...:)
Posted on 2001-12-27 18:24:28 by Anunitu
Hi All,

I have SoftIce 4.01 for WinNT/2000, WDeb386/Rterm and Wdeb98/Rterm98 from 98SDK. They do not start. Is there an elementary introduction for newbies?

I work in TASM5, in Win2000, use TD32 but I would like to use MASM32 instead. I debug a Win32 EXE application (= NOT driver, NOT DLL). I can work on single PC or on two PC's connected with null-modem or USB-USB cable.

Thanks in advance

I.Kossey
Posted on 2002-01-05 15:51:03 by Ivan Kossey
Unfortunately, softice has a lot of trouble under win2k. Even if you
don't get the various graphics driver problems, you'll need a dual-computer
setup to be able to trace ddraw/d3d code (my computer simply hardboots
if I try to pop up softice while in ddraw/d3d :-( .)

The microsoft windbg might be a better choice, but it also requires
two computer to do kernel debugging. It can work on a single computer
but then you'll only be able to trace ring3 code. The debugger seems
pretty slow and cumbersome... but perhaps that's just something
you have to get used to.

You should definitely have a look at OllyDbg. Or perhaps GoBug
at http://www.jorgon.freeserve.co.uk/ .
Posted on 2002-01-05 16:05:53 by f0dder
Hallo fOdder,

Thank You for Your reply.

I don't know where to download OllyDbg. Is it free?

Regards I.Kossey



Unfortunately, softice has a lot of trouble under win2k. Even if you
don't get the various graphics driver problems, you'll need a dual-computer
setup to be able to trace ddraw/d3d code (my computer simply hardboots
if I try to pop up softice while in ddraw/d3d :-( .)

The microsoft windbg might be a better choice, but it also requires
two computer to do kernel debugging. It can work on a single computer
but then you'll only be able to trace ring3 code. The debugger seems
pretty slow and cumbersome... but perhaps that's just something
you have to get used to.

You should definitely have a look at OllyDbg. Or perhaps GoBug
at http://www.jorgon.freeserve.co.uk/ .
Posted on 2002-01-06 10:36:12 by Ivan Kossey
Hi Ivan

You can find it there :

http://home.t-online.de/home/Ollydbg/

And yup, OllyDBG is free. ;)
Posted on 2002-01-06 10:40:02 by JCP
Hi Readiosys,

Thank You, I downloaded the OllyDbg. It is nice for programs without source code. But I need a symbolic debugger because my program contains more than 10000 lines.

By the way when debugging a TASM32 program linked with full debug info the OllyDbg creates a file with extension UDD which contains probably all symbolic names in the program. Therefore may be is not very difficult transform it to a symbolic debugger. I wrote this to the Author Oleg Yuschuk.

My Microsoft debuggers downloaded two years ago do not work in Win2000. What newer (perhaps Microsoft) debugger can I download to debug MASM32 EXE programs either on single PC, either on two PCs connected with null-modem or USB-USB cable?

May be for some people is interesting why I want to work in MASM32. I work years successfully with TASM32 - TD32. Now I have a problem which I cannot resolve in TASM. Namely I have a procedure with many local variables (entire length 2054H) which I must call recursively. By the second recursive call the program fails executing the ENTER command at begin of the procedure (write at address <end of the new stack piece for local variables>). Allocate more stack (which probably can be defined only in a .DEF file) does not solve the problem. MASM32 doesn't use the ENTER command.

Regards Ivan
Posted on 2002-01-07 14:03:29 by Ivan Kossey
Win2k debugger... you can get microsoft windbg somewhere at the
microsoft site. It can work in single-computer mode as ring3 debugger,
or dual-computer as a kernel debugger. I find it somewhat cumbersome
and slow, but tastes differ :).
Posted on 2002-01-07 19:21:39 by f0dder
Funny, no body mention VC++ integrated debugger. works fine with masm, and understands its structs and types.
Posted on 2002-01-08 09:09:01 by dxantos
Posted on 2002-01-10 01:13:25 by Asm_Freak