[Lldb-commits] [lldb] [LLDB] Add a StackFrameRecognizer for the Darwin specific abort_with_payload… (PR #101365)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 31 11:30:16 PDT 2024
================
@@ -0,0 +1,201 @@
+//===-- AbortWithPayloadFrameRecognizer.cpp -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "AbortWithPayloadFrameRecognizer.h"
+
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StructuredData.h"
+
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace lldb_private {
+void RegisterAbortWithPayloadFrameRecognizer(Process *process) {
+ // There are two user-level API's that this recognizer captures,
+ // abort_with_reason and abort_with_payload. But they both call the private
+ // __abort_with_payload, the abort_with_reason call fills in a null payload.
+ static ConstString module_name("libsystem_kernel.dylib");
+ static ConstString sym_name("__abort_with_payload");
+
+ if (!process)
+ return;
+ ConstString sym_arr[1] = {sym_name};
+
+ process->GetTarget().GetFrameRecognizerManager().AddRecognizer(
+ std::make_shared<AbortWithPayloadFrameRecognizer>(), module_name, sym_arr,
----------------
medismailben wrote:
```suggestion
std::make_shared<AbortWithPayloadFrameRecognizer>(), module_name, {sym_name},
```
This should work as well since you're not re-using the array.
https://github.com/llvm/llvm-project/pull/101365
More information about the lldb-commits
mailing list