Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Gdb and dbx guide

Gdb and dbx guide

Ratings: (0)|Views: 415|Likes:
Published by abhijeetnayak
Gdb and dbx guide
Gdb and dbx guide

More info:

Published by: abhijeetnayak on Feb 07, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF or read online from Scribd
See more
See less


A quick primer for those who prefer to use a command line debugger. Both gbd (Linux) and dbx (Unix)are very similar. In addition, NuMega technologies produces a very powerful Ring 0 command linedebugger for Micro$oft Windows named SoftICE (retail $1000). SoftICE has the same 'feel' as gbd anddbx. Skills learned in one should quickly port to the others.
The Program
The program used in this document is listed below. It prints the familiar "Hello World" from the nicefolks at Bell Labs. In addition, we'll snoop around while the target is under gdb to see if we can find anygoodies.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; compile:;;;; nasm hello.asm -f elf -o hello.o -g;;;; -f: elf file format;; -o: output file name;; -g: debugging information;;;; gcc hello.o -o hello -g;;;; -o: output file name;; -g: debugging information;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL mainEXTERN printf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; defines;;LF equ 0xA ;; 10 decimalCR equ 0xD ;; 13 decimalTERM equ 0 ;; NULLSYSTEM_EXIT equ 1 ;; exit to OSSYSTEM_SVC equ 0x80 ;; int 80h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; global read/write data;;SECTION .dataszHello db 'Hello World', LF, CR, TERM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; code;;SECTION .textmain:push dword szHello ;; push address of szHellocall printf ;; call c runtimeadd esp, 4 ;; adjust stackmov eax, SYSTEM_EXIT ;; prepare for exitint SYSTEM_SVC ;; good bye;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Compile the Program
Compile and run the program as shown below.Works as expected.
Lets see what's going on under the hood…Fire up gdb. Execute 'gdb hello' as shown below:At this point, gdb has our program loaded. Time to look at help:The 'classes' of interest will be breakpoints, data, and stack.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->