Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Kernel Struct GraphNew to Visual Studio Code? Get it now.
Kernel Struct Graph

Kernel Struct Graph

Preview

TATAROSE

|
5 installs
| (0) | Free
Explore C structs and Linux kernel layouts with interactive type maps, source navigation, persistent indexes, and image export.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Kernel Struct Graph

Explore C structures while reading Linux kernel and driver code. Right-click a structure name, variable or member expression and choose View Struct Map to open an interactive graph in VS Code's secondary sidebar.

First public preview · MIT licensed · VS Code 1.106+

PCI driver structure map

The example shows a Linux kernel PCI driver model. Sizes and offsets depend on the selected architecture, generated headers and kernel configuration.

Features

  • Expand embedded structures and pointer member types, including shared and cyclic relationships, and jump to their source definitions.
  • Filter members by name and kind: structures, pointers, callbacks, values, arrays, bitfields and unions.
  • Inspect Clang-derived sizes, alignment, bit offsets and padding.
  • Restore recent reading sessions with their expanded nodes, filters and layout.
  • Build a persistent, configuration-aware type and reverse-reference index.
  • Inspect source evidence for container_of, list ownership, callback bindings, member accesses and bounded argument forwarding across indexed files.
  • Export the current expanded graph as PNG or SVG, or copy it as a PNG image to paste into a document or conversation.

Graph controls currently use Chinese labels; editor and command palette entries use English command names.

Install and open your first map

  1. Install the preview in the environment that contains your source workspace. For a downloaded VSIX, run Extensions: Install from VSIX... and choose the package matching that environment's operating system and CPU.
  2. Provide Python 3.9+ and a Clang driver. The extension bundles libclang 18.1.1 and its Python bindings. Installing from VSIX does not require Node.js, npm, a project virtual environment or a separate pip installation.
  3. Run Kernel Struct Graph: Check Parser Environment to verify the selected Python, native library, Clang headers and a small parsing probe.
  4. Open a .c or .h file. Place the cursor on a structure type, variable or member expression, then right-click View Struct Map.
  5. Click a member's + to expand its target type. Switch between Fields and Memory Layout. Use 导出图片 to save an image or 复制图片 to copy it.

Open Demo Graph provides a clearly labeled, simplified sample without local parsing dependencies. Local source parsing requires a trusted workspace.

Platform packages

Source workspace / extension host Package target
Linux or WSL, Intel / AMD 64-bit linux-x64
Linux, ARM64 linux-arm64
macOS, Intel darwin-x64
macOS, Apple Silicon darwin-arm64

Linux packages target glibc distributions. Windows users can use WSL or a Linux workspace through Remote SSH. When connecting from a Mac or Windows PC to Linux, install the extension in the Linux workspace. A native Windows or Alpine/musl package is not included in this preview.

On Ubuntu / Debian / WSL, install python3 and clang using your package manager. On macOS, install Python 3.9+ and Xcode Command Line Tools. Homebrew Python and LLVM paths are detected automatically; LLVM 18 can be selected when matching builtin headers are needed. Python and the bundled native library must use the same CPU architecture. The environment check explains architecture mismatches.

Public platform packages are gated on native CI and packaged-worker checks. An archive or library-format check alone is not evidence of native execution.

Reading Linux kernel source

Use a configured kernel tree with generated headers and a current compile_commands.json. After building the relevant objects, the kernel's scripts/clang-tools/gen_compile_commands.py can generate the database:

python3 scripts/clang-tools/gen_compile_commands.py -o compile_commands.json

For a header, select a C translation unit and build configuration that includes it. Kbuild dependency records narrow the choices when available. The selected translation unit and CONFIG fingerprint are shown in the graph.

Set kernelStructGraph.compilationDatabasePath when the build database is outside the workspace. Source and include paths must be valid on the machine running the parser. Copying an absolute-path database from another machine does not automatically remap those paths.

An explicit target, cross-compiler name or unambiguous x86 / ARM64 Kbuild context determines the kernel target ABI. If it cannot be determined, set a suitable --target in kernelStructGraph.clangArgs. The extension does not silently use the host Mac ABI for a Linux kernel request.

Analysis and layout boundaries

Compiler errors stop the analysis; warnings remain visible. Incomplete types keep unknown sizes. A layout belongs to its recorded architecture and build configuration, rather than every kernel version or CONFIG.

Relationship reports retain source positions and confidence labels. Callback bindings describe static assignments. Composed argument-flow paths are candidates, limited to direct forwarding and at most eight levels. General pointer aliasing, arbitrary macro internals and complete path-sensitive analysis are outside this preview's coverage. An empty query is not proof of no accesses.

Verify Layout with DWARF or BTF optionally uses pahole to compare an existing matching build artifact. Independent object-symbol checks require a suitable compiler and GNU-style nm. Missing tools or debug information are reported as unavailable, rather than a successful verification. These checks are optional and do not prevent core structure browsing.

Image export and copying preserve the current expansion, filtering, pagination and folded views, including nodes outside the viewport. Other pages and unopened types are not automatically included.

Reports and contributions

For an issue, include the extension version, extension-host OS / CPU, the environment check result, relevant diagnostics and a minimal reproducer where possible. Remove private source and machine-specific information before posting.

See the development guide for commands, settings and local tests, and the changelog for release notes.

License

Project code is licensed under MIT. Bundled dependencies retain their licenses; see third-party notices, including libclang's Apache 2.0 license with LLVM Exceptions.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft