Giter Club home page Giter Club logo

bctrace's Introduction

Maven Central

io.shiftleft:bctrace

An extensible framework for creating production-ready java agents.

bctrace exposes a simple event-driven programming model, built around the Hook abstraction, and saves the developer from the complexity of dealing with bytecode manipulation.

Instrumentation primitives

  • Notifying events to hook listeners in the case of
    • Method just started
    • Method about to return
    • Method about to rise a Throwable
    • Call site about to be invoked
    • Call site just returned
    • Call site just raised a Throwable
  • Changing runtime data:
    • Method/call-site (about to be) passed arguments
    • Method/call-site (about to be) returned value
    • Method/call-site (about to be) thrown Throwable

Features

  • Battle tested and production-ready
  • Generic vs direct APIs (this last suited for instrumenting hot spot methods)
  • Automatic packaging of dependencies
  • Supports filtering based on class hierarchy
  • Off-heap classloading, that ensures no side effects in the target application
  • Ensures no recursive event notifications are triggered from listener code
  • Ensures no exceptions raised by listeners reach the application
  • JMX metrics
  • Extensible
    • Logging
    • Help menu

Getting started

Bootstraping a new agent project

Set the coordinates for you new agent project

export ORG_ID=org.myorganization
export ARTIFACT_ID=test-agent
export VERSION=0.0.0-SNAPSHOT

Generate the project into a new folder of the current directory by using the provided archetype:

mvn archetype:generate -B \
-DarchetypeGroupId=io.shiftleft \
-DarchetypeArtifactId=bctrace-archetype \
-DarchetypeVersion=0.0.0-SNAPSHOT \
-DgroupId=$ORG_ID \
-DartifactId=$ARTIFACT_ID \
-Dversion=$VERSION

Move to the new agent project root folder

cd $ARTIFACT_ID

And build it

mvn clean package

Project structure

The newly created agent project is a multi-module Maven project, than contains

  • /agent: The agent module.
  • /playground: Several target applications to test instrumentation.

Running the agent

Run the /playground/hello-word test application:

$ java -jar playground/hello-world/target/$ARTIFACT_ID-playground-hello-world-$VERSION.jar

Hello world!

By default, the generated agent defines two hooks:

Now, run it again, attaching the agent, and compare the results:

$ java -javaagent:agent/target/$ARTIFACT_ID-$VERSION.jar -jar playground/hello-world/target/$ARTIFACT_ID-playground-hello-world-$VERSION.jar

