@@ -96,7 +96,7 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
96
96
using AtomType = uint16_t ;
97
97
using Form = dwarf::Form;
98
98
99
- uint32_t DIEOffsetBase;
99
+ uint64_t DIEOffsetBase;
100
100
SmallVector<std::pair<AtomType, Form>, 3 > Atoms;
101
101
102
102
Optional<uint64_t > extractOffset (Optional<DWARFFormValue> Value) const ;
@@ -109,7 +109,7 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
109
109
// / Returns true if we should continue scanning for entries or false if we've
110
110
// / reached the last (sentinel) entry of encountered a parsing error.
111
111
bool dumpName (ScopedPrinter &W, SmallVectorImpl<DWARFFormValue> &AtomForms,
112
- uint32_t *DataOffset) const ;
112
+ uint64_t *DataOffset) const ;
113
113
114
114
public:
115
115
// / Apple-specific implementation of an Accelerator Entry.
@@ -119,7 +119,7 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
119
119
Entry (const HeaderData &Data);
120
120
Entry () = default ;
121
121
122
- void extract (const AppleAcceleratorTable &AccelTable, uint32_t *Offset);
122
+ void extract (const AppleAcceleratorTable &AccelTable, uint64_t *Offset);
123
123
124
124
public:
125
125
Optional<uint64_t > getCUOffset () const override ;
@@ -143,15 +143,15 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
143
143
class ValueIterator : public std ::iterator<std::input_iterator_tag, Entry> {
144
144
const AppleAcceleratorTable *AccelTable = nullptr ;
145
145
Entry Current; // /< The current entry.
146
- unsigned DataOffset = 0 ; // /< Offset into the section.
146
+ uint64_t DataOffset = 0 ; // /< Offset into the section.
147
147
unsigned Data = 0 ; // /< Current data entry.
148
148
unsigned NumData = 0 ; // /< Number of data entries.
149
149
150
150
// / Advance the iterator.
151
151
void Next ();
152
152
public:
153
153
// / Construct a new iterator for the entries at \p DataOffset.
154
- ValueIterator (const AppleAcceleratorTable &AccelTable, unsigned DataOffset);
154
+ ValueIterator (const AppleAcceleratorTable &AccelTable, uint64_t DataOffset);
155
155
// / End marker.
156
156
ValueIterator () = default ;
157
157
@@ -193,7 +193,7 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
193
193
// / DieOffset is the offset into the .debug_info section for the DIE
194
194
// / related to the input hash data offset.
195
195
// / DieTag is the tag of the DIE
196
- std::pair<uint32_t , dwarf::Tag> readAtoms (uint32_t & HashDataOffset);
196
+ std::pair<uint64_t , dwarf::Tag> readAtoms (uint64_t * HashDataOffset);
197
197
void dump (raw_ostream &OS) const override ;
198
198
199
199
// / Look up all entries in the accelerator table matching \c Key.
@@ -245,7 +245,7 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
245
245
struct Header : public HeaderPOD {
246
246
SmallString<8 > AugmentationString;
247
247
248
- Error extract (const DWARFDataExtractor &AS, uint32_t *Offset);
248
+ Error extract (const DWARFDataExtractor &AS, uint64_t *Offset);
249
249
void dump (ScopedPrinter &W) const ;
250
250
};
251
251
@@ -354,30 +354,30 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
354
354
DataExtractor StrData;
355
355
356
356
uint32_t Index;
357
- uint32_t StringOffset;
358
- uint32_t EntryOffset;
357
+ uint64_t StringOffset;
358
+ uint64_t EntryOffset;
359
359
360
360
public:
361
361
NameTableEntry (const DataExtractor &StrData, uint32_t Index,
362
- uint32_t StringOffset, uint32_t EntryOffset)
362
+ uint64_t StringOffset, uint64_t EntryOffset)
363
363
: StrData(StrData), Index(Index), StringOffset(StringOffset),
364
364
EntryOffset (EntryOffset) {}
365
365
366
366
// / Return the index of this name in the parent Name Index.
367
367
uint32_t getIndex () const { return Index; }
368
368
369
369
// / Returns the offset of the name of the described entities.
370
- uint32_t getStringOffset () const { return StringOffset; }
370
+ uint64_t getStringOffset () const { return StringOffset; }
371
371
372
372
// / Return the string referenced by this name table entry or nullptr if the
373
373
// / string offset is not valid.
374
374
const char *getString () const {
375
- uint32_t Off = StringOffset;
375
+ uint64_t Off = StringOffset;
376
376
return StrData.getCStr (&Off);
377
377
}
378
378
379
379
// / Returns the offset of the first Entry in the list.
380
- uint32_t getEntryOffset () const { return EntryOffset; }
380
+ uint64_t getEntryOffset () const { return EntryOffset; }
381
381
};
382
382
383
383
// / Represents a single accelerator table within the DWARF v5 .debug_names
@@ -389,40 +389,40 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
389
389
390
390
// Base of the whole unit and of various important tables, as offsets from
391
391
// the start of the section.
392
- uint32_t Base;
393
- uint32_t CUsBase;
394
- uint32_t BucketsBase;
395
- uint32_t HashesBase;
396
- uint32_t StringOffsetsBase;
397
- uint32_t EntryOffsetsBase;
398
- uint32_t EntriesBase;
392
+ uint64_t Base;
393
+ uint64_t CUsBase;
394
+ uint64_t BucketsBase;
395
+ uint64_t HashesBase;
396
+ uint64_t StringOffsetsBase;
397
+ uint64_t EntryOffsetsBase;
398
+ uint64_t EntriesBase;
399
399
400
400
void dumpCUs (ScopedPrinter &W) const ;
401
401
void dumpLocalTUs (ScopedPrinter &W) const ;
402
402
void dumpForeignTUs (ScopedPrinter &W) const ;
403
403
void dumpAbbreviations (ScopedPrinter &W) const ;
404
- bool dumpEntry (ScopedPrinter &W, uint32_t *Offset) const ;
404
+ bool dumpEntry (ScopedPrinter &W, uint64_t *Offset) const ;
405
405
void dumpName (ScopedPrinter &W, const NameTableEntry &NTE,
406
406
Optional<uint32_t > Hash) const ;
407
407
void dumpBucket (ScopedPrinter &W, uint32_t Bucket) const ;
408
408
409
- Expected<AttributeEncoding> extractAttributeEncoding (uint32_t *Offset);
409
+ Expected<AttributeEncoding> extractAttributeEncoding (uint64_t *Offset);
410
410
411
411
Expected<std::vector<AttributeEncoding>>
412
- extractAttributeEncodings (uint32_t *Offset);
412
+ extractAttributeEncodings (uint64_t *Offset);
413
413
414
- Expected<Abbrev> extractAbbrev (uint32_t *Offset);
414
+ Expected<Abbrev> extractAbbrev (uint64_t *Offset);
415
415
416
416
public:
417
- NameIndex (const DWARFDebugNames &Section, uint32_t Base)
417
+ NameIndex (const DWARFDebugNames &Section, uint64_t Base)
418
418
: Section(Section), Base(Base) {}
419
419
420
420
// / Reads offset of compilation unit CU. CU is 0-based.
421
- uint32_t getCUOffset (uint32_t CU) const ;
421
+ uint64_t getCUOffset (uint32_t CU) const ;
422
422
uint32_t getCUCount () const { return Hdr.CompUnitCount ; }
423
423
424
424
// / Reads offset of local type unit TU, TU is 0-based.
425
- uint32_t getLocalTUOffset (uint32_t TU) const ;
425
+ uint64_t getLocalTUOffset (uint32_t TU) const ;
426
426
uint32_t getLocalTUCount () const { return Hdr.LocalTypeUnitCount ; }
427
427
428
428
// / Reads signature of foreign type unit TU. TU is 0-based.
@@ -451,6 +451,10 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
451
451
return Abbrevs;
452
452
}
453
453
454
+ Expected<Entry> getEntry (uint64_t *Offset) const ;
455
+
456
+ // A temporarily method to preserve compatibility with existing code.
457
+ // Will be removed when the migration to 64-bit offsets is finished.
454
458
Expected<Entry> getEntry (uint32_t *Offset) const ;
455
459
456
460
// / Look up all entries in this Name Index matching \c Key.
@@ -460,8 +464,8 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
460
464
NameIterator end () const { return NameIterator (this , getNameCount () + 1 ); }
461
465
462
466
Error extract ();
463
- uint32_t getUnitOffset () const { return Base; }
464
- uint32_t getNextUnitOffset () const { return Base + 4 + Hdr.UnitLength ; }
467
+ uint64_t getUnitOffset () const { return Base; }
468
+ uint64_t getNextUnitOffset () const { return Base + 4 + Hdr.UnitLength ; }
465
469
void dump (ScopedPrinter &W) const ;
466
470
467
471
friend class DWARFDebugNames ;
@@ -479,12 +483,12 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
479
483
bool IsLocal;
480
484
481
485
Optional<Entry> CurrentEntry;
482
- unsigned DataOffset = 0 ; // /< Offset into the section.
486
+ uint64_t DataOffset = 0 ; // /< Offset into the section.
483
487
std::string Key; // /< The Key we are searching for.
484
488
Optional<uint32_t > Hash; // /< Hash of Key, if it has been computed.
485
489
486
490
bool getEntryAtCurrentOffset ();
487
- Optional<uint32_t > findEntryOffsetInCurrentIndex ();
491
+ Optional<uint64_t > findEntryOffsetInCurrentIndex ();
488
492
bool findInCurrentIndex ();
489
493
void searchFromStartOfCurrentIndex ();
490
494
void next ();
@@ -572,7 +576,7 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
572
576
573
577
private:
574
578
SmallVector<NameIndex, 0 > NameIndices;
575
- DenseMap<uint32_t , const NameIndex *> CUToNameIndex;
579
+ DenseMap<uint64_t , const NameIndex *> CUToNameIndex;
576
580
577
581
public:
578
582
DWARFDebugNames (const DWARFDataExtractor &AccelSection,
@@ -591,7 +595,7 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
591
595
592
596
// / Return the Name Index covering the compile unit at CUOffset, or nullptr if
593
597
// / there is no Name Index covering that unit.
594
- const NameIndex *getCUNameIndex (uint32_t CUOffset);
598
+ const NameIndex *getCUNameIndex (uint64_t CUOffset);
595
599
};
596
600
597
601
} // end namespace llvm
0 commit comments