Giter Club home page Giter Club logo

kfg's People

Contributors

abdullinam avatar despairedcontroller avatar saloed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kfg's Issues

Exception in CfgBuilder

Exception when building cfg for this method

https://github.com/apache/commons-math/blob/3.6.1-release/src/main/java/org/apache/commons/math3/linear/FieldLUDecomposition.java#L297

Binaries available here:
http://mirror.linux-ia64.org/apache//commons/math/binaries/commons-math3-3.6.1-bin.zip

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.remove(ArrayList.java:535)
	at org.jetbrains.research.kfg.builder.cfg.CfgBuilder.pop(CfgBuilder.kt:80)
	at org.jetbrains.research.kfg.builder.cfg.CfgBuilder.convertLocalStore(CfgBuilder.kt:373)
	at org.jetbrains.research.kfg.builder.cfg.CfgBuilder.convertVarInsn(CfgBuilder.kt:418)
	at org.jetbrains.research.kfg.builder.cfg.CfgBuilder.buildInstructions(CfgBuilder.kt:944)
	at org.jetbrains.research.kfg.builder.cfg.CfgBuilder.build(CfgBuilder.kt:973)
	at org.jetbrains.research.kfg.ClassManager.initialize(ClassManager.kt:81)
	at org.jetbrains.research.kex.Kex.<init>(kex.kt:119)
	at org.jetbrains.research.kex.MainKt.main(main.kt:7)

Invalid frame info

Invalid frame info for method
org/apache/commons/pool/impl/GenericKeyedObjectPool::destroy(java/util/Map, org/apache/commons/pool/KeyedPoolableObjectFactory): void

commons-pool-16.zip

Pass manager

Implement pass system and pass manager for kfg visitors, similar to LLVM

Use JVM frames to build Phi instructions

Currently Phi instructions are built using dominator trees. It's the most complex part of the library which led to a lot of bugs.
All necessary information about phi's is already contained in jvm frames and it's easy to access. Need to consider using information from frames to avoid unnecessary complication.

Exception when trying update JarContainer

fun createKFGGraphs(jars: List<Container>): MutableMap<String, MutableList<Graph>> {
        log.info("Creating CGF for $containers")
        val kfgGraphs = mutableMapOf<String, MutableList<Graph>>()
        for (jar in jars) {
            val cm = ClassManager(KfgConfig(Flags.readAll, failOnError = true))
            cm.initialize(jar)
            val graphs = mutableListOf<Graph>()
            for (klass in cm.concreteClasses) {
                for (method in klass.allMethods) {
                    if (!method.isNative)
                        graphs.add(method.toGraph(method.name + "::" + method.prototype.replace("/", ".")))
                }
            }
            kfgGraphs[jar.name] = graphs
            jar.update(cm, jar.path, jar.classLoader)
        }
        return kfgGraphs
    }

Вылетает exception при попытке создать cfg как описано в readme:

Exception in thread "main" java.io.FileNotFoundException: D:\IdeaProjects\kex\kex-test-0.0.1-jar-with-dependencies.jar\kex-test-0.0.1-jar-with-dependencies.jar (Системе не удается найти указанный путь)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126)
	at org.jetbrains.research.kfg.util.JarBuilder.<init>(jar.kt:105)
	at org.jetbrains.research.kfg.container.JarContainer.update(JarContainer.kt:115)
	at org.jetbrains.research.kfg.container.JarContainer.update(JarContainer.kt:18)

При отладке выяснил, что проблема где-то здесь

val absolutePath = target.toAbsolutePath()
val jarName = file.name.substringAfterLast(File.separator).removeSuffix(".jar")
val jarPath = absolutePath.resolve("$jarName.jar")
val builder = JarBuilder("$jarPath", manifest)

В absolutePath у меня D:\IdeaProjects\kex\kex-test-0.0.1-jar-with-dependencies.jar, а в jarPath, который потом в JarBuilder передаётся, D:\IdeaProjects\kex\kex-test-0.0.1-jar-with-dependencies.jar\kex-test-0.0.1-jar-with-dependencies.jar, что кажется очень странным

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.