INFO 1554349422236 Starting bctrace agent ...
INFO 1554349422267 Created String instance: "playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar"
INFO 1554349422267 Created String instance: "playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar"
INFO 1554349422267 Created String instance: "META-INF/MANIFEST.MF"
INFO 1554349422268 Created String instance: "Manifest-Version"
INFO 1554349422268 Created String instance: "1.0"
INFO 1554349422268 Created String instance: "Archiver-Version"
INFO 1554349422268 Created String instance: "Plexus Archiver"
INFO 1554349422268 Created String instance: "Built-By"
INFO 1554349422268 Created String instance: "nacho"
INFO 1554349422268 Created String instance: "Created-By"
INFO 1554349422268 Created String instance: "Apache Maven 3.5.4"
INFO 1554349422269 Created String instance: "Build-Jdk"
INFO 1554349422269 Created String instance: "1.8.0_191"
INFO 1554349422269 Created String instance: "Main-Class"
INFO 1554349422269 Created String instance: "org.myorganization.testagent.playground.helloworld.Main"
INFO 1554349422269 Created String instance: "org/myorganization/testagent/playground/helloworld/Main"
INFO 1554349422269 Created String instance: "org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422269 Created String instance: "org/myorganization/testagent/playground/helloworld/Main"
INFO 1554349422269 Created String instance: "org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422269 Created String instance: "org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422270 Created String instance: "org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422270 Created String instance: "org/"
INFO 1554349422270 Appending "" + "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!/"
INFO 1554349422270 Appending "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!/" + "org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422270 Created String instance: "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!/org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422270 Created String instance: "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!"
INFO 1554349422270 Created String instance: "/org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422270 Appending "" + "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!"
INFO 1554349422271 Appending "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!" + "/org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422271 Created String instance: "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar!/org/myorganization/testagent/playground/helloworld/Main.class"
INFO 1554349422271 Created String instance: "org.myorganization.testagent.playground.helloworld"
INFO 1554349422271 Created String instance: "META-INF/MAVEN/"
INFO 1554349422271 Created String instance: "META-INF/MAVEN/ORG.MYORGANIZATION/"
INFO 1554349422271 Created String instance: "META-INF/MAVEN/ORG.MYORGANIZATION/TEST-AGENT-PLAYGROUND-HELLO-WORLD/"
INFO 1554349422271 Created String instance: "META-INF/MAVEN/ORG.MYORGANIZATION/TEST-AGENT-PLAYGROUND-HELLO-WORLD/POM.XML"
INFO 1554349422271 Created String instance: "META-INF/MAVEN/ORG.MYORGANIZATION/TEST-AGENT-PLAYGROUND-HELLO-WORLD/POM.PROPERTIES"
INFO 1554349422272 Created String instance: "Manifest-Version"
INFO 1554349422272 Created String instance: "1.0"
INFO 1554349422272 Created String instance: "Archiver-Version"
INFO 1554349422272 Created String instance: "Plexus Archiver"
INFO 1554349422272 Created String instance: "Built-By"
INFO 1554349422272 Created String instance: "nacho"
INFO 1554349422272 Created String instance: "Created-By"
INFO 1554349422272 Created String instance: "Apache Maven 3.5.4"
INFO 1554349422272 Created String instance: "Build-Jdk"
INFO 1554349422272 Created String instance: "1.8.0_191"
INFO 1554349422272 Created String instance: "Main-Class"
INFO 1554349422272 Created String instance: "org.myorganization.testagent.playground.helloworld.Main"
INFO 1554349422272 Created String instance: "org/myorganization/testagent/playground/helloworld"
INFO 1554349422272 Created String instance: "org/myorganization/testagent/playground/helloworld/"
INFO 1554349422273 Created String instance: "org/myorganization/testagent/playground/helloworld"
INFO 1554349422273 Created String instance: "org/myorganization/testagent/playground/helloworld/"
INFO 1554349422273 Created String instance: "org/myorganization/testagent/playground/helloworld"
INFO 1554349422273 Created String instance: "org/myorganization/testagent/playground/helloworld/"
INFO 1554349422273 Created String instance: "org.myorganization.testagent.playground.helloworld"
INFO 1554349422273 Created String instance: "file:/tmp/test-agent/playground/hello-world/target/test-agent-playground-hello-world-0.0.0-SNAPSHOT.jar"
INFO 1554349422274 Appending "" + "Hello "
INFO 1554349422274 Appending "Hello " + "world"
INFO 1554349422274 Appending "Hello world" + "!"
INFO 1554349422274 Created String instance: "Hello world!"
Hello world!
INFO 1554349422274 Appending "" + ""
INFO 1554349422274 Appending "" + ".level"
INFO 1554349422275 Created String instance: ".level"  

Congratulations, your bctrace agent is up and running (and ready to grow)!

Next steps

Explore the agent documentation

Main stack

This module could not be possible without:

Authors

License

Based on brutusin:instrumentation by Ignacio del Valle Alles distributed under Apache v2.0 license.

Creating a release

VERSION="0.0.1"
mvn versions:set -DnewVersion=$VERSION
mvn versions:commit
git add pom.xml */pom.xml
git commit -m "updating version to $VERSION"
git tag v$VERSION
mvn clean test javadoc:jar deploy
git push origin v$VERSION

bctrace's People

Contributors

davyhua avatar idelvall avatar mpollmeier avatar tuxology avatar valarauca avatar

Stargazers

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

Watchers

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

bctrace's Issues

