Assembly Language for Beginners

(Jeff_L) #1

1.9. SCANF()


In OllyDbg we can review the process memory map (Alt-M) and we can see that this address is inside the
.dataPE-segment of our program:


Figure 1.16:OllyDbg: process memory map

GCC: x86


The picture in Linux is near the same, with the difference that the uninitialized variables are located in
the_bsssegment. InELF^73 file this segment has the following attributes:


; Segment type: Uninitialized
; Segment permissions: Read/Write


If you, however, initialize the variable with some value e.g. 10, it is to be placed in the_datasegment,
which has the following attributes:


; Segment type: Pure data
; Segment permissions: Read/Write


MSVC: x64


Listing 1.74: MSVC 2012 x64

_DATA SEGMENT
COMM x:DWORD
$SG2924 DB 'Enter X:', 0aH, 00H
$SG2925 DB '%d', 00H
$SG2926 DB 'You entered %d...', 0aH, 00H
_DATA ENDS


(^73) Executable File format widely used in *NIX systems including Linux

Free download pdf