c - how to know the address of each variable, pointer, function, return address of function, etc. in a program? -


i want check address of each , every line of code. want know:

  • when variables created, @ address?
  • when functions created, @ address?
  • when function returns, @ address?

what i'm trying here? using dumpbin information.

what expect?

fun main add:0x0000 var int add:0x2496 var int j add:0x249a 

a proper proper explanation highly appreciated.

the information request not normal part of object code produced compiler , cannot obtained inspection of object code or normal symbol table. of information not retained in object code because purpose of object code make possible execute program. information origin of object code (such source lines created or names used in source) unnecessary execution.

much of information request provided in debugging information generated compiler when request it, done -g switch gcc. debugging information created in variety of formats, depending on compiler. possible inspect information or various tools, mean doing depend in detail on compiler , other tools using. doing useful require deal of study debugging information format.

much of debugging information can examined through use of debugger, such gdb. debugger typically provides tools examine instructions associated particular line of source code or find memory allocated object.

however, map source code instructions or data in executing program can extremely complicated. lines of source code may have vanished because optimizer deduced unnecessary. simple example, consider:

b = a; c = b; d = c; 

i expect there no instruction anywhere in program c = b;; expect compiler moves a directly d without intervening steps, , might optimize way, depending on circumstances.

additionally, while handling object, such 1 of variables, compiler might generate code has object in register , not @ in memory , has object in memory. possible object partly in memory , partly in register. (e.g., if object composed of 8 bytes , compiler runs out of register space needed work, might store 4 bytes of object stack, use newly available register briefly, , reload bytes stack.)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -