[Lldb-commits] [lldb] [LLDB] Add a StackFrameRecognizer for the Darwin specific abort_with_payload… (PR #101365)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 31 14:16:31 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};
----------------
jimingham wrote:

That was a left-over from when I thought I was going to match abort_with_payload and _abort_with_reason, but they don't really work as well, since when you stop you WILL be at the beginning of `__abort_with_payload` so arguments are still in registers, which is not true of the public functions.  I don't need the array at all.

https://github.com/llvm/llvm-project/pull/101365


More information about the lldb-commits mailing list