News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

About the printf() in the assembly language

Started by cjylg, November 21, 2008, 10:05:31 AM

Previous topic - Next topic

dsouza123

An alternative that allows extra options, instead of   

inkey "press any key"

use

inkey  addr szPressKey

and in the .data section

szPressKey  db  13,10,"Press any key",0

the 13,10,  is for cr lf (carriage return  linefeed)
so the message will show up on a separate line.
the ,0 to make sure the string is zero terminated.

In general adding ,13,10 at the end of a string
or embedded in it as in  "text",13,10,"more text",13,10 eventually ending the string with ,0
enables placing the text on different lines.

m7xtuf

Thank you all  !!!

The "inkey" is working fine !!!

Thank you !!!

m7xtuf

Hi guys,

   I have another question ... I am using the MASM32 editor.  Is there any debugger available so that I can debug/trace the code.  Also it will be nice if there is a memory view and register view ... any recommendation ???

   Thanx once again !!!


m7xtuf

Thanx ... and any other recommendation for another debugger ???

dedndave

well - visual studio has one, i think
other than that, i believe most guys in here use Olly's
i am kind of a newbie to 32-bit, so i didn't question their choice - lol
thing about Olly is, it allows plug-ins that let you extend its' capability

jj2007

Olly is clearly the best (although some masochists here seem to use WinDbg, too ::))

I have configured my own IDE (RichMasm, comes with MasmBasic) so that if code contains an active (i.e. non-commented) int 3, the IDE launches Olly directly after successful assembly. And I use that feature an awful lot - Olly is essential for understanding low level code.

Olly's only weak point is symbols. Certain older versions work with simple code, but I have not been able to convince the newer 2.0 version to use my own variable and proc names. Unfortunately the developer (Oleh Yuschuk) seems to have lost interest, or has too much other work, who knows - the last version dates March 23, 2009.

japheth


BogdanOntanu

Quote from: jj2007 on November 19, 2009, 12:59:23 AM
...
Olly's only weak point is symbols. Certain older versions work with simple code, but I have not been able to convince the newer 2.0 version to use my own variable and proc names. Unfortunately the developer (Oleh Yuschuk) seems to have lost interest, or has too much other work, who knows - the last version dates March 23, 2009.

That is because you insist to use Ollydbg version 2.0 and this version is work in progress... not finished and with no support for symbols... yet.

Alternatively if you will use the "old" but fully functional Ollydbg version 1.10 then it will show you variables and procedure names (build your exe with debug info)
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

jj2007

Quote from: BogdanOntanu on November 19, 2009, 07:54:37 AM
Alternatively if you will use the "old" but fully functional Ollydbg version 1.10 then it will show you variables and procedure names (build your exe with debug info)

Bogdan, is there a way to convince Olly 1.10 that XMM registers should be shown as integers?

BogdanOntanu

#25
Quote from: jj2007 on November 19, 2009, 08:15:33 AM
...
Bogdan, is there a way to convince Olly 1.10 that XMM registers should be shown as integers?

NO. AFAIK normal Olly 1.10 will not even show XMM registers or SSE2+ instructions.... but there might be an plugin or a patched Olly 1.0 available :D

However for debugging and testing "normal" code  OllyDbg v1.10 is a good tool.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

jj2007

Quote from: japheth on November 19, 2009, 03:47:28 AM

True assembly coders use CDB or NTSD.

Yep, it's a jewel :bg

Microsoft (R) Windows User-Mode Debugger  Version 5.1.2600.0
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: bin2byte.exe
Loaded dbghelp extension DLL
The call to LoadLibrary(ext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded exts extension DLL
The call to LoadLibrary(uext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded ntsdexts extension DLL
Symbol search path is: *** Invalid *** : Verify _NT_SYMBOL_PATH setting
Executable search path is:
ModLoad: 00400000 00406000   image00400000
ModLoad: 7c900000 7c9b0000   ntdll.dll
ModLoad: 7c800000 7c8f4000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 77c10000 77c68000   C:\WINDOWS\system32\msvcrt.dll
Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffd5000 ecx=00000004 edx=00000010 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdl
l.dll -
ntdll!DbgBreakPoint:
7c901230 cc               int     3
0:000>

GregL

Quote from: jjOlly is clearly the best (although some masochists here seem to use WinDbg, too Roll Eyes)

OllyDbg is good, but Visual Studio is the best, it does 64-bit too. VC++ Express Edition or the VS 2010 beta work great.

I never cared for WinDbg either.

CDB or NTSD ... Ugh!

japheth

Quote from: jj2007 on November 19, 2009, 11:21:51 AM
Microsoft (R) Windows User-Mode Debugger  Version 5.1.2600.0
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: bin2byte.exe
Loaded dbghelp extension DLL
The call to LoadLibrary(ext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded exts extension DLL
The call to LoadLibrary(uext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded ntsdexts extension DLL

Perhaps you should consider to download a more recent version of the debugging tools for Windows. AFAICS your dbgeng.dll is the original XP one, dated 2001. This will also remove the error messages which you're experiencing.

Quote
Symbol search path is: *** Invalid *** : Verify _NT_SYMBOL_PATH setting
Executable search path is:
ModLoad: 00400000 00406000   image00400000
ModLoad: 7c900000 7c9b0000   ntdll.dll
ModLoad: 7c800000 7c8f4000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 77c10000 77c68000   C:\WINDOWS\system32\msvcrt.dll
Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffd5000 ecx=00000004 edx=00000010 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdl
l.dll -
ntdll!DbgBreakPoint:
7c901230 cc               int     3
0:000>

Ok. you're now - almost - at the very beginning of the debugging process. With a "g main" or "g start" or whatever your entry is you'll get to your program. IMO a pretty good and solid design. Btw, CDB has no problems displaying XMM registers in any format you want.  :8)