News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

MASM32 debug of Windows exe

Started by bullcriss, May 10, 2019, 06:37:01 PM

Previous topic - Next topic

fearless

In x64dbg, the right click context menu option "Open Source File" only shows if you right click on a line that has line comments, and the pdb with symbols and line info is successfully loaded and the source files for the target being debugged can be located (otherwise this menu option doesn't show). Choosing "Open Source File" will then switch to the Source View tab and display the corresponding line in the source code, allowing you to set breakpoints from the Source View tab and/or step through the source code where applicable, typically F8 to step over functions etc.

aw27

Quote from: fearless on May 11, 2019, 02:16:18 AM
In x64dbg, the right click context menu option "Open Source File" only shows if you right click on a line that has line comments, and the pdb with symbols and line info is successfully loaded and the source files for the target being debugged can be located (otherwise this menu option doesn't show). Choosing "Open Source File" will then switch to the Source View tab and display the corresponding line in the source code, allowing you to set breakpoints from the Source View tab and/or step through the source code where applicable, typically F8 to step over functions etc.
I can't make it work even after placing comment. I downloaded the latest version.
All right, I saw it,  :badgrin:  It is big context menu, we need a good eye to spot the load source file option.

TimoVJL

#17
As it comes with a copy of msdia140.dll , use it without register ;)

EDIT: a missing info, add to manifest:  <file name="msdia140.dll">
    <comClass clsid="{E6756135-1E65-4D17-8576-610761398C3C}" />
  </file>
May the source be with you

bullcriss

It works, finally!

Since I made several tests with various versions of assembler and linker, I didn't know anymore how I got it fixed, so I had to reinstall everything from scratch, then I proceeding trying again the several options that you all told me here.

FInally I installed Masm 6.14 again but the Linker 5.14 that comes with it builds PDB files wrong.   I had to install the patch mentioned by fearless.
THEN all worked, that's what fixed it.

I am beginning to use x64dbg and it's a great tool, thank you fearless.
Practical question about it: is there a way to get the source code view to follow the execution, as you go on step by step?  If the execution jumps elsewhere outside the portion on the screen, it gets out of sight.

Thank you everyone again!

fearless

Quote from: bullcriss on May 11, 2019, 10:39:25 PM
is there a way to get the source code view to follow the execution, as you go on step by step?  If the execution jumps elsewhere outside the portion on the screen, it gets out of sight.

You can step whilst in the source code view with F8, however if you go into an api function or execution jumps to another module, then the source code view typically wont have any visibility of that.


If your in the cpu view and debugging/stepping etc, you can always right click on a line that has a source code line number in the comments, and select open source file again, which should switch to the appropriate line no in the source view tab.

Its a useful feature, but has some inherent limitations due to the nature of syncing disassembly to source code line numbers from the pdb - if there is a pdb (like common windows dll's and you have setup a symbol store and downloaded the pdbs - (right click on a dll in symbols tab, download module)) you will get debug symbols for functions, variable names etc, but no source.

jj2007

Quote from: fearless on May 12, 2019, 02:37:52 AMIts a useful feature, but has some inherent limitations due to the nature of syncing disassembly to source code line numbers

Especially true for macros, of course: It is practically impossible to follow a source when it enters a macro.