Code Monkey home page Code Monkey logo

ddbug's Introduction

ddbug - Display debugging information

ddbug is a utility for using DWARF debugging information to explore aspects code generation, and in particular to see how the code generation changes due to things such as source code changes or compiler option changes.

Features:

  • Type size and layout
  • Function type, size, inlined functions, function calls, and disassembly
  • Display the differences between two files
  • Plain text or HTTP/HTML output
  • Options to filter/sort the plain text output

This is alpha software. It is likely to contain many bugs and incomplete features. Neverthless, it is in a state where it can still provide some use. Bug reports and feature requests are welcome.

Supports:

  • ELF files with DWARF
  • Mach-O files with DWARF

Installing

After installing Rust, run:

cargo install --git https://github.com/gimli-rs/ddbug

Running

Find the file containing the debugging information, then run:

ddbug path-to-file

See ddbug --help for details on options to control which information is displayed.

Usually you will want to run ddbug on binaries that have been optimized, but which still contain debugging information. For rust, you can build your code using:

RUSTFLAGS=-g cargo build --release

Diff mode

When given the --diff option and two paths to files, ddbug will display the differences between the two binaries. There are some command line options to specify which differences are considered significant. Usually you will want to at least ignore addresses (-i address).

Example output

struct and union

struct core::fmt::Formatter
        size: 96
        members:
                0[16]   width: union core::option::Option<usize>
                16[16]  precision: union core::option::Option<usize>
                32[16]  buf: struct core::fmt::&mut Write
                48[16]  curarg: struct core::slice::Iter<core::fmt::ArgumentV1>
                64[16]  args: struct &[core::fmt::ArgumentV1]
                80[4]   flags: u32
                84[4]   fill: char
                88[1]   align: enum core::fmt::rt::v1::Alignment
                89[7]   <padding>

enum

Note that this is a C style enumeration. Rust enumerations are encoded in the debugging information as both a union and an enum.

enum core::result::Result
        size: 1
        enumerators:
                Ok(0)
                Err(1)

function

fn ddbug::main
        linkage name: _ZN5ddbug4mainE
        address: 0x601f0-0x629d9
        size: 10218
        inlined functions:
                [30]    log::__static_max_level
                [59]    log::max_log_level
        calls:
                0x40eee0 env_logger::init
                0x48870 core::result::Result<(), log::SetLoggerError>::ok<(),log::SetLoggerError>

fn log::__static_max_level
        linkage name: _ZN3log18__static_max_levelE
        inline: yes
        return type:
                [8]     enum log::LogLevelFilter

License

This software is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

ddbug's People

Contributors

ninja3047 avatar philipc 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.