Feeds:
Posts
Comments

Archive for January 26th, 2019

In this tutorial, I will show you how to set break point in gnu debugger. Break point is very useful if you want to observe a program flow, find a debug in it or do reverse engineering. Using break point, you can jump the process directly to your pointer and stop the program.

Let’s find out more details about it.
Type the code below and save it to ‘break.asm’.

1 section .text
2 global _start
3 _start:
4
5 mov eax,1111
6 mov ebx,2222
7 mov ecx,3333
8 mov edx,4444
9
10 push eax
11 push ebx
12 push ecx
13 push edx
14
15
16 mov eax,1
17 int 0x80

To activate the debugging function, you have to add option -gstabs when you compile a program.

$ nasm -f elf32 -gstabs break.asm -o break.o && ld break.o -o break
$

Run with program with gdb (gnu debugger).

$ gdb ./break
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/darklinux/break...done.
(gdb)

Display the source code from line 1 to 20.

(gdb) list 1,20
1 section .text
2 global _start
3 _start:
4
5 mov eax,1111
6 mov ebx,2222
7 mov ecx,3333
8 mov edx,4444
9
10 push eax
11 push ebx
12 push ecx
13 push edx
14
15
16 mov eax,1
17 int 0x80
(gdb)

(more…)

Read Full Post »