[Lldb-commits] [lldb] 8c9c62d - [lldb] Skip the WebAssembly function header for frame recognizers (#211806)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 24 07:46:50 PDT 2026


Author: Jonas Devlieghere
Date: 2026-07-24T14:46:45Z
New Revision: 8c9c62d0899ce115dcf469c1bcbf694f2b6db774

URL: https://github.com/llvm/llvm-project/commit/8c9c62d0899ce115dcf469c1bcbf694f2b6db774
DIFF: https://github.com/llvm/llvm-project/commit/8c9c62d0899ce115dcf469c1bcbf694f2b6db774.diff

LOG: [lldb] Skip the WebAssembly function header for frame recognizers (#211806)

A frame recognizer restricted to the first instruction matches when the
frame's PC equals the function's start address. On WebAssembly a
function begins with a non-executable local variable header, so the
symbol's start address is never a value the PC can take and such
recognizers never matched.

Route the start address through Architecture::SkipFunctionHeader, which
already maps a function start past this header for breakpoints and
disassembly, so the comparison uses the first executable instruction.

Added: 
    

Modified: 
    lldb/source/Target/StackFrameRecognizer.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/StackFrameRecognizer.cpp b/lldb/source/Target/StackFrameRecognizer.cpp
index 589f3805e3a67..788efff98f06e 100644
--- a/lldb/source/Target/StackFrameRecognizer.cpp
+++ b/lldb/source/Target/StackFrameRecognizer.cpp
@@ -7,11 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Target/StackFrameRecognizer.h"
+#include "lldb/Core/Architecture.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Interpreter/Interfaces/ScriptedStackFrameRecognizerInterface.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/ScriptedMetadata.h"
 
@@ -180,6 +182,13 @@ StackFrameRecognizerManager::GetRecognizerForFrame(StackFrameSP frame) {
   Address start_addr = symbol->GetAddress();
   Address current_addr = frame->GetFrameCodeAddress();
 
+  // The symbol's start address may fall inside a non-executable function
+  // header (as on WebAssembly), which no frame's PC can equal. Compare against
+  // the first instruction instead.
+  if (TargetSP target_sp = frame->CalculateTarget())
+    if (Architecture *arch = target_sp->GetArchitecturePlugin())
+      start_addr = arch->SkipFunctionHeader(start_addr);
+
   for (const auto &entry : m_recognizers) {
     if (!entry.enabled)
       continue;


        


More information about the lldb-commits mailing list