[Lldb-commits] [lldb] [llvm] [lldb][DWARF] Replace lldb's DWARFDebugArangeSet with llvm's (PR #110058)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 26 09:50:20 PDT 2024
================
@@ -7,65 +7,45 @@
//===----------------------------------------------------------------------===//
#include "DWARFDebugAranges.h"
-#include "DWARFDebugArangeSet.h"
#include "DWARFUnit.h"
#include "LogChannelDWARF.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Timer.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::plugin::dwarf;
+using llvm::DWARFDebugArangeSet;
// Constructor
DWARFDebugAranges::DWARFDebugAranges() : m_aranges() {}
-// CountArangeDescriptors
-class CountArangeDescriptors {
-public:
- CountArangeDescriptors(uint32_t &count_ref) : count(count_ref) {
- // printf("constructor CountArangeDescriptors()\n");
- }
- void operator()(const DWARFDebugArangeSet &set) {
- count += set.NumDescriptors();
- }
- uint32_t &count;
-};
-
// Extract
void DWARFDebugAranges::extract(const DWARFDataExtractor &debug_aranges_data) {
+ llvm::DWARFDataExtractor llvm_dwarf_data =
+ debug_aranges_data.GetAsLLVMDWARF();
lldb::offset_t offset = 0;
DWARFDebugArangeSet set;
Range range;
- while (debug_aranges_data.ValidOffset(offset)) {
+ while (llvm_dwarf_data.isValidOffset(offset)) {
const lldb::offset_t set_offset = offset;
- if (llvm::Error error = set.extract(debug_aranges_data, &offset)) {
+ if (llvm::Error error = set.extract(llvm_dwarf_data, &offset, nullptr)) {
Log *log = GetLog(DWARFLog::DebugInfo);
LLDB_LOG_ERROR(log, std::move(error),
"DWARFDebugAranges::extract failed to extract "
".debug_aranges set at offset {1:x}: {0}",
set_offset);
- } else {
- const uint32_t num_descriptors = set.NumDescriptors();
- if (num_descriptors > 0) {
- const dw_offset_t cu_offset = set.GetHeader().cu_offset;
-
- for (uint32_t i = 0; i < num_descriptors; ++i) {
- const DWARFDebugArangeSet::Descriptor &descriptor =
- set.GetDescriptorRef(i);
- m_aranges.Append(RangeToDIE::Entry(descriptor.address,
- descriptor.length, cu_offset));
- }
- }
+ set.clear();
+ return;
+ }
+ uint64_t cu_offset = set.getCompileUnitDIEOffset();
----------------
JDevlieghere wrote:
Nit: `const`
https://github.com/llvm/llvm-project/pull/110058
More information about the lldb-commits
mailing list