Giter VIP home page Giter VIP logo

beam_rewriter's Introduction

beam_rewriter

Rewrite BEAM files with ease.

Notice #2

This project is abandoned, due to that I have found a way to remove source name references from BEAM files โ€”โ€” deterministic option of Erlang compiler.

Then, I have no need to modify Line chunk.

Notice #1

This project is still in development.

Right now, I'm stuck on the issue of "encoding/decoding chunk data". As described here, almost all the chunks have their own unique data format, but this documentation only covers a limited number of chunks, lacking the chunks what I need, such as Line chunk.

Before proceeding with the development, I need to understand the data format of all the chunks. However, with my limited experience of C or Erlang, it's difficult to dig the data format. Therefore, the development is indefinitely postponed.

If you have knowledge in this area, please feel free to reach out to me.

Build

$ mix escript.build

Then, the generated escript will be placed at escript/beam_rewriter.

Usage

Syntax

beam_rewriter <wildcard> \
  --substitute-chunk <chunk name> <pattern> <replacement> \
  --delete-chunk <chunk name>

Examples

# substitue string in a chunk
$ beam_rewriter ./parser.beam \
  --substitute-chunk Line "/nix/store" "/nix-store"

# delete a chunk
$ beam_rewriter ./parser.beam \
  --delete-chunk Dbgi \

# substitue string in a chunk, and delete a chunk
$ beam_rewriter ./parser.beam \
  --substitute-chunk Line "/nix/store" "/nix-store" \
  --delete-chunk Dbgi \

# specify files by a wildcard
$ beam_rewriter **/*.beam \
  --substitute-chunk Line "/nix/store" "/nix-store"

# specify files by a wildcard and multiple filenames
$ beam_rewriter *.beam lib/parser.beam lib/compiler.beam \
  --substitute-chunk Line "/nix/store" "/nix-store"

In pratice, you shouldn't delete arbitrary chunks. Here is just a demonstration of how to use this program.

References

License

MIT

beam_rewriter's People

Contributors

c4710n avatar

Watchers

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