Giter Site home page Giter Site logo

sgodbillon / bytecodeparser Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 10.0 1.74 MB

A Java library to parse JVM bytecode, simulate the stack and extract as much information as possible

Home Page: http://sgodbillon.github.com/BytecodeParser/

License: Other

CSS 0.83% Java 99.17%

bytecodeparser's People

Contributors

michaelstorm avatar sgodbillon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bytecodeparser's Issues

const string paramter return null

class.forname("test") with example code:

            DecodedMethodInvocationOp dmio = (DecodedMethodInvocationOp) frame.decodedOp;
            MethodParams methodParams = DecodedMethodInvocationOp.resolveParameters(frame);
            MethodParam[] params = methodParams.merge();
            System.out.println("method '" + dmio.getName() + "' has been called with the following arguments: " + java.util.Arrays.toString(params));

params return null;

Problem about DecodedLocalVariableOp.localVariable

Hi,

I'm a new user of this package. I'm now trying to retrieve the information of local variables as the sample you show on the website http://stephane.godbillon.com/BytecodeParser/.

The problem I encountered when doing this is that I cannot get the local variable for LOAD instructions. Specifically, I use the following code to retrieve the information I want:

@Override
public void handle(Op op, int idx) {
  if ((op instanceof LocalVariableOpcode) == false)
    return ;

  LocalVariableOpcode lv = op.as(LocalVariableOpcode.class);
  LocalVariable lvInfo = lv.decode(context, idx).localVariable;
  System.out.println(idx + " " + lvInfo.toString() + ": " + lvInfo.name);
}

However, I got NullPointerException of lvInfo when parsing the instruction ILOAD 5 in my program. Is it due to some wrong manipulations or restrictions?

Thanks.

SWAP incorrectly performs swap on Stack

The current SWAP takes the top element and puts it one from bottom instead of one from top(which it is supposed to do).

The pull request is
#3

I have absolutely no clue on how to write a test case since I used this branch to reproduce the issue

https://github.com/deanhiller/timecardz/tree/bytecodeissue

In my case, I had a stack with [XXXXX, YYYYYY, TOP, ZZZZZ] and doing a swap ended up with [YYYYYY, TOP, XXXXX, ZZZZZ] instead of the correct [YYYYYY, XXXXX, TOP, ZZZZ] which then resulted in popped a TOP runtimeexception later on.

exception on init method not called but enter called causing nullpointer

I am not sure how to reproduce this and I worked around it by just doing if something != null but basically the bytecode stuff was wrapping enterMethod and exitMethod to be called around one of my methods(it seemed to always be the first method in my catch block) and initMethod was nevercalled.

Since initMethod was never called, I ended up with a nullpointer in enterMethod as it requires initMethod to be called.

The logic on whether to wire initMethod is strange in my opinion. The way it should be coded I would think is if(enterMethodAdded || exitMethodAdded) addInitMethod()

but instead it depends on different stuff.

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.