All Projects → cyrus-and → gdb

cyrus-and / gdb

Licence: MIT license
Go GDB/MI interface

Programming Languages

go
31211 projects - #10 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to gdb

Voltron
A hacky debugger UI for hackers
Stars: ✭ 5,599 (+7898.57%)
Mutual labels:  debugger, gdb
Angrgdb
Use angr inside GDB. Create an angr state from the current debugger state.
Stars: ✭ 165 (+135.71%)
Mutual labels:  debugger, gdb
Rr
Record and Replay Framework
Stars: ✭ 6,469 (+9141.43%)
Mutual labels:  debugger, gdb
insight
A Tcl/Tk Frontend for GDB. This is an AppImage(Portable Package) of insight for the sake of Jeff Duntemann's amazing book.
Stars: ✭ 31 (-55.71%)
Mutual labels:  debugger, gdb
gdbundle
Minimalist plugin manager for GDB and LLDB
Stars: ✭ 72 (+2.86%)
Mutual labels:  debugger, gdb
Dlangide
D language IDE based on DlangUI
Stars: ✭ 358 (+411.43%)
Mutual labels:  debugger, gdb
Gdb Frontend
☕ GDBFrontend is an easy, flexible and extensionable gui debugger.
Stars: ✭ 2,104 (+2905.71%)
Mutual labels:  debugger, gdb
lldbg
A lightweight native GUI for LLDB.
Stars: ✭ 83 (+18.57%)
Mutual labels:  debugger, gdb
Gdbghidra
gdbghidra - a visual bridge between a GDB session and GHIDRA
Stars: ✭ 251 (+258.57%)
Mutual labels:  debugger, gdb
Code Debug
Native debugging for VSCode
Stars: ✭ 232 (+231.43%)
Mutual labels:  debugger, gdb
gdbstub
An ergonomic and easy-to-integrate implementation of the GDB Remote Serial Protocol in Rust, with full no_std support.
Stars: ✭ 158 (+125.71%)
Mutual labels:  debugger, gdb
hello-world-gdb
Simple hello world program for debugging with gdb
Stars: ✭ 29 (-58.57%)
Mutual labels:  debugger, gdb
madbomber
Backtrace-on-throw C++ exception logger
Stars: ✭ 17 (-75.71%)
Mutual labels:  debugger, gdb
Lldb
Project moved to: https://github.com/llvm/llvm-project
Stars: ✭ 412 (+488.57%)
Mutual labels:  debugger, gdb
metal.test
Deprecated, superseded by https://github.com/metal-ci/test
Stars: ✭ 41 (-41.43%)
Mutual labels:  debugger, gdb
Gdbgui
Browser-based frontend to gdb (gnu debugger). Add breakpoints, view the stack, visualize data structures, and more in C, C++, Go, Rust, and Fortran. Run gdbgui from the terminal and a new tab will open in your browser.
Stars: ✭ 8,339 (+11812.86%)
Mutual labels:  debugger, gdb
kakoune-gdb
gdb integration plugin
Stars: ✭ 44 (-37.14%)
Mutual labels:  debugger, gdb
gdb-dashboard
Modular visual interface for GDB in Python
Stars: ✭ 8,699 (+12327.14%)
Mutual labels:  debugger, gdb
Pyvmidbg
LibVMI-based debug server, implemented in Python. Building a guest aware, stealth and agentless full-system debugger
Stars: ✭ 192 (+174.29%)
Mutual labels:  debugger, gdb
esp-gdbstub
ESP8266 debugging tool
Stars: ✭ 13 (-81.43%)
Mutual labels:  debugger, gdb

gdb

Package gdb provides a convenient way to interact with the GDB/MI interface. The methods offered by this module are very low level, the main goals are:

  • avoid the tedious parsing of the MI2 line-based text interface;

  • bypass a known bug which prevents to distinguish the target program's output from MI2 records.

Web interface

This package comes with an additional HTTP/WebSocket interface which aims to provide a straightforward way to start developing web-based GDB front ends.

A dummy example can be found in the example folder.

Example

package main

import (
	"fmt"
	"github.com/cyrus-and/gdb"
	"io"
	"os"
)

func main() {
	// start a new instance and pipe the target output to stdout
	gdb, _ := gdb.New(nil)
	go io.Copy(os.Stdout, gdb)

	// evaluate an expression
	gdb.Send("var-create", "x", "@", "40 + 2")
	fmt.Println(gdb.Send("var-evaluate-expression", "x"))

	// load and run a program
	gdb.Send("file-exec-file", "wc")
	gdb.Send("exec-arguments", "-w")
	gdb.Write([]byte("This sentence has five words.\n\x04")) // EOT
	gdb.Send("exec-run")

	gdb.Exit()
}

Installation

go get -u github.com/cyrus-and/gdb

Documentation

GoDoc.

Data representation

The objects returned as a result of the commands or as asynchronous notifications are generic Go maps suitable to be converted to JSON format with json.Marshal(). The fields present in such objects are blindly added according to the records returned from GDB (see the command syntax): tuples are map[string]interface{} and lists are []interface{}.

Yet, some additional fields are added:

  • the record class, where present, is represented by the "class" field;

  • the record type is represented using the "type" field as follows:

    • +: "status"
    • =: "notify"
    • ~: "console"
    • @: "target"
    • &: "log"
  • the optional result list is stored into a tuple under the "payload" field.

For example, the notification:

=thread-group-exited,id="i1",exit-code="0"

becomes the Go map:

map[type:notify class:thread-group-exited payload:map[id:i1 exit-code:0]]

which can be converted to JSON with json.Marshal() obtaining:

{
    "class": "thread-group-exited",
    "payload": {
        "exit-code": "0",
        "id": "i1"
    },
    "type": "notify"
}

Mac OS X

Setting up GDB on Darwin

To use this module is mandatory to have a working version of GDB installed, Mac OS X users may obtain a copy using Homebrew for example, then they may need to give GDB permission to control other processes as described here.

Issues

The Mac OS X support, though, is partial and buggy due to the following issues.

Pseudoterminals

I/O operations on the target program happens through a pseudoterminal obtained using the pty package which basically uses the /dev/ptmx on *nix systems to request new terminal instances.

There are some unclear behaviors on Mac OS X. Calling gdb.Write() when the target program is not running is a no-op, on Linux instead writes are somewhat buffered and delivered later. Likewise, gdb.Read() may returns EOF even though there is actually data to read, a solution may be keep trying.

Interrupt

Sending a SIGINT signal to GDB has no effect on Mac OS X, on Linux instead this is equivalent to typing ^C, so gdb.Interrupt() will not work.

Development

The goyacc tool is needed to generate the grammar.go file. Install it with:

go install golang.org/x/tools/cmd/goyacc@latest

After that use the following to update the grammar.go file:

go generate -x

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].