[all-commits] [llvm/llvm-project] 4bafce: [LLDB] Add ObjectFileWasm plugin for WebAssembly d...

Paolo Severini via All-commits all-commits at lists.llvm.org
Wed Jan 15 16:26:08 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4bafceced6a7641be7b090229c6ccef22cf55bff
      https://github.com/llvm/llvm-project/commit/4bafceced6a7641be7b090229c6ccef22cf55bff
  Author: Paolo Severini <paolosev at microsoft.com>
  Date:   2020-01-15 (Wed, 15 Jan 2020)

  Changed paths:
    M lldb/include/lldb/Utility/ArchSpec.h
    M lldb/source/API/SystemInitializerFull.cpp
    M lldb/source/Plugins/ObjectFile/CMakeLists.txt
    A lldb/source/Plugins/ObjectFile/wasm/CMakeLists.txt
    A lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    A lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
    M lldb/source/Utility/ArchSpec.cpp
    A lldb/test/Shell/ObjectFile/wasm/basic.yaml
    A lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
    A lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
    M lldb/tools/lldb-test/SystemInitializerTest.cpp

  Log Message:
  -----------
  [LLDB] Add ObjectFileWasm plugin for WebAssembly debugging

Summary:
This is the first in a series of patches to enable LLDB debugging of
WebAssembly targets.

Current versions of Clang emit (partial) DWARF debug information in WebAssembly
modules and we can leverage this debug information to give LLDB the ability to
do source-level debugging of Wasm code that runs in a WebAssembly engine.

A way to do this could be to use the remote debugging functionalities provided
by LLDB via the GDB-remote protocol. Remote debugging can indeed be useful not
only to connect a debugger to a process running on a remote machine, but also to
connect the debugger to a managed VM or script engine that runs locally,
provided that the engine implements a GDB-remote stub that offers the ability to
access the engine runtime internal state.

To make this work, the GDB-remote protocol would need to be extended with a few
Wasm-specific custom query commands, used to access aspects of the Wasm engine
state (like the Wasm memory, Wasm local and global variables, and so on).
Furthermore, the DWARF format would need to be enriched with a few Wasm-specific
extensions, here detailed: https://yurydelendik.github.io/webassembly-dwarf.

This CL introduce classes **ObjectFileWasm**, a file plugin to represent a Wasm
module loaded in a debuggee process. It knows how to parse Wasm modules and
store the Code section and the DWARF-specific sections.

Reviewers: jasonmolenda, clayborg, labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71575




More information about the All-commits mailing list