GithubHelp home page GithubHelp logo

disaster's Introduction

disaster.el โ€“ Disassemble C/C++ code under cursor in Emacs

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.

Installation

Make sure to place disaster.el somewhere in the load-path and add the following lines to your .emacs file to enable the C-c d shortcut to invoke disaster:

(add-to-list 'load-path "/PATH/TO/DISASTER")
(require 'disaster)
(define-key c-mode-base-map (kbd "C-c d") 'disaster)

Function Documentation

(disaster &optional FILE LINE)

Shows assembly code for current line of C/C++ file.

Here's the logic path it follows:

  • Is there a Makefile in this directory? Run make bufname.o.
  • Or is there a Makefile in a parent directory? Run make -C .. bufname.o.
  • Or is this a C file? Run cc -g -O3 -c -o bufname.o bufname.c
  • Or is this a C++ file? Run c++ -g -O3 -c -o bufname.o bufname.c
  • If build failed, display errors in compile-mode.
  • Run objdump inside a new window while maintaining focus.
  • Jump to line matching current line.

If FILE and LINE are not specified, the current editing location is used.

(disaster-find-project-root &optional LOOKS FILE)

General-purpose Heuristic to detect bottom directory of project.

This works by scanning parent directories of FILE (using disaster--find-parent-dirs) for certain types of files like a .git/ directory or a Makefile (which is less preferred).

The canonical structure of LOOKS is a list of lists of files to look for in each parent directory where sublists are ordered from highest precedence to lowest. However you may specify LOOKS as a single string or a list of strings for your convenience. If LOOKS is not specified, it'll default to disaster-project-root-files.


Markdown README file generated by make-readme-markdown.el

disaster's People

Contributors

jart avatar hying-caritas avatar evmar avatar maskray 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.