Stack frame map recomputation fails for constructors

try-catch blocks introduced by CatchHelper (used for notifying throwables raised by the method) fail in constructors.

To reproduce it compile tests with target version 1.7 (https://github.com/ShiftLeftSecurity/bctrace/blob/master/pom.xml#L25)

java.lang.VerifyError: Stack map does not match the one at exception handler 36
Exception Details:
  Location:
    io/shiftleft/bctrace/TestClass.<init>()V @36: dup
  Reason:
    Current frame's flags are not assignable to stack map frame's.
  Current Frame:
    bci: @19
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'io/shiftleft/bctrace/runtime/FrameData' }
    stack: { 'java/lang/Throwable' }
  Stackmap Frame:
    bci: @36
    flags: { }
    locals: { top, 'io/shiftleft/bctrace/runtime/FrameData' }
    stack: { 'java/lang/Throwable' }
  Bytecode:
    0x0000000: 0103 01b8 008a 594c 5903 b800 9057 04b8
    0x0000010: 0090 572a b700 0101 2b04 b800 9401 2b03
    0x0000020: b800 94b1 592b 04b8 0098 592b 03b8 0098
    0x0000030: bf                                     
  Exception Handler Table:
    bci [19, 36] => handler: 36
  Stackmap Table:
    full_frame(@36,{Top,Object[#134]},{Object[#132]})

	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at io.shiftleft.bctrace.FeatureTest.testVoidReturn(FeatureTest.java:250)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Add support for additional listeners

Instrumentation listeners are aligned 1:1 with filters in the hooks.

We need a mechanism for providing additional listeners to be applied to those methods that are accepted by a filter of a hook, rather than specifying a filter by themselves.

This feature is needed by the debugging call counter for example, than currently was being implemented in a per listener-basis and could incur in calls counted multiple times if several start listeners were register for those methods.

Avoid recursive listener invocation

If a listener invokes a method that triggers listener invocation an infinite recursive listener invocation will occur leading to a StackOverflowError

Add debugging features

It would be great to provide additional debugging mechanisms so can easy the performance analysis.
For example:

  • Report enumeration of instrumented methods
  • Report number of calls per instrumented method

NPE instrumenting Okta

As reported by @rstatsinger

Mar 09, 2018 6:26:46 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2018 6:26:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Mar 09, 2018 6:26:46 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2018 6:26:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 494 ms
Mar 09, 2018 6:26:46 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Mar 09, 2018 6:26:46 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.23
Mar 09, 2018 6:26:46 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive [/home/vagrant/okta/thirdparty/tomcat/8.5.23/webapps/ROOT.war]
Mar 09, 2018 6:26:55 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
SLF4J: A number (4) of logging calls during the initialization phase have been intercepted and are
SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#replay
Mar 09, 2018 6:26:56 PM org.apache.catalina.core.ApplicationContext log
INFO: 2 Spring WebApplicationInitializers detected on classpath
<< 2018-03-09 18:26:57.042 ERROR 23 Error found instrumenting class org/aspectj/weaver/JoinPointSignatureIterator
<< java.lang.NullPointerException
<< at io.shiftleft.bctrace.spi.a.a.b(Unknown Source)
<< at io.shiftleft.bctrace.spi.a.a.a(Unknown Source)
<< at io.shiftleft.bctrace.asm.a.a(Unknown Source)
<< at org.a.a.g.a(Unknown Source)
<< at org.a.a.m.a(Unknown Source)
<< at org.a.a.m.a(Unknown Source)
<< at org.a.a.s.d(Unknown Source)
<< at org.a.a.a.v.a(Unknown Source)
<< at org.a.a.a.c.a(Unknown Source)
<< at io.shiftleft.bctrace.asm.b.transform(Unknown Source)
<< at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
<< at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
<< at java.lang.ClassLoader.defineClass1(Native Method)
<< at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
<< at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
<< at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
<< at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
<< at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
<< at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
<< at java.security.AccessController.doPrivileged(Native Method)
<< at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
<< at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
<< at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
<< at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
<< at org.aspectj.weaver.MemberImpl.getJoinPointSignatures(MemberImpl.java:515)
<< at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:316)
<< at org.aspectj.weaver.patterns.KindedPointcut.matchInternal(KindedPointcut.java:197)
<< at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
<< at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:56)
<< at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
<< at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:56)
<< at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
<< at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:113)
<< at org.aspectj.weaver.Advice.match(Advice.java:109)
<< at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:151)
<< at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3311)
<< at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2692)
<< at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:480)
<< at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
<< at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1692)
<< at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1636)
<< at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1401)
<< at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1183)
<< at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:527)
<< at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:363)
<< at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:121)
<< at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
<< at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
<< at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
<< at java.lang.ClassLoader.defineClass1(Native Method)
<< at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
<< at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
<< at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2283)
<< at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:811)
<< at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1260)
<< at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
<< at com.okta.monolith.web.spring.OktaWebApplication.configure(OktaWebApplication.java:212)
<< at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:118)
<< at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
<< at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
<< at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
<< at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
<< at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
<< at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
<< at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
<< at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
<< at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
<< at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
<< at java.util.concurrent.FutureTask.run(FutureTask.java:266)
<< at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
<< at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
<< at java.lang.Thread.run(Thread.java:745)
<<

