-What is Gdb?
Gdb is a debugger, it will let us to see what is happening inside a program.
-What programs can be debugged?
GDB supports C, C++, Fortran, Java, assembly, and Modula-2.
Basics of GDB:
-First you need to compile your program with the -ggdb, so this way,
GDB knows the names of your variables and what each line of your program says. If we use gcc for compiling our programs we use:
#gcc -o myprogram myprogram.c -ggdb
-Now we are able to load the file in the gdb:
Once the file is loaded in the GDB we have a lot of possible actions,
we are going to see the ones that i use most.
*list: print lines from a source file. by default it prints 10 lines.
there are various way of printing:
Print lines centered around line number linenum in the current source file.
Print numlines starting from startline in the current source file.
Print lines centered around the beginning of function function.
(gdb)set listsize count
Make the list command display count source lines (unless the list argument explicitly specifies some other number).
*disassem: display memory as machine instructions (disassembly)
show the machine instructions for the function main
*break: Breakpoints are set with the break command, a breakpoint stop the program at the desired point:
(gdb) break linenum
Set a breakpoint at line linenum in the current source file.
The current source file is the last file whose source text was printed.
The breakpoint will stop your program just before it executes any of the code on that line.
(gbd) break *address
Set a breakpoint at address address. You can use this to set breakpoints in parts of your program which do not have debugging information or source files.
After breaking the execution we could:
-Continue the execution: continue or c
-Execute until another line reached: step or s
-Step by machine execution instead of source line: stepi or si
-Execute next line, include any function call: next or n
-Execute next machine instruction: nexti or ni
-Resume the execution at specified line or address: jump line or jump address
*info registers: it shows the values of the registers in that moment of the execution.
*print: It evaluates and prints the value of an expression of the language your program is written in.
(gdb) print $ebp
it shows the address where is ebp
(gdb) print $esp
it shows the address where is esp
*x: examine memory in any of several formats, independently of your program's data types. It shows the content of a variable.
it will show 24 words addresses starting from $esp
it shows the return address
it shows the sorrounding addresses from $ebp
it shows the content at that address
I'm pleased to announce a new version of WFuzz! Wfuzz has been created to facilitate the task in web applications assessments and it...
In the last few weeks everyone has been talking about Shellshock, the vulnerability affecting bash and having security ramifications everyw...
In one of the latest penetration tests we faced a SSH server that was based in Maverick SSHTOOLS. The funny thing is that this server was ...
Hi all, in this brief post i will like to share some new ezines about security that were relased this year, the first one is called Into the...