Forum > Suggestions

An alternative way of debugging FPC executables in Windows

(1/2) > >>

440bx:
Hello,

I wasn't sure where to put this information, I hope this is a reasonably good place for it.  It only applies to Windows.

Lazarus does a very nice job using GDB to debug at the source code level.  When having to debug at the assembly level, GDB makes the process painful and clumsy.  It gets worse, close to unusable, when one needs to step through system dlls.

There is a little utility, cv2pdb, which can convert DWARF debug information to PDB information and store it in a separate PDB file.  Then to debug the executable, one only needs to do "devenv exename.exe" and Visual Studio will load the executable, allow source level debugging and full assembly level debugging along with the PDB files it can automatically download when stepping through system dlls.

The process has some limitations.   The debugging experience isn't as full as when the exe was developed in VS itself but, for assembly level debugging, it's way better than GDB.   It should also be possible to use WinDbg for those cases when system information is really needed.

I attached a screenshot of VS2017 debugging a simple GUI app.

the url where to find cv2pdb is https://github.com/rainers/cv2pdb

ASBzone:
Thanks, @440bx

This is very helpful.

440bx:

--- Quote from: ASBzone on August 21, 2018, 11:21:41 pm ---Thanks, @440bx

This is very helpful.

--- End quote ---
I'm pleased you found it useful.

Martin_fr:
While I full agree, the asm debugging in the IDE is missing a lot. Depending on how much asm you need, there is another little trick.

1) In Lazarus 1.9 in the global options you can change between Intel and ATT asm.

2) Use the power button in the asm window. Enlarge the window, so it loads plenty of lines of asm. Then power off. Now you can quickly step as the window caches the asm content. But if you step outside the current view, you need to power on, to load the new lines, then power off again.

Martin_fr:
Btw, it would be nice to keep such info on the wiki. Maybe a page "Alternative Debuggers" should be created.

Navigation

[0] Message Index

[#] Next page

Go to full version