[llvm] [BOLT][DWARF][NFC] Refactor GDB Index into a new file (PR #94405)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 17:29:20 PDT 2024
================
@@ -0,0 +1,60 @@
+//===-- bolt/Core/GDBIndex.h - GDB Index support -------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// This file contains declaration of classes required for generation of
+/// .gdb_index section.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef BOLT_CORE_GDB_INDEX_H
+#define BOLT_CORE_GDB_INDEX_H
+
+#include "bolt/Core/BinaryContext.h"
+#include <vector>
+
+namespace llvm {
+namespace bolt {
+
+class GDBIndex {
+public:
+ /// Contains information about TU so we can write out correct entries in GDB
+ /// index.
+ struct GDBIndexTUEntry {
+ uint64_t UnitOffset;
+ uint64_t TypeHash;
+ uint64_t TypeDIERelativeOffset;
+ };
+
+private:
+ BinaryContext &BC;
+
+ /// Entries for GDB Index Types CU List
+ using GDBIndexTUEntryType = std::vector<GDBIndexTUEntry>;
+ GDBIndexTUEntryType GDBIndexTUEntryVector;
+
+public:
+ GDBIndex(BinaryContext &BC) : BC(BC) {}
+
+ /// Adds an GDBIndexTUEntry if .gdb_index section exists.
+ void addGDBTypeUnitEntry(const GDBIndexTUEntry &Entry);
+
+ /// Rewrite .gdb_index section if present.
+ void updateGdbIndexSection(
+ CUOffsetMap &CUMap, uint32_t NumCUs,
+ std::unique_ptr<DebugARangesSectionWriter> &ARangesSectionWriter);
+
+ /// Returns all entries needed for Types CU list
----------------
ayermolo wrote:
Period
https://github.com/llvm/llvm-project/pull/94405
More information about the llvm-commits
mailing list