ArticleslgStudy

computer science

Dynamic program analysis

Dynamic program analysis is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Dynamic program analysis rather than just read about it. In short: Dynamic program analysis is the act of analyzing software that involves executing a program – as opposed to static program analysis, which does not execute it. Analysis can focus on different aspects of the software including but not limited to: behavior, test coverage, performance and security.

Key takeaways

  • Dynamic program analysis belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Dynamic program analysis to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Dynamic program analysis from memory before moving on to harder problems.

Reference excerpt

Dynamic program analysis is the act of analyzing software that involves executing a program – as opposed to static program analysis, which does not execute it. Analysis can focus on different aspects of the software including but not limited to: behavior, test coverage, performance and security. To be effective, the target program must be executed with sufficient test inputs to address the ranges of possible inputs and outputs. Software testing measures, such as code coverage, and tools such as mutation testing, are used to identify where testing is inadequate.

Types

Functional testing

Functional testing includes relatively common programming techniques such as unit testing, integration testing and system testing.

Code coverage Computing the test code coverage identifies code that is not tested. Although this analysis identifies code that is not tested, it does not determine whether the tested code is adequately tested. Code can be executed even if the tests do not actually verify correct behavior.

Gcov is the GNU source code coverage program. VB Watch injects dynamic analysis code into Visual Basic programs to monitor code coverage, the call stack, execution trace, instantiated objects, and variables.

Dynamic testing

Dynamic testing involves executing a program on a set of test cases.

Memory error detection AddressSanitizer: Memory error detection for Linux, macOS, Windows, and more. Part of LLVM. BoundsChecker: Memory error detection for Windows based applications. Part of Micro Focus DevPartner. Dmalloc: Library for checking memory allocation and leaks. Software must be recompiled, and all files must include the special C header file dmalloc.h. Intel Inspector: Dynamic memory error debugger for C, C++, and Fortran applications that run on Windows and Linux. Purify: Mainly memory corruption detection and memory leak detection. Valgrind: Runs programs on a virtual processor and can detect memory errors (e.g., misuse of malloc and free) and race conditions in multithread programs.

Fuzzing

Fuzzing is a testing technique that involves executing a program on a wide variety of inputs; often, these inputs are randomly generated (at least in part). Gray-box fuzzers use code coverage to guide input generation.

Dynamic symbolic execution

Dynamic symbolic execution (also known as DSE or concolic execution) involves executing a test program on a concrete input, collecting the path constraints associated with the execution, and using a constraint solver (generally, an SMT solver) to generate new inputs that would cause the program to take a different control-flow path, thus increasing code coverage of the test suite. DSE can be considered a type of fuzzing ("white-box" fuzzing).

Dynamic data-flow analysis Dynamic data-flow analysis tracks the flow of information from sources to sinks. Forms of dynamic data-flow analysis include dynamic taint analysis and even dynamic symbolic execution.

Invariant inference Daikon is an implementation of dynamic invariant detection. Daikon runs a program, observes the values the program computes, and then reports properties that were true during the observed executions and are thus likely true over all executions.

Security analysis Dynamic analysis can be used to detect security problems.

IBM Rational AppScan is a suite of application security solutions targeted for different stages of the development lifecycle. The suite includes two main dynamic analysis products: IBM Rational AppScan Standard Edition and IBM Rational AppScan Enterprise Edition. In addition, the suite includes IBM Rational AppScan Source Edition—a static analysis tool.

Concurrency errors Parasoft Jtest uses runtime error detection to expose defects such as race conditions, exceptions, resource and memory leaks, and security attack vulnerabilities. Intel Inspector performs run-time threading and memory error analysis in Windows. Parasoft Insure++ is a runtime memory analysis and error detection tool. Its Inuse component provides a graphical view of memory allocations over time, with specific visibility of overall heap usage, block allocations, possible outstanding leaks, etc. Google's Thread Sanitizer is a data race detection tool. It instruments LLVM IR to capture racy memory accesses.

Program slicing

For a given subset of a program’s behavior, program slicing consists of reducing the program to the minimum form that still produces the selected behavior. The reduced program is called a “slice” and is a faithful representation of the original program within the domain of the specified behavior subset. Generally, finding a slice is an unsolvable problem, but by specifying the target behavior subset based on the values of a set of variables, it is possible to obtain approximate slices using a data-flow algorithm. These slices are usually used by developers during debugging to locate the source of errors.

Performance analysis Most performance analysis tools use dynamic program analysis techniques.

Techniques Most dynamic analysis involves instrumentation or transformation. Since instrumentation can affect runtime performance, interpretation of test results must account for this to avoid misidentifying a performance problem.

Examples DynInst is a runtime code-patching library useful for developing dynamic program analysis probes and applying them to compiled executables. Dyninst does not require source code or recompilation in general; however, non-stripped executables and executables with debugging symbols are easier to instrument. Iroh.js is a runtime code analysis library for JavaScript. It keeps track of the code execution path, provides runtime listeners to detect specific executed code patterns and allows interception and manipulation of the program's execution behavior.

See also Abstract interpretation Daikon Dynamic load testing Profiling (computer programming) Runtime verification Program analysis (computer science) Static code analysis Time Partition Testing

References

Worked examples

Example 1 — a first encounter with Dynamic program analysis

Start with the simplest possible case. Write down what Dynamic program analysis claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Dynamic program analysis before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Dynamic program analysis ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Dynamic program analysis

In research
Dynamic program analysis appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Dynamic program analysis in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Dynamic program analysis is common in secondary-school and first-year university syllabi. It links to neighbouring topics Dynamic program analysis, Program analysis, Software testing, so understanding it makes those chapters shorter.
In everyday life
Look for Dynamic program analysis outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Dynamic program analysis” →

How to study Dynamic program analysis in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Dynamic program analysis means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Dynamic program analysis out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Dynamic program analysis in simple terms?

Dynamic program analysis is the act of analyzing software that involves executing a program – as opposed to static program analysis, which does not execute it. Analysis can focus on different aspects of the software including but not limited to: behavior, test coverage, performance and security.

Why does Dynamic program analysis matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Dynamic program analysis?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Dynamic program analysis.

Tags

  • Dynamic program analysis
  • Program analysis
  • Software testing

Keep exploring