llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/211806.diff


1 Files Affected:

- (modified) lldb/source/Target/StackFrameRecognizer.cpp (+9) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/211806
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to