$ show Samsung/jalangi2
Jalangi2 is a JavaScript dynamic analysis and instrumentation framework. It instruments JavaScript source code at the AST level using acorn and esotope, inserting calls to a J$ runtime API that dispatches fine-grained callbacks (getField, putField, read, write, functionEnter, scriptEnter, etc.) to pluggable analysis modules. Analyses can observe and even modify concrete execution, and special support exists for symbolic/concolic exploration via J$.readInput and backtracking. It runs in both Node.js and browsers, supports offline instrumentation, and can instrument live web traffic through a mitmproxy-based proxy. The repository is organized as a library with CLI entry points: src/js/commands/jalangi.js for instrument-and-analyze, src/js/commands/instrument.js and esnstrument_cli.js for standalone instrumentation, and src/js/utils/api.js for programmatic use. The runtime core lives in src/js/runtime/analysis.js, with a rich callback template in analysisCallbackTemplate.js. Sample analyses illustrate dlint-style bug detection, coverage, trace writing, shadow memory, and PLDI'16 research analyses. A large corpus of unit tests, browser harnesses, Tizen apps, and benchmarks (SunSpider, Octane) is bundled to validate instrumentation correctness. Maintenance is light and much of the codebase is visibly legacy: ES5-style code, old dependencies (acorn 7.x, jQuery, mitmproxy-based scripts), vendored 2012-era mobile apps, and dated web APIs. The core instrumentation and runtime abstractions remain instructive and partially reusable, but reuse in a modern JavaScript project would require updating dependencies and adapting to current Node/browser environments.
The LLM identified 5 files worth highlighting for reuse:
Composes multiple independent Jalangi analyses into one analysis object by generating per-callback dispatcher functions. Generic and self-contained; demonstrates a non-obvious way to merge event-driven callback surfaces.
Complete, documented template for the Jalangi analysis callback API. It enumerates all instrumentation callbacks and explains how analyses can observe or modify execution, including backtracking. A developer can copy it as a starting point for new analyses.
Implements a compact trie-based coverage set and a delta-debugging algorithm to minimize test suites based on feature combinations. Self-contained and reusable for any coverage-driven test minimization problem.
Provides shadow objects and stable IDs for program objects and activation frames, enabling object-identity-sensitive analyses. Encapsulates WeakMap/hidden-class object-tagging logic and is usable as a standalone runtime analysis.
Buffered synchronous file tracer with remote WebSocket logging for browser-side tracing and an onflush callback. The buffering and flushing pattern is reusable for any high-volume event log.