[Lldb-commits] [lldb] [lldb] Add utility to create Mach-O corefile from YAML desc (PR #153911)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 22 09:48:40 PDT 2025
================
@@ -0,0 +1,55 @@
+//===-- CoreSpec.h --------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef YAML2MACHOCOREFILE_CORESPEC_H
+#define YAML2MACHOCOREFILE_CORESPEC_H
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+struct RegisterNameAndValue {
+ std::string name;
+ uint64_t value;
+};
+
+enum RegisterFlavor { GPR = 0, FPR, EXC };
+
+struct RegisterSet {
+ RegisterFlavor flavor;
+ std::vector<RegisterNameAndValue> registers;
+};
+
+struct Thread {
+ std::vector<RegisterSet> regsets;
+};
+
+enum MemoryType { UInt8 = 0, UInt32, UInt64 };
+
+struct MemoryRegion {
+ uint64_t addr;
+ MemoryType type;
+ uint32_t size;
+ // One of the following formats.
+ std::vector<uint8_t> bytes;
+ std::vector<uint32_t> words;
+ std::vector<uint64_t> doublewords;
----------------
JDevlieghere wrote:
If they're mutually exclusive, you could do:
```suggestion
using Bytes = std::vector<uint8_t>;
using Words = std::vector<uint32_t>;
using Doublewords = std::vector<uint64_t>;
std::variant<Bytes, Words, Doublewords> data;
```
but this might complicate the YAML traits. We do this for protocol messages in DAP and MCP.
https://github.com/llvm/llvm-project/pull/153911
More information about the lldb-commits
mailing list