Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DWARFDebugLine.cpp
Go to the documentation of this file.
1//===- DWARFDebugLine.cpp -------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
10#include "llvm/ADT/SmallString.h"
11#include "llvm/ADT/SmallVector.h"
12#include "llvm/ADT/StringRef.h"
13#include "llvm/BinaryFormat/Dwarf.h"
14#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
15#include "llvm/DebugInfo/DWARF/DWARFDie.h"
16#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
17#include "llvm/Support/Errc.h"
18#include "llvm/Support/Format.h"
19#include "llvm/Support/FormatVariadic.h"
20#include "llvm/Support/raw_ostream.h"
21#include <algorithm>
22#include <cassert>
23#include <cinttypes>
24#include <cstdint>
25#include <cstdio>
26#include <utility>
27
28using namespacellvm;
29using namespacedwarf;
30
31usingFileLineInfoKind =DILineInfoSpecifier::FileLineInfoKind;
32
33namespace{
34
35structContentDescriptor {
36dwarf::LineNumberEntryFormatType;
37dwarf::FormForm;
38};
39
40usingContentDescriptors =SmallVector<ContentDescriptor, 4>;
41
42}// end anonymous namespace
43
44staticboolversionIsSupported(uint16_t Version) {
45return Version >= 2 && Version <= 5;
46}
47
48voidDWARFDebugLine::ContentTypeTracker::trackContentType(
49dwarf::LineNumberEntryFormat ContentType) {
50switch (ContentType) {
51case dwarf::DW_LNCT_timestamp:
52HasModTime =true;
53break;
54case dwarf::DW_LNCT_size:
55HasLength =true;
56break;
57case dwarf::DW_LNCT_MD5:
58HasMD5 =true;
59break;
60case dwarf::DW_LNCT_LLVM_source:
61HasSource =true;
62break;
63default:
64// We only care about values we consider optional, and new values may be
65// added in the vendor extension range, so we do not match exhaustively.
66break;
67 }
68}
69
70DWARFDebugLine::Prologue::Prologue() { clear(); }
71
72boolDWARFDebugLine::Prologue::hasFileAtIndex(uint64_t FileIndex) const{
73uint16_t DwarfVersion = getVersion();
74assert(DwarfVersion != 0 &&
75"line table prologue has no dwarf version information");
76if (DwarfVersion >= 5)
77return FileIndex < FileNames.size();
78return FileIndex != 0 && FileIndex <= FileNames.size();
79}
80
81std::optional<uint64_t>
82DWARFDebugLine::Prologue::getLastValidFileIndex() const{
83if (FileNames.empty())
84return std::nullopt;
85uint16_t DwarfVersion = getVersion();
86assert(DwarfVersion != 0 &&
87"line table prologue has no dwarf version information");
88// In DWARF v5 the file names are 0-indexed.
89if (DwarfVersion >= 5)
90return FileNames.size() - 1;
91return FileNames.size();
92}
93
94constllvm::DWARFDebugLine::FileNameEntry &
95DWARFDebugLine::Prologue::getFileNameEntry(uint64_tIndex) const{
96uint16_t DwarfVersion = getVersion();
97assert(DwarfVersion != 0 &&
98"line table prologue has no dwarf version information");
99// In DWARF v5 the file names are 0-indexed.
100if (DwarfVersion >= 5)
101return FileNames[Index];
102return FileNames[Index - 1];
103}
104
105voidDWARFDebugLine::Prologue::clear() {
106 TotalLength = PrologueLength = 0;
107 SegSelectorSize = 0;
108 MinInstLength = MaxOpsPerInst = DefaultIsStmt = LineBase = LineRange = 0;
109 OpcodeBase = 0;
110FormParams =dwarf::FormParams({0, 0,DWARF32});
111 ContentTypes =ContentTypeTracker();
112 StandardOpcodeLengths.clear();
113 IncludeDirectories.clear();
114 FileNames.clear();
115}
116
117voidDWARFDebugLine::Prologue::dump(raw_ostream &OS,
118DIDumpOptions DumpOptions) const{
119if (!totalLengthIsValid())
120return;
121int OffsetDumpWidth = 2 *dwarf::getDwarfOffsetByteSize(FormParams.Format);
122OS <<"Line table prologue:\n"
123 <<format(" total_length: 0x%0*" PRIx64"\n", OffsetDumpWidth,
124 TotalLength)
125 <<" format: " <<dwarf::FormatString(FormParams.Format) <<"\n"
126 <<format(" version: %u\n", getVersion());
127if (!versionIsSupported(getVersion()))
128return;
129if (getVersion() >= 5)
130OS <<format(" address_size: %u\n", getAddressSize())
131 <<format(" seg_select_size: %u\n", SegSelectorSize);
132OS <<format(" prologue_length: 0x%0*" PRIx64"\n", OffsetDumpWidth,
133 PrologueLength)
134 <<format(" min_inst_length: %u\n", MinInstLength)
135 <<format(getVersion() >= 4 ?"max_ops_per_inst: %u\n" :"", MaxOpsPerInst)
136 <<format(" default_is_stmt: %u\n", DefaultIsStmt)
137 <<format(" line_base: %i\n", LineBase)
138 <<format(" line_range: %u\n", LineRange)
139 <<format(" opcode_base: %u\n", OpcodeBase);
140
141for (uint32_tI = 0;I != StandardOpcodeLengths.size(); ++I)
142OS <<formatv("standard_opcode_lengths[{0}] = {1}\n",
143static_cast<dwarf::LineNumberOps>(I + 1),
144 StandardOpcodeLengths[I]);
145
146if (!IncludeDirectories.empty()) {
147// DWARF v5 starts directory indexes at 0.
148uint32_t DirBase = getVersion() >= 5 ? 0 : 1;
149for (uint32_tI = 0;I != IncludeDirectories.size(); ++I) {
150OS <<format("include_directories[%3u] = ",I + DirBase);
151 IncludeDirectories[I].dump(OS, DumpOptions);
152OS <<'\n';
153 }
154 }
155
156if (!FileNames.empty()) {
157// DWARF v5 starts file indexes at 0.
158uint32_t FileBase = getVersion() >= 5 ? 0 : 1;
159for (uint32_tI = 0;I != FileNames.size(); ++I) {
160constFileNameEntry &FileEntry = FileNames[I];
161OS <<format("file_names[%3u]:\n",I + FileBase);
162OS <<" name: ";
163 FileEntry.Name.dump(OS, DumpOptions);
164OS <<'\n' <<format(" dir_index: %" PRIu64"\n", FileEntry.DirIdx);
165if (ContentTypes.HasMD5)
166OS <<" md5_checksum: " << FileEntry.Checksum.digest() <<'\n';
167if (ContentTypes.HasModTime)
168OS <<format(" mod_time: 0x%8.8" PRIx64"\n", FileEntry.ModTime);
169if (ContentTypes.HasLength)
170OS <<format(" length: 0x%8.8" PRIx64"\n", FileEntry.Length);
171if (ContentTypes.HasSource) {
172auto Source = FileEntry.Source.getAsCString();
173if (!Source)
174consumeError(Source.takeError());
175elseif ((*Source)[0]) {
176OS <<" source: ";
177 FileEntry.Source.dump(OS, DumpOptions);
178OS <<'\n';
179 }
180 }
181 }
182 }
183}
184
185// Parse v2-v4 directory and file tables.
186staticError
187parseV2DirFileTables(constDWARFDataExtractor &DebugLineData,
188uint64_t *OffsetPtr,
189DWARFDebugLine::ContentTypeTracker &ContentTypes,
190 std::vector<DWARFFormValue> &IncludeDirectories,
191 std::vector<DWARFDebugLine::FileNameEntry> &FileNames) {
192while (true) {
193Error Err =Error::success();
194StringRef S = DebugLineData.getCStrRef(OffsetPtr, &Err);
195if (Err) {
196consumeError(std::move(Err));
197returncreateStringError(errc::invalid_argument,
198"include directories table was not null "
199"terminated before the end of the prologue");
200 }
201if (S.empty())
202break;
203DWARFFormValue Dir =
204DWARFFormValue::createFromPValue(dwarf::DW_FORM_string, S.data());
205 IncludeDirectories.push_back(Dir);
206 }
207
208 ContentTypes.HasModTime =true;
209 ContentTypes.HasLength =true;
210
211while (true) {
212Error Err =Error::success();
213StringRefName = DebugLineData.getCStrRef(OffsetPtr, &Err);
214if (!Err &&Name.empty())
215break;
216
217DWARFDebugLine::FileNameEntry FileEntry;
218 FileEntry.Name =
219DWARFFormValue::createFromPValue(dwarf::DW_FORM_string,Name.data());
220 FileEntry.DirIdx = DebugLineData.getULEB128(OffsetPtr, &Err);
221 FileEntry.ModTime = DebugLineData.getULEB128(OffsetPtr, &Err);
222 FileEntry.Length = DebugLineData.getULEB128(OffsetPtr, &Err);
223
224if (Err) {
225consumeError(std::move(Err));
226returncreateStringError(
227errc::invalid_argument,
228"file names table was not null terminated before "
229"the end of the prologue");
230 }
231 FileNames.push_back(FileEntry);
232 }
233
234returnError::success();
235}
236
237// Parse v5 directory/file entry content descriptions.
238// Returns the descriptors, or an error if we did not find a path or ran off
239// the end of the prologue.
240staticllvm::Expected<ContentDescriptors>
241parseV5EntryFormat(constDWARFDataExtractor &DebugLineData,uint64_t *OffsetPtr,
242DWARFDebugLine::ContentTypeTracker *ContentTypes) {
243Error Err =Error::success();
244 ContentDescriptors Descriptors;
245int FormatCount = DebugLineData.getU8(OffsetPtr, &Err);
246bool HasPath =false;
247for (intI = 0;I != FormatCount && !Err; ++I) {
248 ContentDescriptor Descriptor;
249 Descriptor.Type =
250dwarf::LineNumberEntryFormat(DebugLineData.getULEB128(OffsetPtr, &Err));
251 Descriptor.Form =dwarf::Form(DebugLineData.getULEB128(OffsetPtr, &Err));
252if (Descriptor.Type == dwarf::DW_LNCT_path)
253 HasPath =true;
254if (ContentTypes)
255 ContentTypes->trackContentType(Descriptor.Type);
256 Descriptors.push_back(Descriptor);
257 }
258
259if (Err)
260returncreateStringError(errc::invalid_argument,
261"failed to parse entry content descriptors: %s",
262toString(std::move(Err)).c_str());
263
264if (!HasPath)
265returncreateStringError(errc::invalid_argument,
266"failed to parse entry content descriptions"
267" because no path was found");
268return Descriptors;
269}
270
271staticError
272parseV5DirFileTables(constDWARFDataExtractor &DebugLineData,
273uint64_t *OffsetPtr,constdwarf::FormParams &FormParams,
274constDWARFContext &Ctx,constDWARFUnit *U,
275DWARFDebugLine::ContentTypeTracker &ContentTypes,
276 std::vector<DWARFFormValue> &IncludeDirectories,
277 std::vector<DWARFDebugLine::FileNameEntry> &FileNames) {
278// Get the directory entry description.
279llvm::Expected<ContentDescriptors> DirDescriptors =
280parseV5EntryFormat(DebugLineData, OffsetPtr,nullptr);
281if (!DirDescriptors)
282return DirDescriptors.takeError();
283
284// Get the directory entries, according to the format described above.
285uint64_t DirEntryCount = DebugLineData.getULEB128(OffsetPtr);
286for (uint64_tI = 0;I != DirEntryCount; ++I) {
287for (auto Descriptor : *DirDescriptors) {
288DWARFFormValueValue(Descriptor.Form);
289switch (Descriptor.Type) {
290case DW_LNCT_path:
291if (!Value.extractValue(DebugLineData, OffsetPtr,FormParams, &Ctx, U))
292returncreateStringError(errc::invalid_argument,
293"failed to parse directory entry because "
294"extracting the form value failed");
295 IncludeDirectories.push_back(Value);
296break;
297default:
298if (!Value.skipValue(DebugLineData, OffsetPtr,FormParams))
299returncreateStringError(errc::invalid_argument,
300"failed to parse directory entry because "
301"skipping the form value failed");
302 }
303 }
304 }
305
306// Get the file entry description.
307llvm::Expected<ContentDescriptors> FileDescriptors =
308parseV5EntryFormat(DebugLineData, OffsetPtr, &ContentTypes);
309if (!FileDescriptors)
310return FileDescriptors.takeError();
311
312// Get the file entries, according to the format described above.
313uint64_t FileEntryCount = DebugLineData.getULEB128(OffsetPtr);
314for (uint64_tI = 0;I != FileEntryCount; ++I) {
315DWARFDebugLine::FileNameEntry FileEntry;
316for (auto Descriptor : *FileDescriptors) {
317DWARFFormValueValue(Descriptor.Form);
318if (!Value.extractValue(DebugLineData, OffsetPtr,FormParams, &Ctx, U))
319returncreateStringError(errc::invalid_argument,
320"failed to parse file entry because "
321"extracting the form value failed");
322switch (Descriptor.Type) {
323case DW_LNCT_path:
324 FileEntry.Name =Value;
325break;
326case DW_LNCT_LLVM_source:
327 FileEntry.Source =Value;
328break;
329case DW_LNCT_directory_index:
330 FileEntry.DirIdx = *Value.getAsUnsignedConstant();
331break;
332case DW_LNCT_timestamp:
333 FileEntry.ModTime = *Value.getAsUnsignedConstant();
334break;
335case DW_LNCT_size:
336 FileEntry.Length = *Value.getAsUnsignedConstant();
337break;
338case DW_LNCT_MD5:
339if (!Value.getAsBlock() ||Value.getAsBlock()->size() != 16)
340returncreateStringError(
341errc::invalid_argument,
342"failed to parse file entry because the MD5 hash is invalid");
343 std::uninitialized_copy_n(Value.getAsBlock()->begin(), 16,
344 FileEntry.Checksum.begin());
345break;
346default:
347break;
348 }
349 }
350 FileNames.push_back(FileEntry);
351 }
352returnError::success();
353}
354
355uint64_tDWARFDebugLine::Prologue::getLength() const{
356uint64_tLength = PrologueLength + sizeofTotalLength() +
357sizeof(getVersion()) + sizeofPrologueLength();
358if (getVersion() >= 5)
359Length += 2;// Address + Segment selector sizes.
360returnLength;
361}
362
363ErrorDWARFDebugLine::Prologue::parse(
364DWARFDataExtractor DebugLineData,uint64_t *OffsetPtr,
365function_ref<void(Error)> RecoverableErrorHandler,constDWARFContext &Ctx,
366constDWARFUnit *U) {
367constuint64_t PrologueOffset = *OffsetPtr;
368
369 clear();
370DataExtractor::Cursor Cursor(*OffsetPtr);
371 std::tie(TotalLength,FormParams.Format) =
372 DebugLineData.getInitialLength(Cursor);
373
374 DebugLineData =
375DWARFDataExtractor(DebugLineData, Cursor.tell() + TotalLength);
376FormParams.Version = DebugLineData.getU16(Cursor);
377if (Cursor && !versionIsSupported(getVersion())) {
378// Treat this error as unrecoverable - we cannot be sure what any of
379// the data represents including the length field, so cannot skip it or make
380// any reasonable assumptions.
381 *OffsetPtr = Cursor.tell();
382returncreateStringError(
383errc::not_supported,
384"parsing line table prologue at offset 0x%8.8" PRIx64
385": unsupported version %" PRIu16,
386 PrologueOffset, getVersion());
387 }
388
389if (getVersion() >= 5) {
390FormParams.AddrSize = DebugLineData.getU8(Cursor);
391constuint8_t DataAddrSize = DebugLineData.getAddressSize();
392constuint8_t PrologueAddrSize = getAddressSize();
393if (Cursor) {
394if (DataAddrSize == 0) {
395if (PrologueAddrSize != 4 && PrologueAddrSize != 8) {
396 RecoverableErrorHandler(createStringError(
397errc::not_supported,
398"parsing line table prologue at offset 0x%8.8" PRIx64
399": invalid address size %" PRIu8,
400 PrologueOffset, PrologueAddrSize));
401 }
402 }elseif (DataAddrSize != PrologueAddrSize) {
403 RecoverableErrorHandler(createStringError(
404errc::not_supported,
405"parsing line table prologue at offset 0x%8.8" PRIx64": address "
406"size %" PRIu8" doesn't match architecture address size %" PRIu8,
407 PrologueOffset, PrologueAddrSize, DataAddrSize));
408 }
409 }
410 SegSelectorSize = DebugLineData.getU8(Cursor);
411 }
412
413 PrologueLength =
414 DebugLineData.getRelocatedValue(Cursor, sizeofPrologueLength());
415constuint64_t EndPrologueOffset = PrologueLength + Cursor.tell();
416 DebugLineData =DWARFDataExtractor(DebugLineData, EndPrologueOffset);
417 MinInstLength = DebugLineData.getU8(Cursor);
418if (getVersion() >= 4)
419 MaxOpsPerInst = DebugLineData.getU8(Cursor);
420 DefaultIsStmt = DebugLineData.getU8(Cursor);
421 LineBase = DebugLineData.getU8(Cursor);
422 LineRange = DebugLineData.getU8(Cursor);
423 OpcodeBase = DebugLineData.getU8(Cursor);
424
425if (Cursor && OpcodeBase == 0) {
426// If the opcode base is 0, we cannot read the standard opcode lengths (of
427// which there are supposed to be one fewer than the opcode base). Assume
428// there are no standard opcodes and continue parsing.
429 RecoverableErrorHandler(createStringError(
430errc::invalid_argument,
431"parsing line table prologue at offset 0x%8.8" PRIx64
432" found opcode base of 0. Assuming no standard opcodes",
433 PrologueOffset));
434 }elseif (Cursor) {
435 StandardOpcodeLengths.reserve(OpcodeBase - 1);
436for (uint32_tI = 1;I < OpcodeBase; ++I) {
437uint8_t OpLen = DebugLineData.getU8(Cursor);
438 StandardOpcodeLengths.push_back(OpLen);
439 }
440 }
441
442 *OffsetPtr = Cursor.tell();
443// A corrupt file name or directory table does not prevent interpretation of
444// the main line program, so check the cursor state now so that its errors can
445// be handled separately.
446if (!Cursor)
447returncreateStringError(
448errc::invalid_argument,
449"parsing line table prologue at offset 0x%8.8" PRIx64": %s",
450 PrologueOffset,toString(Cursor.takeError()).c_str());
451
452Error E =
453 getVersion() >= 5
454 ?parseV5DirFileTables(DebugLineData, OffsetPtr,FormParams, Ctx, U,
455 ContentTypes, IncludeDirectories, FileNames)
456 :parseV2DirFileTables(DebugLineData, OffsetPtr, ContentTypes,
457 IncludeDirectories, FileNames);
458if (E) {
459 RecoverableErrorHandler(joinErrors(
460createStringError(
461errc::invalid_argument,
462"parsing line table prologue at 0x%8.8" PRIx64
463" found an invalid directory or file table description at"
464" 0x%8.8" PRIx64,
465 PrologueOffset, *OffsetPtr),
466 std::move(E)));
467returnError::success();
468 }
469
470assert(*OffsetPtr <= EndPrologueOffset);
471if (*OffsetPtr != EndPrologueOffset) {
472 RecoverableErrorHandler(createStringError(
473errc::invalid_argument,
474"unknown data in line table prologue at offset 0x%8.8" PRIx64
475": parsing ended (at offset 0x%8.8" PRIx64
476") before reaching the prologue end at offset 0x%8.8" PRIx64,
477 PrologueOffset, *OffsetPtr, EndPrologueOffset));
478 }
479returnError::success();
480}
481
482DWARFDebugLine::Row::Row(bool DefaultIsStmt) { reset(DefaultIsStmt); }
483
484voidDWARFDebugLine::Row::postAppend() {
485 Discriminator = 0;
486BasicBlock =false;
487 PrologueEnd =false;
488 EpilogueBegin =false;
489}
490
491voidDWARFDebugLine::Row::reset(bool DefaultIsStmt) {
492Address.Address = 0;
493Address.SectionIndex =object::SectionedAddress::UndefSection;
494 Line = 1;
495 Column = 0;
496 File = 1;
497 Isa = 0;
498 Discriminator = 0;
499 IsStmt = DefaultIsStmt;
500OpIndex = 0;
501BasicBlock =false;
502EndSequence =false;
503 PrologueEnd =false;
504 EpilogueBegin =false;
505}
506
507voidDWARFDebugLine::Row::dumpTableHeader(raw_ostream &OS,unsigned Indent) {
508OS.indent(Indent)
509 <<"Address Line Column File ISA Discriminator OpIndex "
510"Flags\n";
511OS.indent(Indent)
512 <<"------------------ ------ ------ ------ --- ------------- ------- "
513"-------------\n";
514}
515
516voidDWARFDebugLine::Row::dump(raw_ostream &OS) const{
517OS <<format("0x%16.16" PRIx64" %6u %6u",Address.Address, Line, Column)
518 <<format(" %6u %3u %13u %7u ", File, Isa, Discriminator,OpIndex)
519 << (IsStmt ?" is_stmt" :"") << (BasicBlock ?" basic_block" :"")
520 << (PrologueEnd ?" prologue_end" :"")
521 << (EpilogueBegin ?" epilogue_begin" :"")
522 << (EndSequence ?" end_sequence" :"") <<'\n';
523}
524
525DWARFDebugLine::Sequence::Sequence() { reset(); }
526
527voidDWARFDebugLine::Sequence::reset() {
528 LowPC = 0;
529 HighPC = 0;
530 SectionIndex =object::SectionedAddress::UndefSection;
531 FirstRowIndex = 0;
532 LastRowIndex = 0;
533 Empty =true;
534}
535
536DWARFDebugLine::LineTable::LineTable() { clear(); }
537
538voidDWARFDebugLine::LineTable::dump(raw_ostream &OS,
539DIDumpOptions DumpOptions) const{
540Prologue.dump(OS, DumpOptions);
541
542if (!Rows.empty()) {
543OS <<'\n';
544Row::dumpTableHeader(OS, 0);
545for (constRow &R : Rows) {
546 R.dump(OS);
547 }
548 }
549
550// Terminate the table with a final blank line to clearly delineate it from
551// later dumps.
552OS <<'\n';
553}
554
555voidDWARFDebugLine::LineTable::clear() {
556Prologue.clear();
557 Rows.clear();
558 Sequences.clear();
559}
560
561DWARFDebugLine::ParsingState::ParsingState(
562structLineTable *LT,uint64_t TableOffset,
563function_ref<void(Error)>ErrorHandler)
564 :LineTable(LT), LineTableOffset(TableOffset),ErrorHandler(ErrorHandler) {
565 resetRowAndSequence();
566}
567
568void DWARFDebugLine::ParsingState::resetRowAndSequence() {
569 Row.reset(LineTable->Prologue.DefaultIsStmt);
570 Sequence.reset();
571}
572
573void DWARFDebugLine::ParsingState::appendRowToMatrix() {
574unsigned RowNumber = LineTable->Rows.size();
575if (Sequence.Empty) {
576// Record the beginning of instruction sequence.
577 Sequence.Empty =false;
578 Sequence.LowPC = Row.Address.Address;
579 Sequence.FirstRowIndex = RowNumber;
580 }
581 LineTable->appendRow(Row);
582if (Row.EndSequence) {
583// Record the end of instruction sequence.
584Sequence.HighPC = Row.Address.Address;
585Sequence.LastRowIndex = RowNumber + 1;
586Sequence.SectionIndex = Row.Address.SectionIndex;
587if (Sequence.isValid())
588 LineTable->appendSequence(Sequence);
589Sequence.reset();
590 }
591 Row.postAppend();
592}
593
594constDWARFDebugLine::LineTable *
595DWARFDebugLine::getLineTable(uint64_tOffset) const{
596 LineTableConstIter Pos = LineTableMap.find(Offset);
597if (Pos != LineTableMap.end())
598return &Pos->second;
599returnnullptr;
600}
601
602Expected<const DWARFDebugLine::LineTable *>DWARFDebugLine::getOrParseLineTable(
603DWARFDataExtractor &DebugLineData,uint64_tOffset,constDWARFContext &Ctx,
604constDWARFUnit *U,function_ref<void(Error)> RecoverableErrorHandler) {
605if (!DebugLineData.isValidOffset(Offset))
606returncreateStringError(errc::invalid_argument,
607"offset 0x%8.8" PRIx64
608" is not a valid debug line section offset",
609Offset);
610
611 std::pair<LineTableIter, bool> Pos =
612 LineTableMap.insert(LineTableMapTy::value_type(Offset,LineTable()));
613LineTable *LT = &Pos.first->second;
614if (Pos.second) {
615if (Error Err =
616 LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorHandler))
617return std::move(Err);
618return LT;
619 }
620return LT;
621}
622
623voidDWARFDebugLine::clearLineTable(uint64_tOffset) {
624 LineTableMap.erase(Offset);
625}
626
627staticStringRefgetOpcodeName(uint8_t Opcode,uint8_t OpcodeBase) {
628assert(Opcode != 0);
629if (Opcode < OpcodeBase)
630returnLNStandardString(Opcode);
631return"special";
632}
633
634DWARFDebugLine::ParsingState::AddrOpIndexDelta
635DWARFDebugLine::ParsingState::advanceAddrOpIndex(uint64_t OperationAdvance,
636uint8_t Opcode,
637uint64_t OpcodeOffset) {
638StringRef OpcodeName =getOpcodeName(Opcode, LineTable->Prologue.OpcodeBase);
639// For versions less than 4, the MaxOpsPerInst member is set to 0, as the
640// maximum_operations_per_instruction field wasn't introduced until DWARFv4.
641// Don't warn about bad values in this situation.
642if (ReportAdvanceAddrProblem && LineTable->Prologue.getVersion() >= 4 &&
643 LineTable->Prologue.MaxOpsPerInst == 0)
644ErrorHandler(createStringError(
645errc::invalid_argument,
646"line table program at offset 0x%8.8" PRIx64
647" contains a %s opcode at offset 0x%8.8" PRIx64
648", but the prologue maximum_operations_per_instruction value is 0"
649", which is invalid. Assuming a value of 1 instead",
650 LineTableOffset, OpcodeName.data(), OpcodeOffset));
651// Although we are able to correctly parse line number programs with
652// MaxOpsPerInst > 1, the rest of DWARFDebugLine and its
653// users have not been updated to handle line information for all operations
654// in a multi-operation instruction, so warn about potentially incorrect
655// results.
656if (ReportAdvanceAddrProblem && LineTable->Prologue.MaxOpsPerInst > 1)
657ErrorHandler(createStringError(
658errc::not_supported,
659"line table program at offset 0x%8.8" PRIx64
660" contains a %s opcode at offset 0x%8.8" PRIx64
661", but the prologue maximum_operations_per_instruction value is %" PRId8
662", which is experimentally supported, so line number information "
663"may be incorrect",
664 LineTableOffset, OpcodeName.data(), OpcodeOffset,
665 LineTable->Prologue.MaxOpsPerInst));
666if (ReportAdvanceAddrProblem && LineTable->Prologue.MinInstLength == 0)
667ErrorHandler(
668createStringError(errc::invalid_argument,
669"line table program at offset 0x%8.8" PRIx64
670" contains a %s opcode at offset 0x%8.8" PRIx64
671", but the prologue minimum_instruction_length value "
672"is 0, which prevents any address advancing",
673 LineTableOffset, OpcodeName.data(), OpcodeOffset));
674 ReportAdvanceAddrProblem =false;
675
676// Advances the address and op_index according to DWARFv5, section 6.2.5.1:
677//
678// new address = address +
679// minimum_instruction_length *
680// ((op_index + operation advance) / maximum_operations_per_instruction)
681//
682// new op_index =
683// (op_index + operation advance) % maximum_operations_per_instruction
684
685// For versions less than 4, the MaxOpsPerInst member is set to 0, as the
686// maximum_operations_per_instruction field wasn't introduced until DWARFv4.
687uint8_t MaxOpsPerInst =
688 std::max(LineTable->Prologue.MaxOpsPerInst,uint8_t{1});
689
690uint64_t AddrOffset = ((Row.OpIndex + OperationAdvance) / MaxOpsPerInst) *
691 LineTable->Prologue.MinInstLength;
692 Row.Address.Address += AddrOffset;
693
694uint8_t PrevOpIndex = Row.OpIndex;
695 Row.OpIndex = (Row.OpIndex + OperationAdvance) % MaxOpsPerInst;
696 int16_t OpIndexDelta =static_cast<int16_t>(Row.OpIndex) - PrevOpIndex;
697
698return {AddrOffset, OpIndexDelta};
699}
700
701DWARFDebugLine::ParsingState::OpcodeAdvanceResults
702DWARFDebugLine::ParsingState::advanceForOpcode(uint8_t Opcode,
703uint64_t OpcodeOffset) {
704assert(Opcode == DW_LNS_const_add_pc ||
705 Opcode >= LineTable->Prologue.OpcodeBase);
706if (ReportBadLineRange && LineTable->Prologue.LineRange == 0) {
707StringRef OpcodeName =
708getOpcodeName(Opcode, LineTable->Prologue.OpcodeBase);
709ErrorHandler(
710createStringError(errc::not_supported,
711"line table program at offset 0x%8.8" PRIx64
712" contains a %s opcode at offset 0x%8.8" PRIx64
713", but the prologue line_range value is 0. The "
714"address and line will not be adjusted",
715 LineTableOffset, OpcodeName.data(), OpcodeOffset));
716 ReportBadLineRange =false;
717 }
718
719uint8_t OpcodeValue = Opcode;
720if (Opcode == DW_LNS_const_add_pc)
721 OpcodeValue = 255;
722uint8_t AdjustedOpcode = OpcodeValue - LineTable->Prologue.OpcodeBase;
723uint64_t OperationAdvance =
724 LineTable->Prologue.LineRange != 0
725 ? AdjustedOpcode / LineTable->Prologue.LineRange
726 : 0;
727 AddrOpIndexDelta Advance =
728 advanceAddrOpIndex(OperationAdvance, Opcode, OpcodeOffset);
729return {Advance.AddrOffset, Advance.OpIndexDelta, AdjustedOpcode};
730}
731
732DWARFDebugLine::ParsingState::SpecialOpcodeDelta
733DWARFDebugLine::ParsingState::handleSpecialOpcode(uint8_t Opcode,
734uint64_t OpcodeOffset) {
735// A special opcode value is chosen based on the amount that needs
736// to be added to the line and address registers. The maximum line
737// increment for a special opcode is the value of the line_base
738// field in the header, plus the value of the line_range field,
739// minus 1 (line base + line range - 1). If the desired line
740// increment is greater than the maximum line increment, a standard
741// opcode must be used instead of a special opcode. The "address
742// advance" is calculated by dividing the desired address increment
743// by the minimum_instruction_length field from the header. The
744// special opcode is then calculated using the following formula:
745//
746// opcode = (desired line increment - line_base) +
747// (line_range * address advance) + opcode_base
748//
749// If the resulting opcode is greater than 255, a standard opcode
750// must be used instead.
751//
752// To decode a special opcode, subtract the opcode_base from the
753// opcode itself to give the adjusted opcode. The amount to
754// increment the address register is the result of the adjusted
755// opcode divided by the line_range multiplied by the
756// minimum_instruction_length field from the header. That is:
757//
758// address increment = (adjusted opcode / line_range) *
759// minimum_instruction_length
760//
761// The amount to increment the line register is the line_base plus
762// the result of the adjusted opcode modulo the line_range. That is:
763//
764// line increment = line_base + (adjusted opcode % line_range)
765
766DWARFDebugLine::ParsingState::OpcodeAdvanceResults AddrAdvanceResult =
767 advanceForOpcode(Opcode, OpcodeOffset);
768 int32_t LineOffset = 0;
769if (LineTable->Prologue.LineRange != 0)
770 LineOffset =
771 LineTable->Prologue.LineBase +
772 (AddrAdvanceResult.AdjustedOpcode % LineTable->Prologue.LineRange);
773 Row.Line += LineOffset;
774return {AddrAdvanceResult.AddrDelta, LineOffset,
775 AddrAdvanceResult.OpIndexDelta};
776}
777
778/// Parse a ULEB128 using the specified \p Cursor. \returns the parsed value on
779/// success, or std::nullopt if \p Cursor is in a failing state.
780template <typename T>
781static std::optional<T>parseULEB128(DWARFDataExtractor &Data,
782DataExtractor::Cursor &Cursor) {
783TValue =Data.getULEB128(Cursor);
784if (Cursor)
785returnValue;
786return std::nullopt;
787}
788
789ErrorDWARFDebugLine::LineTable::parse(
790DWARFDataExtractor &DebugLineData,uint64_t *OffsetPtr,
791constDWARFContext &Ctx,constDWARFUnit *U,
792function_ref<void(Error)> RecoverableErrorHandler,raw_ostream *OS,
793boolVerbose) {
794assert((OS || !Verbose) &&"cannot have verbose output without stream");
795constuint64_t DebugLineOffset = *OffsetPtr;
796
797 clear();
798
799Error PrologueErr =
800Prologue.parse(DebugLineData, OffsetPtr, RecoverableErrorHandler, Ctx, U);
801
802if (OS) {
803DIDumpOptions DumpOptions;
804 DumpOptions.Verbose =Verbose;
805Prologue.dump(*OS, DumpOptions);
806 }
807
808if (PrologueErr) {
809// Ensure there is a blank line after the prologue to clearly delineate it
810// from later dumps.
811if (OS)
812 *OS <<"\n";
813return PrologueErr;
814 }
815
816uint64_t ProgramLength =Prologue.TotalLength +Prologue.sizeofTotalLength();
817if (!DebugLineData.isValidOffsetForDataOfSize(DebugLineOffset,
818 ProgramLength)) {
819assert(DebugLineData.size() > DebugLineOffset &&
820"prologue parsing should handle invalid offset");
821uint64_t BytesRemaining = DebugLineData.size() - DebugLineOffset;
822 RecoverableErrorHandler(
823createStringError(errc::invalid_argument,
824"line table program with offset 0x%8.8" PRIx64
825" has length 0x%8.8" PRIx64" but only 0x%8.8" PRIx64
826" bytes are available",
827 DebugLineOffset, ProgramLength, BytesRemaining));
828// Continue by capping the length at the number of remaining bytes.
829 ProgramLength = BytesRemaining;
830 }
831
832// Create a DataExtractor which can only see the data up to the end of the
833// table, to prevent reading past the end.
834constuint64_t EndOffset = DebugLineOffset + ProgramLength;
835DWARFDataExtractor TableData(DebugLineData, EndOffset);
836
837// See if we should tell the data extractor the address size.
838if (TableData.getAddressSize() == 0)
839 TableData.setAddressSize(Prologue.getAddressSize());
840else
841assert(Prologue.getAddressSize() == 0 ||
842Prologue.getAddressSize() == TableData.getAddressSize());
843
844 ParsingState State(this, DebugLineOffset, RecoverableErrorHandler);
845
846 *OffsetPtr = DebugLineOffset +Prologue.getLength();
847if (OS && *OffsetPtr < EndOffset) {
848 *OS <<'\n';
849Row::dumpTableHeader(*OS,/*Indent=*/Verbose ? 12 : 0);
850 }
851bool TombstonedAddress =false;
852auto EmitRow = [&] {
853if (!TombstonedAddress) {
854if (Verbose) {
855 *OS <<"\n";
856OS->indent(12);
857 }
858if (OS)
859 State.Row.dump(*OS);
860 State.appendRowToMatrix();
861 }
862 };
863while (*OffsetPtr < EndOffset) {
864DataExtractor::Cursor Cursor(*OffsetPtr);
865
866if (Verbose)
867 *OS <<format("0x%08.08" PRIx64": ", *OffsetPtr);
868
869uint64_t OpcodeOffset = *OffsetPtr;
870uint8_t Opcode = TableData.getU8(Cursor);
871size_t RowCount = Rows.size();
872
873if (Cursor &&Verbose)
874 *OS <<format("%02.02" PRIx8" ", Opcode);
875
876if (Opcode == 0) {
877// Extended Opcodes always start with a zero opcode followed by
878// a uleb128 length so you can skip ones you don't know about
879uint64_t Len = TableData.getULEB128(Cursor);
880uint64_t ExtOffset = Cursor.tell();
881
882// Tolerate zero-length; assume length is correct and soldier on.
883if (Len == 0) {
884if (Cursor &&Verbose)
885 *OS <<"Badly formed extended line op (length 0)\n";
886if (!Cursor) {
887if (Verbose)
888 *OS <<"\n";
889 RecoverableErrorHandler(Cursor.takeError());
890 }
891 *OffsetPtr = Cursor.tell();
892continue;
893 }
894
895uint8_t SubOpcode = TableData.getU8(Cursor);
896// OperandOffset will be the same as ExtOffset, if it was not possible to
897// read the SubOpcode.
898uint64_t OperandOffset = Cursor.tell();
899if (Verbose)
900 *OS <<LNExtendedString(SubOpcode);
901switch (SubOpcode) {
902case DW_LNE_end_sequence:
903// Set the end_sequence register of the state machine to true and
904// append a row to the matrix using the current values of the
905// state-machine registers. Then reset the registers to the initial
906// values specified above. Every statement program sequence must end
907// with a DW_LNE_end_sequence instruction which creates a row whose
908// address is that of the byte after the last target machine instruction
909// of the sequence.
910 State.Row.EndSequence =true;
911// No need to test the Cursor is valid here, since it must be to get
912// into this code path - if it were invalid, the default case would be
913// followed.
914 EmitRow();
915 State.resetRowAndSequence();
916break;
917
918case DW_LNE_set_address:
919// Takes a single relocatable address as an operand. The size of the
920// operand is the size appropriate to hold an address on the target
921// machine. Set the address register to the value given by the
922// relocatable address and set the op_index register to 0. All of the
923// other statement program opcodes that affect the address register
924// add a delta to it. This instruction stores a relocatable value into
925// it instead.
926//
927// Make sure the extractor knows the address size. If not, infer it
928// from the size of the operand.
929 {
930uint8_t ExtractorAddressSize = TableData.getAddressSize();
931uint64_t OpcodeAddressSize = Len - 1;
932if (ExtractorAddressSize != OpcodeAddressSize &&
933 ExtractorAddressSize != 0)
934 RecoverableErrorHandler(createStringError(
935errc::invalid_argument,
936"mismatching address size at offset 0x%8.8" PRIx64
937" expected 0x%2.2" PRIx8" found 0x%2.2" PRIx64,
938 ExtOffset, ExtractorAddressSize, Len - 1));
939
940// Assume that the line table is correct and temporarily override the
941// address size. If the size is unsupported, give up trying to read
942// the address and continue to the next opcode.
943if (OpcodeAddressSize != 1 && OpcodeAddressSize != 2 &&
944 OpcodeAddressSize != 4 && OpcodeAddressSize != 8) {
945 RecoverableErrorHandler(createStringError(
946errc::invalid_argument,
947"address size 0x%2.2" PRIx64
948" of DW_LNE_set_address opcode at offset 0x%8.8" PRIx64
949" is unsupported",
950 OpcodeAddressSize, ExtOffset));
951 TableData.skip(Cursor, OpcodeAddressSize);
952 }else {
953 TableData.setAddressSize(OpcodeAddressSize);
954 State.Row.Address.Address = TableData.getRelocatedAddress(
955 Cursor, &State.Row.Address.SectionIndex);
956 State.Row.OpIndex = 0;
957
958uint64_t Tombstone =
959dwarf::computeTombstoneAddress(OpcodeAddressSize);
960 TombstonedAddress = State.Row.Address.Address == Tombstone;
961
962// Restore the address size if the extractor already had it.
963if (ExtractorAddressSize != 0)
964 TableData.setAddressSize(ExtractorAddressSize);
965 }
966
967if (Cursor &&Verbose) {
968 *OS <<" (";
969DWARFFormValue::dumpAddress(*OS, OpcodeAddressSize,
970 State.Row.Address.Address);
971 *OS <<')';
972 }
973 }
974break;
975
976case DW_LNE_define_file:
977// Takes 4 arguments. The first is a null terminated string containing
978// a source file name. The second is an unsigned LEB128 number
979// representing the directory index of the directory in which the file
980// was found. The third is an unsigned LEB128 number representing the
981// time of last modification of the file. The fourth is an unsigned
982// LEB128 number representing the length in bytes of the file. The time
983// and length fields may contain LEB128(0) if the information is not
984// available.
985//
986// The directory index represents an entry in the include_directories
987// section of the statement program prologue. The index is LEB128(0)
988// if the file was found in the current directory of the compilation,
989// LEB128(1) if it was found in the first directory in the
990// include_directories section, and so on. The directory index is
991// ignored for file names that represent full path names.
992//
993// The files are numbered, starting at 1, in the order in which they
994// appear; the names in the prologue come before names defined by
995// the DW_LNE_define_file instruction. These numbers are used in the
996// the file register of the state machine.
997 {
998FileNameEntry FileEntry;
999constchar *Name = TableData.getCStr(Cursor);
1000 FileEntry.Name =
1001DWARFFormValue::createFromPValue(dwarf::DW_FORM_string,Name);
1002 FileEntry.DirIdx = TableData.getULEB128(Cursor);
1003 FileEntry.ModTime = TableData.getULEB128(Cursor);
1004 FileEntry.Length = TableData.getULEB128(Cursor);
1005Prologue.FileNames.push_back(FileEntry);
1006if (Cursor &&Verbose)
1007 *OS <<" (" <<Name <<", dir=" << FileEntry.DirIdx <<", mod_time="
1008 <<format("(0x%16.16" PRIx64")", FileEntry.ModTime)
1009 <<", length=" << FileEntry.Length <<")";
1010 }
1011break;
1012
1013case DW_LNE_set_discriminator:
1014 State.Row.Discriminator = TableData.getULEB128(Cursor);
1015if (Cursor &&Verbose)
1016 *OS <<" (" << State.Row.Discriminator <<")";
1017break;
1018
1019default:
1020if (Cursor &&Verbose)
1021 *OS <<format("Unrecognized extended op 0x%02.02" PRIx8, SubOpcode)
1022 <<format(" length %" PRIx64, Len);
1023// Len doesn't include the zero opcode byte or the length itself, but
1024// it does include the sub_opcode, so we have to adjust for that.
1025 TableData.skip(Cursor, Len - 1);
1026break;
1027 }
1028// Make sure the length as recorded in the table and the standard length
1029// for the opcode match. If they don't, continue from the end as claimed
1030// by the table. Similarly, continue from the claimed end in the event of
1031// a parsing error.
1032uint64_tEnd = ExtOffset + Len;
1033if (Cursor && Cursor.tell() !=End)
1034 RecoverableErrorHandler(createStringError(
1035errc::illegal_byte_sequence,
1036"unexpected line op length at offset 0x%8.8" PRIx64
1037" expected 0x%2.2" PRIx64" found 0x%2.2" PRIx64,
1038 ExtOffset, Len, Cursor.tell() - ExtOffset));
1039if (!Cursor &&Verbose) {
1040DWARFDataExtractor::Cursor ByteCursor(OperandOffset);
1041uint8_t Byte = TableData.getU8(ByteCursor);
1042if (ByteCursor) {
1043 *OS <<" (<parsing error>";
1044do {
1045 *OS <<format(" %2.2" PRIx8, Byte);
1046 Byte = TableData.getU8(ByteCursor);
1047 }while (ByteCursor);
1048 *OS <<")";
1049 }
1050
1051// The only parse failure in this case should be if the end was reached.
1052// In that case, throw away the error, as the main Cursor's error will
1053// be sufficient.
1054consumeError(ByteCursor.takeError());
1055 }
1056 *OffsetPtr =End;
1057 }elseif (Opcode <Prologue.OpcodeBase) {
1058if (Verbose)
1059 *OS <<LNStandardString(Opcode);
1060switch (Opcode) {
1061// Standard Opcodes
1062case DW_LNS_copy:
1063// Takes no arguments. Append a row to the matrix using the
1064// current values of the state-machine registers.
1065 EmitRow();
1066break;
1067
1068case DW_LNS_advance_pc:
1069// Takes a single unsigned LEB128 operand as the operation advance
1070// and modifies the address and op_index registers of the state machine
1071// according to that.
1072if (std::optional<uint64_t> Operand =
1073 parseULEB128<uint64_t>(TableData, Cursor)) {
1074ParsingState::AddrOpIndexDelta Advance =
1075 State.advanceAddrOpIndex(*Operand, Opcode, OpcodeOffset);
1076if (Verbose)
1077 *OS <<" (addr += " << Advance.AddrOffset
1078 <<", op-index += " << Advance.OpIndexDelta <<")";
1079 }
1080break;
1081
1082case DW_LNS_advance_line:
1083// Takes a single signed LEB128 operand and adds that value to
1084// the line register of the state machine.
1085 {
1086 int64_t LineDelta = TableData.getSLEB128(Cursor);
1087if (Cursor) {
1088 State.Row.Line += LineDelta;
1089if (Verbose)
1090 *OS <<" (" << State.Row.Line <<")";
1091 }
1092 }
1093break;
1094
1095case DW_LNS_set_file:
1096// Takes a single unsigned LEB128 operand and stores it in the file
1097// register of the state machine.
1098if (std::optional<uint16_t> File =
1099 parseULEB128<uint16_t>(TableData, Cursor)) {
1100 State.Row.File = *File;
1101if (Verbose)
1102 *OS <<" (" << State.Row.File <<")";
1103 }
1104break;
1105
1106case DW_LNS_set_column:
1107// Takes a single unsigned LEB128 operand and stores it in the
1108// column register of the state machine.
1109if (std::optional<uint16_t> Column =
1110 parseULEB128<uint16_t>(TableData, Cursor)) {
1111 State.Row.Column = *Column;
1112if (Verbose)
1113 *OS <<" (" << State.Row.Column <<")";
1114 }
1115break;
1116
1117case DW_LNS_negate_stmt:
1118// Takes no arguments. Set the is_stmt register of the state
1119// machine to the logical negation of its current value.
1120 State.Row.IsStmt = !State.Row.IsStmt;
1121break;
1122
1123case DW_LNS_set_basic_block:
1124// Takes no arguments. Set the basic_block register of the
1125// state machine to true
1126 State.Row.BasicBlock =true;
1127break;
1128
1129case DW_LNS_const_add_pc:
1130// Takes no arguments. Advance the address and op_index registers of
1131// the state machine by the increments corresponding to special
1132// opcode 255. The motivation for DW_LNS_const_add_pc is this:
1133// when the statement program needs to advance the address by a
1134// small amount, it can use a single special opcode, which occupies
1135// a single byte. When it needs to advance the address by up to
1136// twice the range of the last special opcode, it can use
1137// DW_LNS_const_add_pc followed by a special opcode, for a total
1138// of two bytes. Only if it needs to advance the address by more
1139// than twice that range will it need to use both DW_LNS_advance_pc
1140// and a special opcode, requiring three or more bytes.
1141 {
1142ParsingState::OpcodeAdvanceResults Advance =
1143 State.advanceForOpcode(Opcode, OpcodeOffset);
1144if (Verbose)
1145 *OS <<format(" (addr += 0x%16.16" PRIx64", op-index += %" PRIu8
1146")",
1147 Advance.AddrDelta, Advance.OpIndexDelta);
1148 }
1149break;
1150
1151case DW_LNS_fixed_advance_pc:
1152// Takes a single uhalf operand. Add to the address register of
1153// the state machine the value of the (unencoded) operand and set
1154// the op_index register to 0. This is the only extended opcode that
1155// takes an argument that is not a variable length number.
1156// The motivation for DW_LNS_fixed_advance_pc is this: existing
1157// assemblers cannot emit DW_LNS_advance_pc or special opcodes because
1158// they cannot encode LEB128 numbers or judge when the computation
1159// of a special opcode overflows and requires the use of
1160// DW_LNS_advance_pc. Such assemblers, however, can use
1161// DW_LNS_fixed_advance_pc instead, sacrificing compression.
1162 {
1163uint16_t PCOffset = TableData.getRelocatedValue(Cursor, 2);
1164if (Cursor) {
1165 State.Row.Address.Address += PCOffset;
1166 State.Row.OpIndex = 0;
1167if (Verbose)
1168 *OS <<format(" (addr += 0x%4.4" PRIx16", op-index = 0)",
1169 PCOffset);
1170 }
1171 }
1172break;
1173
1174case DW_LNS_set_prologue_end:
1175// Takes no arguments. Set the prologue_end register of the
1176// state machine to true
1177 State.Row.PrologueEnd =true;
1178break;
1179
1180case DW_LNS_set_epilogue_begin:
1181// Takes no arguments. Set the basic_block register of the
1182// state machine to true
1183 State.Row.EpilogueBegin =true;
1184break;
1185
1186case DW_LNS_set_isa:
1187// Takes a single unsigned LEB128 operand and stores it in the
1188// ISA register of the state machine.
1189if (std::optional<uint8_t> Isa =
1190 parseULEB128<uint8_t>(TableData, Cursor)) {
1191 State.Row.Isa = *Isa;
1192if (Verbose)
1193 *OS <<" (" << (uint64_t)State.Row.Isa <<")";
1194 }
1195break;
1196
1197default:
1198// Handle any unknown standard opcodes here. We know the lengths
1199// of such opcodes because they are specified in the prologue
1200// as a multiple of LEB128 operands for each opcode.
1201 {
1202assert(Opcode - 1U <Prologue.StandardOpcodeLengths.size());
1203if (Verbose)
1204 *OS <<"Unrecognized standard opcode";
1205uint8_t OpcodeLength =Prologue.StandardOpcodeLengths[Opcode - 1];
1206 std::vector<uint64_t>Operands;
1207for (uint8_tI = 0;I < OpcodeLength; ++I) {
1208if (std::optional<uint64_t>Value =
1209 parseULEB128<uint64_t>(TableData, Cursor))
1210Operands.push_back(*Value);
1211else
1212break;
1213 }
1214if (Verbose && !Operands.empty()) {
1215 *OS <<" (operands: ";
1216boolFirst =true;
1217for (uint64_tValue :Operands) {
1218if (!First)
1219 *OS <<", ";
1220First =false;
1221 *OS <<format("0x%16.16" PRIx64,Value);
1222 }
1223if (Verbose)
1224 *OS <<')';
1225 }
1226 }
1227break;
1228 }
1229
1230 *OffsetPtr = Cursor.tell();
1231 }else {
1232// Special Opcodes.
1233ParsingState::SpecialOpcodeDelta Delta =
1234 State.handleSpecialOpcode(Opcode, OpcodeOffset);
1235
1236if (Verbose)
1237 *OS <<"address += " << Delta.Address <<", line += " << Delta.Line
1238 <<", op-index += " << Delta.OpIndex;
1239 EmitRow();
1240 *OffsetPtr = Cursor.tell();
1241 }
1242
1243// When a row is added to the matrix, it is also dumped, which includes a
1244// new line already, so don't add an extra one.
1245if (Verbose && Rows.size() == RowCount)
1246 *OS <<"\n";
1247
1248// Most parse failures other than when parsing extended opcodes are due to
1249// failures to read ULEBs. Bail out of parsing, since we don't know where to
1250// continue reading from as there is no stated length for such byte
1251// sequences. Print the final trailing new line if needed before doing so.
1252if (!Cursor && Opcode != 0) {
1253if (Verbose)
1254 *OS <<"\n";
1255return Cursor.takeError();
1256 }
1257
1258if (!Cursor)
1259 RecoverableErrorHandler(Cursor.takeError());
1260 }
1261
1262if (!State.Sequence.Empty)
1263 RecoverableErrorHandler(createStringError(
1264errc::illegal_byte_sequence,
1265"last sequence in debug line table at offset 0x%8.8" PRIx64
1266" is not terminated",
1267 DebugLineOffset));
1268
1269// Sort all sequences so that address lookup will work faster.
1270if (!Sequences.empty()) {
1271llvm::sort(Sequences,Sequence::orderByHighPC);
1272// Note: actually, instruction address ranges of sequences should not
1273// overlap (in shared objects and executables). If they do, the address
1274// lookup would still work, though, but result would be ambiguous.
1275// We don't report warning in this case. For example,
1276// sometimes .so compiled from multiple object files contains a few
1277// rudimentary sequences for address ranges [0x0, 0xsomething).
1278 }
1279
1280// Terminate the table with a final blank line to clearly delineate it from
1281// later dumps.
1282if (OS)
1283 *OS <<"\n";
1284
1285returnError::success();
1286}
1287
1288uint32_t DWARFDebugLine::LineTable::findRowInSeq(
1289constDWARFDebugLine::Sequence &Seq,
1290object::SectionedAddressAddress) const{
1291if (!Seq.containsPC(Address))
1292return UnknownRowIndex;
1293assert(Seq.SectionIndex ==Address.SectionIndex);
1294// In some cases, e.g. first instruction in a function, the compiler generates
1295// two entries, both with the same address. We want the last one.
1296//
1297// In general we want a non-empty range: the last row whose address is less
1298// than or equal to Address. This can be computed as upper_bound - 1.
1299//
1300// TODO: This function, and its users, needs to be update to return multiple
1301// rows for bundles with multiple op-indexes.
1302DWARFDebugLine::RowRow;
1303Row.Address =Address;
1304 RowIter FirstRow = Rows.begin() + Seq.FirstRowIndex;
1305 RowIter LastRow = Rows.begin() + Seq.LastRowIndex;
1306assert(FirstRow->Address.Address <=Row.Address.Address &&
1307Row.Address.Address < LastRow[-1].Address.Address);
1308 RowIter RowPos = std::upper_bound(FirstRow + 1, LastRow - 1,Row,
1309DWARFDebugLine::Row::orderByAddress) -
1310 1;
1311assert(Seq.SectionIndex == RowPos->Address.SectionIndex);
1312return RowPos - Rows.begin();
1313}
1314
1315uint32_t
1316DWARFDebugLine::LineTable::lookupAddress(object::SectionedAddressAddress,
1317bool *IsApproximateLine) const{
1318
1319// Search for relocatable addresses
1320uint32_t Result = lookupAddressImpl(Address, IsApproximateLine);
1321
1322if (Result != UnknownRowIndex ||
1323Address.SectionIndex ==object::SectionedAddress::UndefSection)
1324return Result;
1325
1326// Search for absolute addresses
1327Address.SectionIndex =object::SectionedAddress::UndefSection;
1328return lookupAddressImpl(Address, IsApproximateLine);
1329}
1330
1331uint32_t
1332DWARFDebugLine::LineTable::lookupAddressImpl(object::SectionedAddressAddress,
1333bool *IsApproximateLine) const{
1334assert((!IsApproximateLine || !*IsApproximateLine) &&
1335"Make sure IsApproximateLine is appropriately "
1336"initialized, if provided");
1337// First, find an instruction sequence containing the given address.
1338DWARFDebugLine::SequenceSequence;
1339Sequence.SectionIndex =Address.SectionIndex;
1340Sequence.HighPC =Address.Address;
1341 SequenceIter It =llvm::upper_bound(Sequences,Sequence,
1342DWARFDebugLine::Sequence::orderByHighPC);
1343if (It == Sequences.end() || It->SectionIndex !=Address.SectionIndex)
1344return UnknownRowIndex;
1345
1346uint32_t RowIndex = findRowInSeq(*It,Address);
1347if (RowIndex == UnknownRowIndex || !IsApproximateLine)
1348return RowIndex;
1349
1350// Approximation will only be attempted if a valid RowIndex exists.
1351uint32_t ApproxRowIndex = RowIndex;
1352// Approximation Loop
1353for (; ApproxRowIndex >= It->FirstRowIndex; --ApproxRowIndex) {
1354if (Rows[ApproxRowIndex].Line)
1355return ApproxRowIndex;
1356 *IsApproximateLine =true;
1357 }
1358// Approximation Loop fails to find the valid ApproxRowIndex
1359if (ApproxRowIndex < It->FirstRowIndex)
1360 *IsApproximateLine =false;
1361
1362return RowIndex;
1363}
1364
1365boolDWARFDebugLine::LineTable::lookupAddressRange(
1366object::SectionedAddressAddress,uint64_tSize,
1367 std::vector<uint32_t> &Result) const{
1368
1369// Search for relocatable addresses
1370if (lookupAddressRangeImpl(Address,Size, Result))
1371returntrue;
1372
1373if (Address.SectionIndex ==object::SectionedAddress::UndefSection)
1374returnfalse;
1375
1376// Search for absolute addresses
1377Address.SectionIndex =object::SectionedAddress::UndefSection;
1378return lookupAddressRangeImpl(Address,Size, Result);
1379}
1380
1381bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
1382object::SectionedAddressAddress,uint64_tSize,
1383 std::vector<uint32_t> &Result) const{
1384if (Sequences.empty())
1385returnfalse;
1386uint64_t EndAddr =Address.Address +Size;
1387// First, find an instruction sequence containing the given address.
1388DWARFDebugLine::SequenceSequence;
1389Sequence.SectionIndex =Address.SectionIndex;
1390Sequence.HighPC =Address.Address;
1391 SequenceIter LastSeq = Sequences.end();
1392 SequenceIter SeqPos =llvm::upper_bound(
1393 Sequences,Sequence,DWARFDebugLine::Sequence::orderByHighPC);
1394if (SeqPos == LastSeq || !SeqPos->containsPC(Address))
1395returnfalse;
1396
1397 SequenceIter StartPos = SeqPos;
1398
1399// Add the rows from the first sequence to the vector, starting with the
1400// index we just calculated
1401
1402while (SeqPos != LastSeq && SeqPos->LowPC < EndAddr) {
1403constDWARFDebugLine::Sequence &CurSeq = *SeqPos;
1404// For the first sequence, we need to find which row in the sequence is the
1405// first in our range.
1406uint32_t FirstRowIndex = CurSeq.FirstRowIndex;
1407if (SeqPos == StartPos)
1408 FirstRowIndex = findRowInSeq(CurSeq,Address);
1409
1410// Figure out the last row in the range.
1411uint32_t LastRowIndex =
1412 findRowInSeq(CurSeq, {EndAddr - 1,Address.SectionIndex});
1413if (LastRowIndex == UnknownRowIndex)
1414 LastRowIndex = CurSeq.LastRowIndex - 1;
1415
1416assert(FirstRowIndex != UnknownRowIndex);
1417assert(LastRowIndex != UnknownRowIndex);
1418
1419for (uint32_tI = FirstRowIndex;I <= LastRowIndex; ++I) {
1420 Result.push_back(I);
1421 }
1422
1423 ++SeqPos;
1424 }
1425
1426returntrue;
1427}
1428
1429std::optional<StringRef>
1430DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex,
1431FileLineInfoKind Kind) const{
1432if (Kind == FileLineInfoKind::None || !Prologue.hasFileAtIndex(FileIndex))
1433return std::nullopt;
1434const FileNameEntry &Entry = Prologue.getFileNameEntry(FileIndex);
1435if (auto E =dwarf::toString(Entry.Source))
1436returnStringRef(*E);
1437return std::nullopt;
1438}
1439
1440staticboolisPathAbsoluteOnWindowsOrPosix(constTwine &Path) {
1441// Debug info can contain paths from any OS, not necessarily
1442// an OS we're currently running on. Moreover different compilation units can
1443// be compiled on different operating systems and linked together later.
1444returnsys::path::is_absolute(Path,sys::path::Style::posix) ||
1445sys::path::is_absolute(Path,sys::path::Style::windows);
1446}
1447
1448boolDWARFDebugLine::Prologue::getFileNameByIndex(
1449uint64_t FileIndex,StringRef CompDir,FileLineInfoKind Kind,
1450 std::string &Result,sys::path::Style Style) const{
1451if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex))
1452returnfalse;
1453constFileNameEntry &Entry = getFileNameEntry(FileIndex);
1454auto E =dwarf::toString(Entry.Name);
1455if (!E)
1456returnfalse;
1457StringRef FileName = *E;
1458if (Kind == FileLineInfoKind::RawValue ||
1459isPathAbsoluteOnWindowsOrPosix(FileName)) {
1460 Result = std::string(FileName);
1461returntrue;
1462 }
1463if (Kind == FileLineInfoKind::BaseNameOnly) {
1464 Result = std::string(llvm::sys::path::filename(FileName));
1465returntrue;
1466 }
1467
1468SmallString<16> FilePath;
1469StringRef IncludeDir;
1470// Be defensive about the contents of Entry.
1471if (getVersion() >= 5) {
1472// DirIdx 0 is the compilation directory, so don't include it for
1473// relative names.
1474if ((Entry.DirIdx != 0 || Kind != FileLineInfoKind::RelativeFilePath) &&
1475 Entry.DirIdx < IncludeDirectories.size())
1476 IncludeDir =dwarf::toStringRef(IncludeDirectories[Entry.DirIdx]);
1477 }else {
1478if (0 < Entry.DirIdx && Entry.DirIdx <= IncludeDirectories.size())
1479 IncludeDir =dwarf::toStringRef(IncludeDirectories[Entry.DirIdx - 1]);
1480 }
1481
1482// For absolute paths only, include the compilation directory of compile unit,
1483// unless v5 DirIdx == 0 (IncludeDir indicates the compilation directory). We
1484// know that FileName is not absolute, the only way to have an absolute path
1485// at this point would be if IncludeDir is absolute.
1486if (Kind == FileLineInfoKind::AbsoluteFilePath &&
1487 (getVersion() < 5 || Entry.DirIdx != 0) && !CompDir.empty() &&
1488 !isPathAbsoluteOnWindowsOrPosix(IncludeDir))
1489sys::path::append(FilePath, Style, CompDir);
1490
1491assert((Kind == FileLineInfoKind::AbsoluteFilePath ||
1492 Kind == FileLineInfoKind::RelativeFilePath) &&
1493"invalid FileLineInfo Kind");
1494
1495// sys::path::append skips empty strings.
1496sys::path::append(FilePath, Style, IncludeDir, FileName);
1497 Result = std::string(FilePath);
1498returntrue;
1499}
1500
1501boolDWARFDebugLine::LineTable::getFileLineInfoForAddress(
1502object::SectionedAddressAddress,bool Approximate,constchar *CompDir,
1503FileLineInfoKind Kind,DILineInfo &Result) const{
1504// Get the index of row we're looking for in the line table.
1505uint32_t RowIndex =
1506 lookupAddress(Address, Approximate ? &Result.IsApproximateLine :nullptr);
1507if (RowIndex == -1U)
1508returnfalse;
1509// Take file number and line/column from the row.
1510constauto &Row = Rows[RowIndex];
1511if (!getFileNameByIndex(Row.File, CompDir, Kind, Result.FileName))
1512returnfalse;
1513 Result.Line =Row.Line;
1514 Result.Column =Row.Column;
1515 Result.Discriminator =Row.Discriminator;
1516 Result.Source = getSourceByIndex(Row.File, Kind);
1517returntrue;
1518}
1519
1520boolDWARFDebugLine::LineTable::getDirectoryForEntry(
1521constFileNameEntry &Entry, std::string &Directory) const{
1522if (Prologue.getVersion() >= 5) {
1523if (Entry.DirIdx <Prologue.IncludeDirectories.size()) {
1524 Directory =
1525dwarf::toString(Prologue.IncludeDirectories[Entry.DirIdx],"");
1526returntrue;
1527 }
1528returnfalse;
1529 }
1530if (0 < Entry.DirIdx && Entry.DirIdx <=Prologue.IncludeDirectories.size()) {
1531 Directory =
1532dwarf::toString(Prologue.IncludeDirectories[Entry.DirIdx - 1],"");
1533returntrue;
1534 }
1535returnfalse;
1536}
1537
1538// We want to supply the Unit associated with a .debug_line[.dwo] table when
1539// we dump it, if possible, but still dump the table even if there isn't a Unit.
1540// Therefore, collect up handles on all the Units that point into the
1541// line-table section.
1542staticDWARFDebugLine::SectionParser::LineToUnitMap
1543buildLineToUnitMap(DWARFUnitVector::iterator_range Units) {
1544DWARFDebugLine::SectionParser::LineToUnitMap LineToUnit;
1545for (constauto &U : Units)
1546if (auto CUDIE = U->getUnitDIE())
1547if (auto StmtOffset =toSectionOffset(CUDIE.find(DW_AT_stmt_list)))
1548 LineToUnit.insert(std::make_pair(*StmtOffset, &*U));
1549return LineToUnit;
1550}
1551
1552DWARFDebugLine::SectionParser::SectionParser(
1553DWARFDataExtractor &Data,constDWARFContext &C,
1554DWARFUnitVector::iterator_range Units)
1555 : DebugLineData(Data), Context(C) {
1556 LineToUnit =buildLineToUnitMap(Units);
1557if (!DebugLineData.isValidOffset(Offset))
1558 Done =true;
1559}
1560
1561boolDWARFDebugLine::Prologue::totalLengthIsValid() const{
1562return TotalLength != 0u;
1563}
1564
1565DWARFDebugLine::LineTableDWARFDebugLine::SectionParser::parseNext(
1566function_ref<void(Error)> RecoverableErrorHandler,
1567function_ref<void(Error)> UnrecoverableErrorHandler,raw_ostream *OS,
1568boolVerbose) {
1569assert(DebugLineData.isValidOffset(Offset) &&
1570"parsing should have terminated");
1571DWARFUnit *U = prepareToParse(Offset);
1572uint64_t OldOffset =Offset;
1573LineTable LT;
1574if (Error Err = LT.parse(DebugLineData, &Offset, Context, U,
1575 RecoverableErrorHandler,OS,Verbose))
1576 UnrecoverableErrorHandler(std::move(Err));
1577 moveToNextTable(OldOffset, LT.Prologue);
1578return LT;
1579}
1580
1581voidDWARFDebugLine::SectionParser::skip(
1582function_ref<void(Error)> RecoverableErrorHandler,
1583function_ref<void(Error)> UnrecoverableErrorHandler) {
1584assert(DebugLineData.isValidOffset(Offset) &&
1585"parsing should have terminated");
1586DWARFUnit *U = prepareToParse(Offset);
1587uint64_t OldOffset =Offset;
1588LineTable LT;
1589if (Error Err = LT.Prologue.parse(DebugLineData, &Offset,
1590 RecoverableErrorHandler, Context, U))
1591 UnrecoverableErrorHandler(std::move(Err));
1592 moveToNextTable(OldOffset, LT.Prologue);
1593}
1594
1595DWARFUnit *DWARFDebugLine::SectionParser::prepareToParse(uint64_tOffset) {
1596DWARFUnit *U =nullptr;
1597auto It = LineToUnit.find(Offset);
1598if (It != LineToUnit.end())
1599 U = It->second;
1600 DebugLineData.setAddressSize(U ? U->getAddressByteSize() : 0);
1601return U;
1602}
1603
1604bool DWARFDebugLine::SectionParser::hasValidVersion(uint64_tOffset) {
1605DataExtractor::Cursor Cursor(Offset);
1606auto [TotalLength,_] = DebugLineData.getInitialLength(Cursor);
1607DWARFDataExtractor HeaderData(DebugLineData, Cursor.tell() + TotalLength);
1608uint16_tVersion = HeaderData.getU16(Cursor);
1609if (!Cursor) {
1610// Ignore any error here.
1611// If this is not the end of the section parseNext() will still be
1612// attempted, where this error will occur again (and can be handled).
1613consumeError(Cursor.takeError());
1614returnfalse;
1615 }
1616returnversionIsSupported(Version);
1617}
1618
1619void DWARFDebugLine::SectionParser::moveToNextTable(uint64_t OldOffset,
1620const Prologue &P) {
1621// If the length field is not valid, we don't know where the next table is, so
1622// cannot continue to parse. Mark the parser as done, and leave the Offset
1623// value as it currently is. This will be the end of the bad length field.
1624if (!P.totalLengthIsValid()) {
1625Done =true;
1626return;
1627 }
1628
1629Offset = OldOffset +P.TotalLength +P.sizeofTotalLength();
1630if (!DebugLineData.isValidOffset(Offset)) {
1631Done =true;
1632return;
1633 }
1634
1635// Heuristic: If the version is valid, then this is probably a line table.
1636// Otherwise, the offset might need alignment (to a 4 or 8 byte boundary).
1637if (hasValidVersion(Offset))
1638return;
1639
1640// ARM C/C++ Compiler aligns each line table to word boundaries and pads out
1641// the .debug_line section to a word multiple. Note that in the specification
1642// this does not seem forbidden since each unit has a DW_AT_stmt_list.
1643for (unsignedAlign : {4, 8}) {
1644uint64_t AlignedOffset =alignTo(Offset,Align);
1645if (!DebugLineData.isValidOffset(AlignedOffset)) {
1646// This is almost certainly not another line table but some alignment
1647// padding. This assumes the alignments tested are ordered, and are
1648// smaller than the header size (which is true for 4 and 8).
1649Done =true;
1650return;
1651 }
1652if (hasValidVersion(AlignedOffset)) {
1653Offset = AlignedOffset;
1654break;
1655 }
1656 }
1657}
DWARFDataExtractor.h
parseV5DirFileTables
static Error parseV5DirFileTables(const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const dwarf::FormParams &FormParams, const DWARFContext &Ctx, const DWARFUnit *U, DWARFDebugLine::ContentTypeTracker &ContentTypes, std::vector< DWARFFormValue > &IncludeDirectories, std::vector< DWARFDebugLine::FileNameEntry > &FileNames)
Definition:DWARFDebugLine.cpp:272
parseV2DirFileTables
static Error parseV2DirFileTables(const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, DWARFDebugLine::ContentTypeTracker &ContentTypes, std::vector< DWARFFormValue > &IncludeDirectories, std::vector< DWARFDebugLine::FileNameEntry > &FileNames)
Definition:DWARFDebugLine.cpp:187
parseV5EntryFormat
static llvm::Expected< ContentDescriptors > parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, DWARFDebugLine::ContentTypeTracker *ContentTypes)
Definition:DWARFDebugLine.cpp:241
buildLineToUnitMap
static DWARFDebugLine::SectionParser::LineToUnitMap buildLineToUnitMap(DWARFUnitVector::iterator_range Units)
Definition:DWARFDebugLine.cpp:1543
versionIsSupported
static bool versionIsSupported(uint16_t Version)
Definition:DWARFDebugLine.cpp:44
getOpcodeName
static StringRef getOpcodeName(uint8_t Opcode, uint8_t OpcodeBase)
Definition:DWARFDebugLine.cpp:627
parseULEB128
static std::optional< T > parseULEB128(DWARFDataExtractor &Data, DataExtractor::Cursor &Cursor)
Parse a ULEB128 using the specified Cursor.
Definition:DWARFDebugLine.cpp:781
DWARFDebugLine.h
DWARFDie.h
DWARFFormValue.h
Dwarf.h
This file contains constants used for implementing Dwarf debug support.
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
End
bool End
Definition:ELF_riscv.cpp:480
Errc.h
ErrorHandler
static fatal_error_handler_t ErrorHandler
Definition:ErrorHandling.cpp:43
FormatVariadic.h
Format.h
_
#define _
Definition:HexagonMCCodeEmitter.cpp:46
EndSequence
@ EndSequence
End of the line table.
Definition:LineTable.cpp:17
I
#define I(x, y, z)
Definition:MD5.cpp:58
Operands
mir Rename Register Operands
Definition:MIRNamerPass.cpp:74
P
#define P(N)
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OpIndex
unsigned OpIndex
Definition:SPIRVModuleAnalysis.cpp:63
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
SmallString.h
This file defines the SmallString class.
SmallVector.h
This file defines the SmallVector class.
StringRef.h
T
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition:DWARFContext.h:48
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition:DWARFDataExtractor.h:21
llvm::DWARFDataExtractor::getRelocatedAddress
uint64_t getRelocatedAddress(uint64_t *Off, uint64_t *SecIx=nullptr) const
Extracts an address-sized value and applies a relocation to the result if one exists for the given of...
Definition:DWARFDataExtractor.h:72
llvm::DWARFDataExtractor::getInitialLength
std::pair< uint64_t, dwarf::DwarfFormat > getInitialLength(uint64_t *Off, Error *Err=nullptr) const
Extracts the DWARF "initial length" field, which can either be a 32-bit value smaller than 0xfffffff0...
Definition:DWARFDataExtractor.cpp:17
llvm::DWARFDataExtractor::getRelocatedValue
uint64_t getRelocatedValue(uint32_t Size, uint64_t *Off, uint64_t *SectionIndex=nullptr, Error *Err=nullptr) const
Extracts a value and applies a relocation to the result if one exists for the given offset.
Definition:DWARFDataExtractor.cpp:48
llvm::DWARFDebugLine::SectionParser::skip
void skip(function_ref< void(Error)> RecoverableErrorHandler, function_ref< void(Error)> UnrecoverableErrorHandler)
Skip the current line table and go to the following line table (if present) immediately.
Definition:DWARFDebugLine.cpp:1581
llvm::DWARFDebugLine::SectionParser::LineToUnitMap
std::map< uint64_t, DWARFUnit * > LineToUnitMap
Definition:DWARFDebugLine.h:322
llvm::DWARFDebugLine::SectionParser::parseNext
LineTable parseNext(function_ref< void(Error)> RecoverableErrorHandler, function_ref< void(Error)> UnrecoverableErrorHandler, raw_ostream *OS=nullptr, bool Verbose=false)
Get the next line table from the section.
Definition:DWARFDebugLine.cpp:1565
llvm::DWARFDebugLine::SectionParser::SectionParser
SectionParser(DWARFDataExtractor &Data, const DWARFContext &C, DWARFUnitVector::iterator_range Units)
Definition:DWARFDebugLine.cpp:1552
llvm::DWARFDebugLine::clearLineTable
void clearLineTable(uint64_t Offset)
Definition:DWARFDebugLine.cpp:623
llvm::DWARFDebugLine::getOrParseLineTable
Expected< const LineTable * > getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, const DWARFUnit *U, function_ref< void(Error)> RecoverableErrorHandler)
Definition:DWARFDebugLine.cpp:602
llvm::DWARFDebugLine::getLineTable
const LineTable * getLineTable(uint64_t Offset) const
Definition:DWARFDebugLine.cpp:595
llvm::DWARFFormValue
Definition:DWARFFormValue.h:26
llvm::DWARFFormValue::dumpAddress
void dumpAddress(raw_ostream &OS, uint64_t Address) const
llvm::DWARFFormValue::createFromPValue
static DWARFFormValue createFromPValue(dwarf::Form F, const char *V)
Definition:DWARFFormValue.cpp:90
llvm::DWARFFormValue::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOpts=DIDumpOptions()) const
Definition:DWARFFormValue.cpp:382
llvm::DWARFFormValue::getAsCString
Expected< const char * > getAsCString() const
Definition:DWARFFormValue.cpp:591
llvm::DWARFUnit
Definition:DWARFUnit.h:211
llvm::DataExtractor::Cursor
A class representing a position in a DataExtractor, as well as any error encountered during extractio...
Definition:DataExtractor.h:54
llvm::DataExtractor::Cursor::tell
uint64_t tell() const
Return the current position of this Cursor.
Definition:DataExtractor.h:71
llvm::DataExtractor::Cursor::takeError
Error takeError()
Return error contained inside this Cursor, if any.
Definition:DataExtractor.h:78
llvm::DataExtractor::size
size_t size() const
Return the number of bytes in the underlying buffer.
Definition:DataExtractor.h:688
llvm::DataExtractor::getCStr
const char * getCStr(uint64_t *OffsetPtr, Error *Err=nullptr) const
Extract a C string from *offset_ptr.
Definition:DataExtractor.h:129
llvm::DataExtractor::getCStrRef
StringRef getCStrRef(uint64_t *OffsetPtr, Error *Err=nullptr) const
Extract a C string from *offset_ptr.
Definition:DataExtractor.cpp:156
llvm::DataExtractor::getU8
uint8_t getU8(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint8_t value from *offset_ptr.
Definition:DataExtractor.cpp:80
llvm::DataExtractor::getULEB128
uint64_t getULEB128(uint64_t *offset_ptr, llvm::Error *Err=nullptr) const
Extract a unsigned LEB128 value from *offset_ptr.
Definition:DataExtractor.cpp:221
llvm::DataExtractor::getAddressSize
uint8_t getAddressSize() const
Get the address size for this extractor.
Definition:DataExtractor.h:99
llvm::DataExtractor::getSLEB128
int64_t getSLEB128(uint64_t *OffsetPtr, Error *Err=nullptr) const
Extract a signed LEB128 value from *offset_ptr.
Definition:DataExtractor.cpp:225
llvm::DataExtractor::getU16
uint16_t getU16(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint16_t value from *offset_ptr.
Definition:DataExtractor.cpp:93
llvm::DataExtractor::skip
void skip(Cursor &C, uint64_t Length) const
Advance the Cursor position by the given number of bytes.
Definition:DataExtractor.cpp:229
llvm::DataExtractor::setAddressSize
void setAddressSize(uint8_t Size)
Set the address size for this extractor.
Definition:DataExtractor.h:101
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
Definition:DataExtractor.h:665
llvm::DataExtractor::isValidOffsetForDataOfSize
bool isValidOffsetForDataOfSize(uint64_t offset, uint64_t length) const
Test the availability of length bytes of data from offset.
Definition:DataExtractor.h:672
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:Error.h:337
llvm::Expected
Tagged union holding either a T or a Error.
Definition:Error.h:481
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition:Error.h:608
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition:SmallString.h:26
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition:StringRef.h:147
llvm::StringRef::data
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition:StringRef.h:144
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:Twine.h:81
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:STLFunctionalExtras.h:37
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition:raw_ostream.cpp:495
uint16_t
uint32_t
uint64_t
uint8_t
llvm::dwarf::LNExtendedString
StringRef LNExtendedString(unsigned Encoding)
Definition:Dwarf.cpp:523
llvm::dwarf::FormatString
StringRef FormatString(DwarfFormat Format)
Definition:Dwarf.cpp:868
llvm::dwarf::LNStandardString
StringRef LNStandardString(unsigned Standard)
Definition:Dwarf.cpp:512
llvm::COFF::Entry
@ Entry
Definition:COFF.h:844
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::dwarf_linker::isPathAbsoluteOnWindowsOrPosix
bool isPathAbsoluteOnWindowsOrPosix(const Twine &Path)
Definition:Utils.h:98
llvm::dwarf::LineNumberEntryFormat
LineNumberEntryFormat
Definition:Dwarf.h:787
llvm::dwarf::toString
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
Definition:DWARFFormValue.h:177
llvm::dwarf::LineNumberOps
LineNumberOps
Line Number Standard Opcode Encodings.
Definition:Dwarf.h:774
llvm::dwarf::Index
Index
Definition:Dwarf.h:882
llvm::dwarf::Form
Form
Definition:Dwarf.h:130
llvm::dwarf::DWARF32
@ DWARF32
Definition:Dwarf.h:91
llvm::dwarf::toSectionOffset
std::optional< uint64_t > toSectionOffset(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an section offset.
Definition:DWARFFormValue.h:399
llvm::dwarf::toStringRef
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
Definition:DWARFFormValue.h:193
llvm::dwarf::getDwarfOffsetByteSize
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
Definition:Dwarf.h:1071
llvm::dwarf::computeTombstoneAddress
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
Definition:Dwarf.h:1212
llvm::objcarc::Sequence
Sequence
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actua...
Definition:PtrState.h:41
llvm::sys::path::Style
Style
Definition:Path.h:27
llvm::sys::path::Style::windows
@ windows
llvm::sys::path::Style::posix
@ posix
llvm::sys::path::filename
StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
Definition:Path.cpp:577
llvm::sys::path::is_absolute
bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
Definition:Path.cpp:671
llvm::sys::path::append
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition:Path.cpp:456
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Offset
@ Offset
Definition:DWP.cpp:480
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::Done
@ Done
Definition:Threading.h:60
llvm::c_str
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
Definition:WindowsSupport.h:194
llvm::upper_bound
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
Definition:STLExtras.h:1991
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition:Error.h:1291
llvm::errc::illegal_byte_sequence
@ illegal_byte_sequence
llvm::errc::not_supported
@ not_supported
llvm::errc::invalid_argument
@ invalid_argument
llvm::formatv
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Definition:FormatVariadic.h:252
llvm::joinErrors
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition:Error.h:438
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition:STLExtras.h:1664
llvm::CaptureComponents::Address
@ Address
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition:Format.h:125
llvm::IRMemLocation::First
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition:Alignment.h:155
llvm::toString
const char * toString(DWARFSectionKind Kind)
Definition:DWARFUnitIndex.h:67
llvm::InlinerFunctionImportStatsOpts::Verbose
@ Verbose
llvm::Data
@ Data
Definition:SIMachineScheduler.h:55
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition:Error.h:1069
llvm::Version
@ Version
Definition:PGOCtxProfWriter.h:22
raw_ostream.h
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition:Alignment.h:39
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition:DIContext.h:196
llvm::DIDumpOptions::Verbose
bool Verbose
Definition:DIContext.h:207
llvm::DILineInfoSpecifier::FileLineInfoKind
FileLineInfoKind
Definition:DIContext.h:147
llvm::DILineInfo
A format-neutral container for source line information.
Definition:DIContext.h:32
llvm::DWARFDebugLine::ContentTypeTracker
Tracks which optional content types are present in a DWARF file name entry format.
Definition:DWARFDebugLine.h:43
llvm::DWARFDebugLine::ContentTypeTracker::HasLength
bool HasLength
Whether filename entries provide a file size.
Definition:DWARFDebugLine.h:49
llvm::DWARFDebugLine::ContentTypeTracker::HasSource
bool HasSource
For v5, whether filename entries provide source text.
Definition:DWARFDebugLine.h:53
llvm::DWARFDebugLine::ContentTypeTracker::HasModTime
bool HasModTime
Whether filename entries provide a modification timestamp.
Definition:DWARFDebugLine.h:47
llvm::DWARFDebugLine::ContentTypeTracker::HasMD5
bool HasMD5
For v5, whether filename entries provide an MD5 checksum.
Definition:DWARFDebugLine.h:51
llvm::DWARFDebugLine::ContentTypeTracker::trackContentType
void trackContentType(dwarf::LineNumberEntryFormat ContentType)
Update tracked content types with ContentType.
Definition:DWARFDebugLine.cpp:48
llvm::DWARFDebugLine::FileNameEntry
Definition:DWARFDebugLine.h:30
llvm::DWARFDebugLine::FileNameEntry::Length
uint64_t Length
Definition:DWARFDebugLine.h:36
llvm::DWARFDebugLine::FileNameEntry::ModTime
uint64_t ModTime
Definition:DWARFDebugLine.h:35
llvm::DWARFDebugLine::FileNameEntry::Checksum
MD5::MD5Result Checksum
Definition:DWARFDebugLine.h:37
llvm::DWARFDebugLine::FileNameEntry::Name
DWARFFormValue Name
Definition:DWARFDebugLine.h:33
llvm::DWARFDebugLine::FileNameEntry::Source
DWARFFormValue Source
Definition:DWARFDebugLine.h:38
llvm::DWARFDebugLine::FileNameEntry::DirIdx
uint64_t DirIdx
Definition:DWARFDebugLine.h:34
llvm::DWARFDebugLine::LineTable
Definition:DWARFDebugLine.h:229
llvm::DWARFDebugLine::LineTable::lookupAddress
uint32_t lookupAddress(object::SectionedAddress Address, bool *IsApproximateLine=nullptr) const
Returns the index of the row with file/line info for a given address, or UnknownRowIndex if there is ...
Definition:DWARFDebugLine.cpp:1316
llvm::DWARFDebugLine::LineTable::getDirectoryForEntry
bool getDirectoryForEntry(const FileNameEntry &Entry, std::string &Directory) const
Extracts directory name by its Entry in include directories table in prologue.
Definition:DWARFDebugLine.cpp:1520
llvm::DWARFDebugLine::LineTable::getFileLineInfoForAddress
bool getFileLineInfoForAddress(object::SectionedAddress Address, bool Approximate, const char *CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, DILineInfo &Result) const
Fills the Result argument with the file and line information corresponding to Address.
Definition:DWARFDebugLine.cpp:1501
llvm::DWARFDebugLine::LineTable::parse
Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const DWARFContext &Ctx, const DWARFUnit *U, function_ref< void(Error)> RecoverableErrorHandler, raw_ostream *OS=nullptr, bool Verbose=false)
Parse prologue and all rows.
Definition:DWARFDebugLine.cpp:789
llvm::DWARFDebugLine::LineTable::clear
void clear()
Definition:DWARFDebugLine.cpp:555
llvm::DWARFDebugLine::LineTable::LineTable
LineTable()
Definition:DWARFDebugLine.cpp:536
llvm::DWARFDebugLine::LineTable::lookupAddressRange
bool lookupAddressRange(object::SectionedAddress Address, uint64_t Size, std::vector< uint32_t > &Result) const
Definition:DWARFDebugLine.cpp:1365
llvm::DWARFDebugLine::LineTable::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
Definition:DWARFDebugLine.cpp:538
llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta
Definition:DWARFDebugLine.h:382
llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta::AddrOffset
uint64_t AddrOffset
Definition:DWARFDebugLine.h:383
llvm::DWARFDebugLine::ParsingState::AddrOpIndexDelta::OpIndexDelta
int16_t OpIndexDelta
Definition:DWARFDebugLine.h:384
llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults
Definition:DWARFDebugLine.h:392
llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::AdjustedOpcode
uint8_t AdjustedOpcode
Definition:DWARFDebugLine.h:395
llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::OpIndexDelta
int16_t OpIndexDelta
Definition:DWARFDebugLine.h:394
llvm::DWARFDebugLine::ParsingState::OpcodeAdvanceResults::AddrDelta
uint64_t AddrDelta
Definition:DWARFDebugLine.h:393
llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta
Definition:DWARFDebugLine.h:403
llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::Address
uint64_t Address
Definition:DWARFDebugLine.h:404
llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::Line
int32_t Line
Definition:DWARFDebugLine.h:405
llvm::DWARFDebugLine::ParsingState::SpecialOpcodeDelta::OpIndex
int16_t OpIndex
Definition:DWARFDebugLine.h:406
llvm::DWARFDebugLine::Prologue
Definition:DWARFDebugLine.h:59
llvm::DWARFDebugLine::Prologue::hasFileAtIndex
bool hasFileAtIndex(uint64_t FileIndex) const
Definition:DWARFDebugLine.cpp:72
llvm::DWARFDebugLine::Prologue::clear
void clear()
Definition:DWARFDebugLine.cpp:105
llvm::DWARFDebugLine::Prologue::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const
Definition:DWARFDebugLine.cpp:117
llvm::DWARFDebugLine::Prologue::sizeofTotalLength
uint32_t sizeofTotalLength() const
Definition:DWARFDebugLine.h:100
llvm::DWARFDebugLine::Prologue::getVersion
uint16_t getVersion() const
Definition:DWARFDebugLine.h:96
llvm::DWARFDebugLine::Prologue::getLastValidFileIndex
std::optional< uint64_t > getLastValidFileIndex() const
Definition:DWARFDebugLine.cpp:82
llvm::DWARFDebugLine::Prologue::parse
Error parse(DWARFDataExtractor Data, uint64_t *OffsetPtr, function_ref< void(Error)> RecoverableErrorHandler, const DWARFContext &Ctx, const DWARFUnit *U=nullptr)
Definition:DWARFDebugLine.cpp:363
llvm::DWARFDebugLine::Prologue::Prologue
Prologue()
Definition:DWARFDebugLine.cpp:70
llvm::DWARFDebugLine::Prologue::IncludeDirectories
std::vector< DWARFFormValue > IncludeDirectories
Definition:DWARFDebugLine.h:92
llvm::DWARFDebugLine::Prologue::OpcodeBase
uint8_t OpcodeBase
The number assigned to the first special opcode.
Definition:DWARFDebugLine.h:88
llvm::DWARFDebugLine::Prologue::StandardOpcodeLengths
std::vector< uint8_t > StandardOpcodeLengths
Definition:DWARFDebugLine.h:91
llvm::DWARFDebugLine::Prologue::totalLengthIsValid
bool totalLengthIsValid() const
Definition:DWARFDebugLine.cpp:1561
llvm::DWARFDebugLine::Prologue::getAddressSize
uint8_t getAddressSize() const
Definition:DWARFDebugLine.h:97
llvm::DWARFDebugLine::Prologue::getFileNameEntry
const llvm::DWARFDebugLine::FileNameEntry & getFileNameEntry(uint64_t Index) const
Get DWARF-version aware access to the file name entry at the provided index.
Definition:DWARFDebugLine.cpp:95
llvm::DWARFDebugLine::Prologue::getFileNameByIndex
bool getFileNameByIndex(uint64_t FileIndex, StringRef CompDir, DILineInfoSpecifier::FileLineInfoKind Kind, std::string &Result, sys::path::Style Style=sys::path::Style::native) const
Definition:DWARFDebugLine.cpp:1448
llvm::DWARFDebugLine::Prologue::TotalLength
uint64_t TotalLength
The size in bytes of the statement information for this compilation unit (not including the total_len...
Definition:DWARFDebugLine.h:64
llvm::DWARFDebugLine::Prologue::getLength
uint64_t getLength() const
Length of the prologue in bytes.
Definition:DWARFDebugLine.cpp:355
llvm::DWARFDebugLine::Prologue::FileNames
std::vector< FileNameEntry > FileNames
Definition:DWARFDebugLine.h:93
llvm::DWARFDebugLine::Row
Standard .debug_line state machine structure.
Definition:DWARFDebugLine.h:132
llvm::DWARFDebugLine::Row::orderByAddress
static bool orderByAddress(const Row &LHS, const Row &RHS)
Definition:DWARFDebugLine.h:142
llvm::DWARFDebugLine::Row::Line
uint32_t Line
An unsigned integer indicating a source line number.
Definition:DWARFDebugLine.h:156
llvm::DWARFDebugLine::Row::File
uint16_t File
An unsigned integer indicating the identity of the source file corresponding to a machine instruction...
Definition:DWARFDebugLine.h:163
llvm::DWARFDebugLine::Row::Discriminator
uint32_t Discriminator
An unsigned integer representing the DWARF path discriminator value for this location.
Definition:DWARFDebugLine.h:166
llvm::DWARFDebugLine::Row::Address
object::SectionedAddress Address
The program-counter value corresponding to a machine instruction generated by the compiler and sectio...
Definition:DWARFDebugLine.h:152
llvm::DWARFDebugLine::Row::postAppend
void postAppend()
Called after a row is appended to the matrix.
Definition:DWARFDebugLine.cpp:484
llvm::DWARFDebugLine::Row::Column
uint16_t Column
An unsigned integer indicating a column number within a source line.
Definition:DWARFDebugLine.h:160
llvm::DWARFDebugLine::Row::dumpTableHeader
static void dumpTableHeader(raw_ostream &OS, unsigned Indent)
Definition:DWARFDebugLine.cpp:507
llvm::DWARFDebugLine::Row::reset
void reset(bool DefaultIsStmt)
Definition:DWARFDebugLine.cpp:491
llvm::DWARFDebugLine::Row::Row
Row(bool DefaultIsStmt=false)
Definition:DWARFDebugLine.cpp:482
llvm::DWARFDebugLine::Row::dump
void dump(raw_ostream &OS) const
Definition:DWARFDebugLine.cpp:516
llvm::DWARFDebugLine::Sequence
Represents a series of contiguous machine instructions.
Definition:DWARFDebugLine.h:197
llvm::DWARFDebugLine::Sequence::LastRowIndex
unsigned LastRowIndex
Definition:DWARFDebugLine.h:209
llvm::DWARFDebugLine::Sequence::orderByHighPC
static bool orderByHighPC(const Sequence &LHS, const Sequence &RHS)
Definition:DWARFDebugLine.h:214
llvm::DWARFDebugLine::Sequence::FirstRowIndex
unsigned FirstRowIndex
Definition:DWARFDebugLine.h:208
llvm::DWARFDebugLine::Sequence::reset
void reset()
Definition:DWARFDebugLine.cpp:527
llvm::DWARFDebugLine::Sequence::Sequence
Sequence()
Definition:DWARFDebugLine.cpp:525
llvm::DWARFDebugLine::Sequence::containsPC
bool containsPC(object::SectionedAddress PC) const
Definition:DWARFDebugLine.h:223
llvm::DWARFDebugLine::Sequence::HighPC
uint64_t HighPC
Definition:DWARFDebugLine.h:203
llvm::DWARFDebugLine::Sequence::SectionIndex
uint64_t SectionIndex
If relocation information is present then this is the index of the section which contains above addre...
Definition:DWARFDebugLine.h:207
llvm::MD5::MD5Result::digest
SmallString< 32 > digest() const
Definition:MD5.cpp:281
llvm::dwarf::FormParams
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition:Dwarf.h:1084
llvm::dwarf::FormParams::Format
DwarfFormat Format
Definition:Dwarf.h:1087
llvm::dwarf::FormParams::AddrSize
uint8_t AddrSize
Definition:Dwarf.h:1086
llvm::dwarf::FormParams::Version
uint16_t Version
Definition:Dwarf.h:1085
llvm::object::SectionedAddress
Definition:ObjectFile.h:145
llvm::object::SectionedAddress::Address
uint64_t Address
Definition:ObjectFile.h:148
llvm::object::SectionedAddress::UndefSection
static const uint64_t UndefSection
Definition:ObjectFile.h:146

Generated on Fri Jul 18 2025 11:09:18 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp