A method for displaying a method call relation graph when a java byte code is checked

A java bytecode and display method technology, which is applied in the field of code logic analysis, can solve problems such as trouble reading instruction bytecode, inability to decompile java source code in class files, and inability to generate function call diagrams, etc.

Active Publication Date: 2019-06-18
TAICANG T&W ELECTRONICS CO LTD
View PDF5 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

The disadvantage is that the function call diagram cannot be generated for java class files
[0004] The advantage of JD-gui is that it can decompile java class files into java source code. The disadvantage is tha

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method for displaying a method call relation graph when a java byte code is checked
  • A method for displaying a method call relation graph when a java byte code is checked
  • A method for displaying a method call relation graph when a java byte code is checked

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0034] A method for displaying a method call diagram when viewing java bytecodes, comprising the following steps: 1. decompressing a jar file, disassembling a class file therein, and generating a corresponding code text file;

[0035] Step 2, perform text analysis on the code text file, parse out all methods in all classes, and set each method as a node in a topology;

[0036] Step 3: Analyze the method call code in each method, find the called method, and establish an association in the topology diagram;

[0037] Step 4. According to the topology diagram, draw each node in the image with a unified graphic, and connect the nodes with line segments with arrows. Because there can be multiple places in the method to call other methods, so how many arrows can a node connect to other node;

[0038] Step 5. Add a mouse click trigger event processing function for each node graph in the image. When the user clicks the graph, the processing function automatically opens the file where ...

Embodiment 2

[0040] Compared with Embodiment 1, this embodiment differs in that in step 1, the jar file is decompressed, the class file therein is disassembled, and a corresponding code text file is generated. The specific method is as follows:

[0041] a. Use the open source Zip library in the program to decompress the decompiled jar file and put the content into a directory;

[0042] b. Realize all java bytecode files with the suffix name class in the file scanning directory;

[0043] c. Use the javap command to disassemble each bytecode class file in turn to generate assembly code and save the code to the location of the class file and take a unified file suffix name.

Embodiment 3

[0045] Compared with Embodiment 2, this embodiment differs in step 2, performing text analysis on the code text file, parsing out all methods in all classes, and setting each method as a node in a topology structure, as follows:

[0046] a. Open the code text files generated by the assembly in sequence, and perform text analysis according to a specific template;

[0047] b. Take each method name, method signature, and method implementation in each class in each file as a data record, and abstract it into a node of the topology.

[0048] As a preferred solution of Embodiment 3, the method name and method signature are combined into a unique identifier for each node.

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for displaying a method call relation graph when a java bytecode is viewed, which comprises the following steps of: 1, decompressing a jar file, and disassembling a class file in the jar file to generate a corresponding code text file; 2, performing text analysis on the code text file, analyzing all methods in all classes, and setting each method as a node in a topological structure; 3, analyzing the method calling code in each method, finding out the calling method, and establishing association in the topological graph; 4, according to the topological graph, drawing each node in the image by using a unified graph, and connecting the nodes; And 5, adding a mouse click trigger event processing function to each node graph in the image, and when a user clicksthe graph, automatically opening a file where the method is located by the processing function and jumping to the method to define a corresponding line number. And decompiling byte codes of the classfile of java to realize automatic logic analysis and generate a function relationship call graph, and presenting the function relationship call graph to a developer in a graphical manner.

Description

technical field [0001] The invention relates to a code logic analysis method, in particular to a method for displaying a method call relation diagram when viewing java byte codes. Background technique [0002] At present, in the field of software decompilation, there are many tools for decompiling executable files, such as IDA, and there are also decompilation tools for intermediate code files generated by Java code, such as JD-gui. Direct use of executable file decompilation tools requires developers to have a high level of computer expertise and understand assembly language, machine code, the working principle of computer addressing, function calling conventions when compiling high-level languages, and methods of stacking and popping. The direct decompilation of JAVA, the network compilation language, is much more user-friendly. For example, JD-gui can decompile jar files into java source files, which is convenient for directly viewing JAVA source files. However, due to t...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F8/53
Inventor 孟晶石
Owner TAICANG T&W ELECTRONICS CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products