Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow augmenting the return value in unsafe mode #131

Closed
jbachorik opened this issue Jun 23, 2015 · 0 comments
Closed

Allow augmenting the return value in unsafe mode #131

jbachorik opened this issue Jun 23, 2015 · 0 comments

Comments

@jbachorik
Copy link
Collaborator

Sometimes it might be useful to augment the return value captured in location=@Location(Kind.RETURN) or location=@Location(Kind.CALL) handlers.

Eg. the following piece of code would put a cap on the value that could be returned by the intercepted method.

@BTrace(unsafe = true)
public class ArgsReturnAugmented {
    @OnMethod(clazz="TestClass", method="testMethod", location=@Location(value=Kind.RETURN))
    public static long args(@Self Object self, @Return long ret, String a, long b, String[] c, int[] d) {
        println("args");
        return ret > 100 ? 100 : ret;
    }
}

Since this functionality can bring instability to the traced application it is limited to the unsafe mode only.

@jbachorik jbachorik self-assigned this Jun 23, 2015
@jbachorik jbachorik added this to the 1.3.1 milestone Jun 23, 2015
jbachorik added a commit that referenced this issue Jun 23, 2015
Fixes #131. Modifying the Preprocessor to work well with the augmente…
jbachorik added a commit that referenced this issue Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant