2

I'm trying to learn some assembly and have been using gdb to disassemble simple programs. But I can't seem to find the answer to this question (maybe I don't know what to look for): what exactly do those addresses at the beginning of each line refer to? Are they the locations of the instructions within the program on the hard drive? or RAM?

For example:

   0x080483dc <+0>: push   %ebp
   0x080483dd <+1>: mov    %esp,%ebp
   0x080483df <+3>: sub    $0x10,%esp
nonex
  • 233
  • 3
  • 12

1 Answers1

2

Those indicate address of the instructions in the program's memory space.

In modern OS, every program is allocated a separate memory space in RAM when it is executed. The binary is then memory-mapped into that memory space. So every instruction has an address and it is reflected by gdb for you to know where you are in the program.

The following picture illustrate how the memory space for a process looks like: enter image description here

You can read this article to understand more about program and address space

Krypton
  • 3,337
  • 5
  • 32
  • 52
  • What determines where the addresses start from (I'm assuming that it's obviously not 0x0)? And do they change every time you run the program? – nonex Sep 18 '14 at 05:59
  • The starting address of the virtual address space is always 0 and the ending is 4GB. However, the starting address of the executable in the address space (TEXT segment) maybe not, it is determined by the OS implementation. – Krypton Sep 18 '14 at 07:04