Git Product home page Git Product logo

assembly's Introduction

Assembly

Follow along as we learn Assembly Language (ASM). Including x86, x86_64 architecture, machine language, JVM bytecode, and fundamentals of hardware.

Gather Tools (Ubuntu 12.04 64-bit)

# gcc and the linux source are all we need
sudo apt-get install linux-headers build-essential
# NOTICE: nasm, yasm, and third-party disassemblers are a waste of time

# ...but a good debugger like Evan's Debugger (EDB) is INVALUABLE! :)
sudo apt-get update && apt-get install libqt4-dev libboost1.48-all-dev subversion
svn checkout http://edb-debugger.googlecode.com/svn/trunk/ /tmp/edb-debugger
cd /tmp/edb-debugger
qmake
make
sudo make install
mkdir ~/.edb
sudo edb
# Once the program is launched, go Directories > Preferences, and set:
# Symbol Directory: ~/.edb
# Plugin Directory: /lib64/edb
# Session Directory: ~/.edb
# save and exit

Assemble

Assuming you're following the example source in this repo.

# NOTICE: no git clone step; type it yourself--its fun!
gcc -c hello.s # i prefer the .asm extension but gcc requires this

Link

ld -o hello hello.o

Execute

./hello # should output "Hello, world!"

Disassemble and Inspect

readelf -a hello
objdump -ds hello
nm hello
echo $(( 0xfffffffffffffffe )) # convert hex to 64-bit signed integer -2

Debug Interactively

The easy way:

edb
# File > Open
# select your compiled binary

The hard way:

gdb hello
info files
disassemble 0x00000000004000b0,0x00000000004000cd
x/s 0x6000d0
break *0x00000000004000c4
run
continue
quit

Reference

assembly's People

Contributors

mikesmullin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.