Support dynamic listener callback methods

In the context of https://github.com/ShiftLeftSecurity/product/issues/657

The goal of this issue is to avoid the creation of Object[] used to pass the arguments of the instrumented methods to the listeners, thing that might incur in a heap pollution when the number of instrumented calls sites is quite high.

Background

bctrace injects listeners hooks in the target methods as static calls to https://github.com/ShiftLeftSecurity/bctrace/blob/master/runtime/src/main/java/io/shiftleft/bctrace/runtime/Callback.java. Given the general purpose of this approach, arguments need to be wrapped in a Object[] to be passed.

Proposal

Rename current hooks (filter+listener) as GeneralHook, hooks that can be applied to any method that passes the filtering, and will call static methods predefined in the Callback, as done now.

Now we can add support for a different type of hooks: DirectHook, that are target to a specific method signature. These new hooks would use a new DirectListener abstraction, whose callback method would not be fixed by the interface but instead based on the naming convention onEvent(...)

We could then, at agent startup, use the signatures of the registered DirectListener instances to dynamically generate static methods in the Callback class matching them, so delegation could be applied directly, without wrapping the arguments

Classes are never instrumented

Some classes are never instrumented, despite of being considered intrumentable, for example ByteArrayInputStream. I suspect, that this class is used by the JVM prior to instrumentation.

In order to be reliable, our API should be consistent and if a class is declared instrumentable, then guarantee that the transformer will be called. So we need to detect all the cases like the ByteArrayInputStream one, and update accordingly the rules in TransformationSupport

A simple test agent, iterating over all loaded classes, and reintrumenting those instrumentable can work to detect which of them are not reinstrumented (if any one more)

Retransformations failing for certain classes

This issue is just a reminder that further investigation is needed.

Currently retransformation fails for classes inside these packages: (I guess not every class in them)

sun.*
com.sun.*
javafx.*
org.springframework.boot.*

Mac os related? (Tested with latest JRE 1.7 and 1.8)

BTW load time transformation works (maybe related to JDK-8145964 bug?)

Instrument interface methods

Java 8 and 9 allows interfaces to define method implementations (default and static methods,...) so instrumentation must not ignore interfaces

Cannot build project

I had this error when running the script
mvn archetype:generate -B -DarchetypeGroupId=io.shiftleft -DarchetypeArtifactId=bctrace-archetype -DarchetypeVersion=0.0.0-SNAPSHOT -DgroupId=%ORG_ID%% -DartifactId=%ARTIFACT_ID% -Dversion=%VERSION%

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project bctrace: The desired archetype does not exist (io:bctrace-archetype:0) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project bctrace: The desired archetype does not exist (io:bctrace-archetype:0)

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.