---
title: "x86汇编入门"
author: "splayx"
date: "2014-12-01T19:51:08Z"
tags: []
categories: ["编程语言"]
slug: "x86"
draft: false
lastmod: "2014-12-01T19:51:08Z"
id: 2162310
url: "https://splayx.iteye.com/blog/2162310"
---

```
section .data
msg:
db "hello, world", 10
len equ $-msg

section .text
global main
main:
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80

mov ebx, 0
mov eax, 1
int 0x80
```

 

nasm -f elf64 -l hello.lst -g -O0 hello.asm

gcc -g -O0 -o hello hello.o

 

gdb:

set language asm

set disassembly-flavor intel

define nd

nexti

disassemble

end

 

gdb hello

source gdb