

This can be done using a debugger, allowing you to breakdown and step through exactly what the program is doing, as it is doing it. To really understand what the processor is doing, you need to analyse the register values that are used to execute the program. Assembly language is just a representation of the binary or hex values, however, the assembly language version of JMP is easier to remember than the hex value “6E” or the binary value “01101110″. The final right column contains the assembly version of the machine language instructions, as hex is till not really human readable. 01001110110111, objdump will display the binary as hex, to make it a more human readable format. The second column contains the machine language instructions, that the 圆4 processor reads as binary values. The CPU will access the memory address to retrieve the machine language instructions that make up the compiled program. These bytes of memory can be accessed by going to its memory address. Memory can be seen as a row of bytes that all have their own memory address. The hex numbers on the left, starting with 0x4004f4 are the memory addresses.

For this example, 20 lines will be plenty as you can see the end NOPs that are non operation instructions. To dump a sensible amount of lines, you can grep the output to limit the amount of data onscreen. Using objdump you can analyse the binary and how it is interacting with the CPU, in this case within a 圆4 architecture: minh-mint prog # objdump -M intel -D a.out | grep -A20 main.:Ĥ004fc: c7 45 fc 00 00 00 00 mov DWORD PTR ,0x0Ĥ0050f: 83 45 fc 01 add DWORD PTR ,0x1Ĥ00513: 83 7d fc 09 cmp DWORD PTR ,0x9
#Coding a linux disassembler install
Depending on your choice of Linux distro, it may come pre-installed or you may need to manually install it. Objdump is contained in the binutils package in your distro. However, if you only have the compiled binary, what could we do to find out what the program is actually doing? With the use of a tool called objdump Generally, if you have the source code, performing reverse engineering to find out what the program does, can be done by trivially reading through the code. Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Hello, world! Such as gcc: minh-mint prog # gcc hello.c
#Coding a linux disassembler code
The next step is to compile the code using a compiler, The program simply prints out “Hello, World to the screen 10 times. Comments are shown by the use of // which are ignored by the compiler.

This C program will begin with the execution of code at the function main(). I might check that out again sometime when they're done.Minh -mint prog # cat hello.c int main ( ) Googling brought me to Kdbg, but it seems unmaintained, although the page says they're working on porting it to KDE4. After some hours in gdb you can get frustrated, so please excuse my rant above The recent task was to defuse a "code bomb", which I had to disassemble, of course. I do have some knowledge of asm and some coding/calling conventions on this level. We didn't start with disassembling of course.

Maybe I should have elaborated a bit more on what I'm doing in the first place im my original post: this is homework from the semester course "Computer architecture and system programming". It feels like I'm using stuff from the 80's. "display" makes it a bit easier, of course, but it's not really sufficient. I'd just like to be able to concentrate on what the app is doing instead of searching for all the data I need after each and every step. I just find it tedious to work with, because I can't see all my information (registers, stack, stuff stack and registers reference to, etc.) in a nice, formatted way at one glance. Well, as I stated in the OP, I am using gdb.
