Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing assembly code of functions in emacs

Tags:

emacs

gcc

ide

clang

I'm wondering if there's a package for emacs that would allow me to see the generated assembly code quickly of a function? This should also work with compiler optimizations enabled. What I'd like is to be able to with one command open a new buffer which would contain the assembly code of the current function.

Xcode on OS X does this very nicely, but I'd like to switch back to Linux and emacs on my dev workstation and this is a feature I've learned to like a lot.

like image 409
JT1 Avatar asked Apr 17 '15 09:04

JT1


1 Answers

Try disaster.el:

Disaster screenshot

Disaster lets you press C-c d to see the compiled assembly code for the C/C++ file you're currently editing. It even jumps to and highlights the line of assembly corresponding to the line beneath your cursor.

It works by creating a .o file using make (if you have a Makefile) or the default system compiler. It then runs that file through objdump to generate the human-readable assembly.

disaster.el is available in MELPA.

like image 89
Chris Avatar answered Nov 16 '22 01:11

Chris