мета-данные страницы
  •  
Загрузка не удалась. Возможно, проблемы с правами доступа?

Это старая версия документа!


GDB

Рассмотрим код

;Точка входа "_start" на самом деле находится 
;в подключаемом *.o файле стандартной библиотеки Си
;Она передает управление на функцию "main",
;которая должна находиться в нашей программе
	global main
 
;Сегмент кода:
	section .text
 
;Функция main:
	main:
 
	mov	rax,6
	mov	rbx,3
	add	rax,rbx
 
the_end:
	mov	rax,1
	int	0x80
 
	ret

Ассемблируем и собираем программу:

luke@rabusoft ~/asm/example $ nasm -felf64 example.s -g
user@host ~/asm/example $ gcc example.o -o example -g
user@host ~/asm/example $ 

Запускаем gdb:

user@host ~/asm/example $ gdb ./example
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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/luke/asm/example/example...done.
(gdb)