Skip to content

LLDB: Breakpoints regressed - Web Assembly invoked from WASM C-API in a dynamic library (fix included) #163799

@adv-sw

Description

@adv-sw

What happened : LLDB breakpoints stopped working.
Specific use case example here : https://advance-software.com/develop/#tutorial

Our app invokes Web Asssembly C-API from a plugin (DLL on Windows) - specifically wasmtime runtime.

I've debugged this & the fix is as follows - seems an overly aggressive optimization has been introduced that needs rolling back.

PATCH UPDATED: IsAlive not affecting behaviour so no reason for patch to exclude it.

File: lldb\source\Plugins\JITLoader\GDB\JITLoaderGDB.cpp

Add at the top of the file :
#define WASM_DBG_PATCH 1

a. In JITLoaderGDB::SetJITBreakpoint

#ifndef WASM_DBG_PATCH
if (DidSetJITBreakpoint())
return;
#endif

b. In JITLoaderGDB::ModulesDidLoad

#ifdef WASM_DBG_PATCH
if (m_process->IsAlive())
#else
if (!DidSetJITBreakpoint() && m_process->IsAlive())
#endif

c. Build lldb as normal.

Breakpoints working again 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions