GithubHelp home page GithubHelp logo

lcamilo15 / bugs.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeboxide/bugs.js

0.0 1.0 0.0 341 KB

A NodeJS library providing a unified interface to common debuggers (gdb, jdb, pdb, ...)

JavaScript 94.79% Java 1.82% Makefile 0.33% C 0.95% Python 0.64% Ruby 1.47%

bugs.js's Introduction

bugs.js

A NodeJS library providing a unified interface to common debuggers (gdb, jdb, pdb, ...). It's meant for building developer tools (debug tools, IDEs, etc ...), built for Codebox

Supported debuggers

  • gdb : c/c++ (and any native binaries really)
  • jdb : java (and anything running on the JVM)
  • pdb : python
  • rdb : ruby
  • Feel free to send Pull Requests for more

Right now we interface with the current debugger through their command line programs and smartly writing and reading from their stdout/stdin.

Install

โš ๏ธ Warning: bugs is not yet published to npm

npm install bugs

Examples

python with pdb

var bugs = require('bugs');

// Use pdb to debug a python file
var dbg = bugs.pdb('./some_file.py');

// Debug "main" function
dbg.init()
.then(function() {
    return dbg.break('main');
})
.then(function() {
    // Run debugger
    return dbg.run();
})
.then(function() {
    // Get backtrace
    return dbg.backtrace();
})
.then(function(trace) {
    // Display trace & quit
    console.log('trace =', trace)
    return dbg.quit();
})
.done();

Native binaries with gdb

var bugs = require('bugs');

// Use gdb to unix "ls" binary
var dbg = bugs.gdb('ls');

// Debug "main" function
dbg.init()
.then(function() {
    return dbg.break('main');
})
.then(function() {
    // Run "ls" on a given folder
    return dbg.run('-al /tmp');
})
.then(function() {
    // Get backtrace
    return dbg.backtrace();
})
.then(function(trace) {
    // Display trace & quit
    console.log('trace =', trace)
    return dbg.quit();
})
.done();

Commands

General

.run(arg1, arg2, ...)

Run file to debug with given args

.restart()

Restart program

.quit()

Quit current instance of the debugger (this isn't terribly useful)

Movement

.finish()

Run until current method returns.

.step()

Execute and step into function

.stepi()

Execute current instruction

.continue()

Keep running from here

.next()

Run to the next line of the current function

.up()

Move one level up in the stack trace

.down()

Move one level down in the stack trace

Examination

.eval(code)

Evaluate a string of code and print the result

.backtrace()

Print backtrace of current stack

.list()

List source code of current location

.locals()

Get local variables of current stack

.globals()

Get global variables

Breakpoints

.breakpoints()

Lists currently set breakpoints

.breakpoint(location)

Set a new breakpoint at location (location can be a line number, function address ...)

.clear(location)

Clear breakproint for location (see above for location)

Aliases

.start()

Alias to run

.stop()

Alias to quit

Events

started

Signals when the debugger is ready to receive commands. .init() resolves when started is emitted (you should probably use that).

update

Provides updates when state of process changes. And updates not request or results of commands executed.

bugs.js's People

Contributors

aarono 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.