Program Analysis Blog
What is the definition of program analysis?
The process of automatically assessing the behaviour of computer program in terms of properties such as correctness, robustness, safety, and liveness is known as program analysis in computer science. The two main topics of program analysis are program optimization and program correctness. The first focuses on increasing program performance while lowering resource consumption, while the second ensures that the program achieves what it is supposed to do.
Program analysis can be done without running the program (static program program analysis), during runtime (dynamic program analysis), or both (combination program analysis).
Analysing software code to learn about its qualities is what programme analysis is all about. Bugs or security vulnerabilities, such as the ones stated above, can be discovered by programme analysis. It may also be used to create test cases for software and even patch it automatically.
Facebook, for example, employs the Getafix tool to automatically generate patches for issues discovered by various types of analytic software Finally, in order to optimise compilers, programme analysis is used to make programmes execute more quickly
Program Analysis Tools
Program Analysis Tool is an automated tool that takes the source code or executable code of a program as input and produces observations about the program's features as output. It specifies the size, complexity, appropriateness of commenting, adherence to programming standards, and other properties of the program.
Program Analysis Tool Classification:
The following are the two types of program analysis tools
Static Program Analysis Tools
Dynamic Program Analysis Tools
Static Program Analysis Tools:
Static analysis (also known as static code analysis or source code analysis) employs tools to examine programme code in search of application coding errors, back doors, or other malicious code that could allow hackers access to sensitive company data or customer data. In some circumstances, the analysis is carried out on a certain version of the source code, while in others, it is carried out on a specific form of the object code. When static analysis scans source or object code, it evaluates the security and functionality of software while the programme is not operating, which is typically early in the development lifecycle. An automated tool is usually used to do static analysis.
Static programme analysis tools typically examine some structural representation of a programme in order to arrive at a specific analytical conclusion. Static programme analysis methods are used to examine various structural properties.
Data-driven static analysis
To infer coding conventions, data-driven static analysis employs vast volumes of code. For example, to develop a good analytical strategy, one can use all Java open-source programmes on GitHub. Machine learning techniques can be used to infer rules. It has been demonstrated, for example, that deviating too much in the way one utilises an object-oriented API is likely to constitute a defect. It's also feasible to get knowledge from a big number of previous fixes and warnings.
The advantages of static analysis Tools :
Speed
When compared to manual analysis, using automated tools is much faster and allows problems to be handled earlier and at a reduced cost.
Depth
As developers work on their build, static analysis tools can provide in-depth code analysis and insight into potential problems.
Accuracy
Unlike manual code reviews, which are prone to human mistake, automated code reviews check every line of code for potential flaws, allowing for secure code to be entered before testing begins.
Limitations of Static Analysis Tools:
• Static analysis alone is insufficient to ensure application security because misconfigurations are a key source of vulnerabilities.
• Because static analysis techniques rely on abstract models and representations of programme data flows and logic, as well as their inability to understand developer intent within certain coding contexts, their conclusions may contain false positives or negatives.
Dynamic Program Analysis Tools:
Dynamic Program Analysis Tool is a form of programme analysis tool that necessitates the execution of the programme and observation of its real behaviour. The code is basically implemented using a dynamic programme analyser. It inserts extra statements to the source code to capture programme execution traces. When the code is run, it allows us to examine the software's behaviour for various test scenarios. After the software has been tested and its behaviour monitored, the dynamic programme analysis tool runs a post-execution analysis and generates reports that detail the structural coverage attained by the program's whole testing process.
A histogram or a pie chart represents the findings of dynamic programme analysis tools. It describes the structural coverage acquired for the program's various components. The output of a dynamic programme analysis tool is simply stored and printed, and it serves as proof that all tests have been completed. Dynamic analysis also aids in the removal of unnecessary test cases.
Types of dynamic analysis
The following are the 8 types of dynamic analysis :
- Code coverage
- Memory error detection Fault
- localization
- Invariant inference
- Performance analysis
- Program slicing
- Concurrency errors
- Security analysis
Code Coverage:
A common dynamic analysis technique is to calculate code coverage based on a test suite or workload.
The GNU source code coverage application is called Gcov.
To monitor code coverage, call stack, execution trace, instantiated objects, and variables, VB Watch injects dynamic analysis code into Visual Basic scripts.
Memory error detection Fault
Dynamic memory error debugger for Windows* and Linux* applications written in C, C++, and Fortran.
Address Sanitizer
Memory fault detection software for Linux, macOS, Windows, and other operating systems. It's a part of LLVM.
Fault localization
According to failed and passing test cases, fault localization refers to locating the defective code (for example, the buggy statement). Tarantula, for example, is a well-known defect localisation technique based on the code covered. Fault localization exemplifies a key feature of dynamic analysis: the analysis' results are influenced by the workload, inputs, and test cases used. It has been demonstrated that refactoring the test cases can improve fault localization results.
Invariant Inference
Daikon is a dynamic invariant detection implementation. Daikon executes a program, records the values it computes, and then presents attributes that were true in the observed executions and are likely true in all executions.
Performance Analysis
Dynamic program analysis approaches are used by the majority of performance analysis tool:
CriticalBlue's Prism is a tool that dynamically tracks software programmes in real time and gathers data that may be used to assess and diagnose performance issues.
Program Slicing
Program slicing is the process of reducing a programme to the simplest version that nevertheless provides the desired behaviour for a given subset of its behaviour. A "slice" is a shortened programme that faithfully represents the original programme within the domain of the given behaviour subset. Finding a slice is generally an impossible task, however utilising a data-flow method and identifying the intended behaviour subset by the values of a set of variables, approximate slices can be obtained. Developers typically use these slices to locate the cause of issues during debugging.
Concurrency Errors
Runtime error detection is used by Parasoft Jtest to discover faults such race situations, exceptions, resource and memory leaks, and security attack vulnerabilities.
In Windows, Intel Inspector analyses run-time threading and memory errors.
Parasoft Insure++ is a memory analysis and error detection programme that runs in the background. Its Inuse component gives you a graphical representation of memory allocations over time, with details on overall heap consumption, block allocations, potential leaks, and so forth.
Thread Sanitizer is a data race detecting tool developed by Google. It uses LLVM IR to record fast memory accesses.
Security Analysis
Security issues can be detected through dynamic analysis.
IBM Rational AppScan is a collection of application security technologies aimed at various phases of the development process. IBM Rational AppScan Standard Edition and IBM Rational AppScan Enterprise Edition are the two main dynamic analysis products in the package. In addition, IBM Rational AppScan Source Edition, a static analysis tool, is included in the suite.
Advantages of Dynamic analysis Tools:
• It detects flaws in a program's runtime environment.
• Automated programmes allow you to choose what you want to scan for.
• It allows you to analyse apps without having access to the source code.
• It finds vulnerabilities that might have been missed via static code analysis.
• It allows you to verify the results of static code analysis.
• It is possible to use it against any application.
Limitations of Dynamic Analysis Tools:
• Automated tools give the misleading impression that everything is being taken care of.
• False positives and false negatives are produced by automated tools.
• The rules that automated tools use to scan with are only as good as the rules that they use to scan with.
• There are insufficiently trained employees to do a complete dynamic code analysis [as with static code analysis].
• It takes longer to track the vulnerability back to the specific spot in the code, making the problem more difficult to address.
Dynamic analysis is the process of testing and evaluating an application while it is running.
Static analysis is the process of testing and evaluating an application by looking at the code rather than running it.
Both dynamically and statically, many software faults that cause memory and threading issues can be recognised. Because no single approach can uncover every inaccuracy, the two approaches are complementary.
The main benefit of dynamic analysis is that it detects minor flaws or vulnerabilities whose causes are too complex to be detected by static analysis. Although dynamic analysis can help with security, its primary objective is to detect and fix flaws.
The main benefit of static analysis is that it looks at all possible execution routes and variable values, not just the ones that are triggered during execution. As a result, static analysis is possible.
Static or dynamic analysis which is better?
Static analysis, with its Whitebox visibility, is unquestionably more complete, and it may also prove more cost-effective due to its ability to uncover flaws early in the software development life cycle. Errors that would not be discovered in a dynamic test can also be discovered via static analysis.
One of the main reasons for the importance of static analysis is that it allows you to properly inspect all of your code without even running it. It is able to find vulnerabilities in even the most remote and unattended areas of the code as a result of this. Another advantage of static code analysis is that it can be tailored to your project's individual requirements, and it facilitates collaboration among the entire development team. It also allows you to detect defects in the early stages of the development cycle, which reduces the overall cost of correcting the problem significantly
What is the Purpose of a Program Analysis?
A program analysis aids the team in understanding the primary restrictions that must be overcome in order for the program to succeed. If underlying limiting factors, flaws, and dangers are not addressed, SBCC projects are at risk of failing. The results of the program analysis help to shape the program/campaign strategy and highlight specific measures that may be implemented to improve the chances of success.
Who Should Perform a Program Analysis?
The program analysis should be carried out by a small, focused team. Research, health/social service, program, and communication workers should all be included. When possible, it's a good idea to bring in stakeholders from outside the program to help with the process and provide an objective viewpoint.
When Should We Conduct a Program Analysis?
After you've completed the circumstance and audience analyses, conduct a program analysis. The information gathered during these studies will be used to inform the program evaluation. Develop an SBCC plan based on the findings.




