LLDB: Breakpoints regressed - Web Assembly invoked from WASM C-API in a dynamic library (fix included)
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
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 🙂
Contributor guide
Research direction
Read lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp, focusing on SetJITBreakpoint and ModulesDidLoad, then build LLDB as described. Done means reproducing the WebAssembly C-API/plugin scenario and confirming that breakpoints work again without changing unrelated behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100