The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Klod on February 04, 2007, 11:27:02 PM

Title: Masm and ML help files
Post by: Klod on February 04, 2007, 11:27:02 PM
I  have googled for some time, but don't seem to have any luck.
I would like to experiment with different compiler and linker settings. The only documentation I have come across is for Masm 6.1 at the webster site.
Is there a newer help file available?
thaks
Title: Re: Masm and ML help files
Post by: Tedd on February 05, 2007, 12:31:07 PM
There is a help file included with the masm32 package - "masm32.hlp" - open the index and find topics 'ML Options' and 'LINK Options'

Also the same as executing "ml /?" and "link /?" (with those two programs on the current path, or in the current directory.)
Title: Re: Masm and ML help files
Post by: Klod on February 12, 2007, 04:52:31 AM
Thanks Tedd for the repley

For the last few days, I tryed several different settings, but did not get the results I hoped for.
I would like to include code symbols into my code, which then would be displayed in the debugger.
I use Radasm and Ollydbg.
Any suggestions?
Title: Re: Masm and ML help files
Post by: Tedd on February 12, 2007, 01:16:53 PM
add "/Zi" for ml
and "/DEBUG /DEBUGTYPE:CV" for link

that will give you symbols and line number information (in ollydbg at least.)
Title: Re: Masm and ML help files
Post by: Klod on February 17, 2007, 09:09:22 PM
Thanks Tedd for the repley
I havetried these options and it works.
Why would the assembler put in all thes INT3 ops ::)

If I run without debug info, these ops are not in the PE?
Title: Re: Masm and ML help files
Post by: Tedd on February 19, 2007, 12:39:07 PM
Mostly it will be down to alignment of functions and/or data - it's just padding. The extra symbol info, will cause things to be aligned differently, so they will be inserted to re-align it.
"INT 3" is a software breakpoint, so that's why it's used (instead of simply "nop"), so if it gets executed that passes control to the debugger (this is what's used when you set a breakpoint in the debugger.)
Title: Re: Masm and ML help files
Post by: Klod on February 23, 2007, 04:39:33 PM
Thanks for your reply, Tedd
In my quest to learn to program in asm, I concentrated more on using masm constructs and macros etc. This is probably OK for a beginner, but my programs have increased in both size and complexity. To my shame Ihave to confess, that I do not recognize my code in the debugger, or only with a great deal of guessing. :dazzled:
I tried multiple switches and combinations thereof on the command line, but the generated files are so large that I loose my way.

is it possible to this with ml?
Wndproc.c-- 16: switch(LOWORD(wParam))
00402533 8B4510                   mov     eax,[ebp+10h]
00402536 25FFFF0000               and     eax,0FFFFh
0040253B 2D12270000               sub     eax,2712h
00402540 83F804                   cmp     eax,4
00402543 0F879B000000             ja      4025E4h
00402549 FF2485B82B4000           jmp     dword ptr [402BB8h+eax*4]

This would be very helpful.
00402543 0F879B000000             ja      4025E4h      ;CustomMessages my symbol
Is it possible to create symbols that would change  obove code to ja CustomMessages instead of 4025E ?
Or how about a reference to the source lin?

One last question on ollyDbg, is it possible to step over dll calls?
Title: Re: Masm and ML help files
Post by: realcr on February 23, 2007, 06:03:43 PM
Hey klod.

You can place something like this in your code:
nop
nop
nop
nop
and then search in ollydbg for these nops. it might be a good way to find your code.

realcr.
Title: Re: Masm and ML help files
Post by: Klod on February 23, 2007, 09:45:02 PM
Thanks for your reply realcr,
You mean like inserting 4 nopes in source and then look for 4 nopes in debugger?
This sounds simple enough, will try
Title: Re: Masm and ML help files
Post by: farrier on February 24, 2007, 06:45:56 AM
Klod,

I do the following when debugging with Ollydbg:

On the line prior to the code I want to debug, I place an
int 3
instruction.  Open your program in Ollydbg, then press Run.  This will generate a software/debug interrupt, and Ollydbg will stop at that instruction and allow you to single step through the following code.

Remember to remove or comment out the int 3 instruction when you finish using Ollydbg, or you will still be generating a software interrupt when you don't want one!

To jump over API calls, use the Step Over button (F8).

hth,

farrier
Title: Re: Masm and ML help files
Post by: Klod on February 24, 2007, 11:30:07 PM
Thanks to all of you who contributed.
Your help and suggestions are appriciated
klod