LLVM  13.0.0git
CodeViewYAMLDebugSections.cpp
Go to the documentation of this file.
1 //===- CodeViewYAMLDebugSections.cpp - CodeView YAMLIO debug sections -----===//
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 // This file defines classes for handling the YAML representation of CodeView
10 // Debug Info.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/ADT/StringExtras.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/BinaryFormat/COFF.h"
36 #include "llvm/Support/Allocator.h"
38 #include "llvm/Support/Endian.h"
39 #include "llvm/Support/Error.h"
43 #include <algorithm>
44 #include <cassert>
45 #include <cstdint>
46 #include <memory>
47 #include <string>
48 #include <tuple>
49 #include <vector>
50 
51 using namespace llvm;
52 using namespace llvm::codeview;
53 using namespace llvm::CodeViewYAML;
54 using namespace llvm::CodeViewYAML::detail;
55 using namespace llvm::yaml;
56 
67 
72 
82 
83 namespace llvm {
84 namespace CodeViewYAML {
85 namespace detail {
86 
89  virtual ~YAMLSubsectionBase() = default;
90 
91  virtual void map(IO &IO) = 0;
92  virtual std::shared_ptr<DebugSubsection>
93  toCodeViewSubsection(BumpPtrAllocator &Allocator,
94  const codeview::StringsAndChecksums &SC) const = 0;
95 
97 };
98 
99 } // end namespace detail
100 } // end namespace CodeViewYAML
101 } // end namespace llvm
102 
103 namespace {
104 
105 struct YAMLChecksumsSubsection : public YAMLSubsectionBase {
106  YAMLChecksumsSubsection()
108 
109  void map(IO &IO) override;
110  std::shared_ptr<DebugSubsection>
111  toCodeViewSubsection(BumpPtrAllocator &Allocator,
112  const codeview::StringsAndChecksums &SC) const override;
114  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,
116 
117  std::vector<SourceFileChecksumEntry> Checksums;
118 };
119 
120 struct YAMLLinesSubsection : public YAMLSubsectionBase {
121  YAMLLinesSubsection() : YAMLSubsectionBase(DebugSubsectionKind::Lines) {}
122 
123  void map(IO &IO) override;
124  std::shared_ptr<DebugSubsection>
125  toCodeViewSubsection(BumpPtrAllocator &Allocator,
126  const codeview::StringsAndChecksums &SC) const override;
128  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,
129  const DebugChecksumsSubsectionRef &Checksums,
130  const DebugLinesSubsectionRef &Lines);
131 
133 };
134 
135 struct YAMLInlineeLinesSubsection : public YAMLSubsectionBase {
136  YAMLInlineeLinesSubsection()
138 
139  void map(IO &IO) override;
140  std::shared_ptr<DebugSubsection>
141  toCodeViewSubsection(BumpPtrAllocator &Allocator,
142  const codeview::StringsAndChecksums &SC) const override;
144  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,
145  const DebugChecksumsSubsectionRef &Checksums,
146  const DebugInlineeLinesSubsectionRef &Lines);
147 
149 };
150 
151 struct YAMLCrossModuleExportsSubsection : public YAMLSubsectionBase {
152  YAMLCrossModuleExportsSubsection()
154 
155  void map(IO &IO) override;
156  std::shared_ptr<DebugSubsection>
157  toCodeViewSubsection(BumpPtrAllocator &Allocator,
158  const codeview::StringsAndChecksums &SC) const override;
160  fromCodeViewSubsection(const DebugCrossModuleExportsSubsectionRef &Exports);
161 
162  std::vector<CrossModuleExport> Exports;
163 };
164 
165 struct YAMLCrossModuleImportsSubsection : public YAMLSubsectionBase {
166  YAMLCrossModuleImportsSubsection()
168 
169  void map(IO &IO) override;
170  std::shared_ptr<DebugSubsection>
171  toCodeViewSubsection(BumpPtrAllocator &Allocator,
172  const codeview::StringsAndChecksums &SC) const override;
174  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,
175  const DebugCrossModuleImportsSubsectionRef &Imports);
176 
177  std::vector<YAMLCrossModuleImport> Imports;
178 };
179 
180 struct YAMLSymbolsSubsection : public YAMLSubsectionBase {
181  YAMLSymbolsSubsection() : YAMLSubsectionBase(DebugSubsectionKind::Symbols) {}
182 
183  void map(IO &IO) override;
184  std::shared_ptr<DebugSubsection>
185  toCodeViewSubsection(BumpPtrAllocator &Allocator,
186  const codeview::StringsAndChecksums &SC) const override;
188  fromCodeViewSubsection(const DebugSymbolsSubsectionRef &Symbols);
189 
190  std::vector<CodeViewYAML::SymbolRecord> Symbols;
191 };
192 
193 struct YAMLStringTableSubsection : public YAMLSubsectionBase {
194  YAMLStringTableSubsection()
196 
197  void map(IO &IO) override;
198  std::shared_ptr<DebugSubsection>
199  toCodeViewSubsection(BumpPtrAllocator &Allocator,
200  const codeview::StringsAndChecksums &SC) const override;
202  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings);
203 
204  std::vector<StringRef> Strings;
205 };
206 
207 struct YAMLFrameDataSubsection : public YAMLSubsectionBase {
208  YAMLFrameDataSubsection()
210 
211  void map(IO &IO) override;
212  std::shared_ptr<DebugSubsection>
213  toCodeViewSubsection(BumpPtrAllocator &Allocator,
214  const codeview::StringsAndChecksums &SC) const override;
216  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,
217  const DebugFrameDataSubsectionRef &Frames);
218 
219  std::vector<YAMLFrameData> Frames;
220 };
221 
222 struct YAMLCoffSymbolRVASubsection : public YAMLSubsectionBase {
223  YAMLCoffSymbolRVASubsection()
225 
226  void map(IO &IO) override;
227  std::shared_ptr<DebugSubsection>
228  toCodeViewSubsection(BumpPtrAllocator &Allocator,
229  const codeview::StringsAndChecksums &SC) const override;
231  fromCodeViewSubsection(const DebugSymbolRVASubsectionRef &RVAs);
232 
233  std::vector<uint32_t> RVAs;
234 };
235 
236 } // end anonymous namespace
237 
238 void ScalarBitSetTraits<LineFlags>::bitset(IO &io, LineFlags &Flags) {
239  io.bitSetCase(Flags, "HasColumnInfo", LF_HaveColumns);
240  io.enumFallback<Hex16>(Flags);
241 }
242 
243 void ScalarEnumerationTraits<FileChecksumKind>::enumeration(
244  IO &io, FileChecksumKind &Kind) {
245  io.enumCase(Kind, "None", FileChecksumKind::None);
246  io.enumCase(Kind, "MD5", FileChecksumKind::MD5);
247  io.enumCase(Kind, "SHA1", FileChecksumKind::SHA1);
248  io.enumCase(Kind, "SHA256", FileChecksumKind::SHA256);
249 }
250 
252  void *ctx, raw_ostream &Out) {
253  StringRef Bytes(reinterpret_cast<const char *>(Value.Bytes.data()),
254  Value.Bytes.size());
255  Out << toHex(Bytes);
256 }
257 
260  std::string H = fromHex(Scalar);
261  Value.Bytes.assign(H.begin(), H.end());
262  return StringRef();
263 }
264 
266  IO.mapRequired("Offset", Obj.Offset);
267  IO.mapRequired("LineStart", Obj.LineStart);
268  IO.mapRequired("IsStatement", Obj.IsStatement);
269  IO.mapRequired("EndDelta", Obj.EndDelta);
270 }
271 
273  IO.mapRequired("StartColumn", Obj.StartColumn);
274  IO.mapRequired("EndColumn", Obj.EndColumn);
275 }
276 
278  IO.mapRequired("FileName", Obj.FileName);
279  IO.mapRequired("Lines", Obj.Lines);
280  IO.mapRequired("Columns", Obj.Columns);
281 }
282 
284  IO.mapRequired("LocalId", Obj.Local);
285  IO.mapRequired("GlobalId", Obj.Global);
286 }
287 
289  YAMLCrossModuleImport &Obj) {
290  IO.mapRequired("Module", Obj.ModuleName);
291  IO.mapRequired("Imports", Obj.ImportIds);
292 }
293 
295  IO &IO, SourceFileChecksumEntry &Obj) {
296  IO.mapRequired("FileName", Obj.FileName);
297  IO.mapRequired("Kind", Obj.Kind);
298  IO.mapRequired("Checksum", Obj.ChecksumBytes);
299 }
300 
302  IO.mapRequired("FileName", Obj.FileName);
303  IO.mapRequired("LineNum", Obj.SourceLineNum);
304  IO.mapRequired("Inlinee", Obj.Inlinee);
305  IO.mapOptional("ExtraFiles", Obj.ExtraFiles);
306 }
307 
309  IO.mapRequired("CodeSize", Obj.CodeSize);
310  IO.mapRequired("FrameFunc", Obj.FrameFunc);
311  IO.mapRequired("LocalSize", Obj.LocalSize);
312  IO.mapOptional("MaxStackSize", Obj.MaxStackSize);
313  IO.mapOptional("ParamsSize", Obj.ParamsSize);
314  IO.mapOptional("PrologSize", Obj.PrologSize);
315  IO.mapOptional("RvaStart", Obj.RvaStart);
316  IO.mapOptional("SavedRegsSize", Obj.SavedRegsSize);
317 }
318 
319 void YAMLChecksumsSubsection::map(IO &IO) {
320  IO.mapTag("!FileChecksums", true);
321  IO.mapRequired("Checksums", Checksums);
322 }
323 
324 void YAMLLinesSubsection::map(IO &IO) {
325  IO.mapTag("!Lines", true);
326  IO.mapRequired("CodeSize", Lines.CodeSize);
327 
328  IO.mapRequired("Flags", Lines.Flags);
329  IO.mapRequired("RelocOffset", Lines.RelocOffset);
330  IO.mapRequired("RelocSegment", Lines.RelocSegment);
331  IO.mapRequired("Blocks", Lines.Blocks);
332 }
333 
334 void YAMLInlineeLinesSubsection::map(IO &IO) {
335  IO.mapTag("!InlineeLines", true);
336  IO.mapRequired("HasExtraFiles", InlineeLines.HasExtraFiles);
337  IO.mapRequired("Sites", InlineeLines.Sites);
338 }
339 
340 void YAMLCrossModuleExportsSubsection::map(IO &IO) {
341  IO.mapTag("!CrossModuleExports", true);
342  IO.mapOptional("Exports", Exports);
343 }
344 
345 void YAMLCrossModuleImportsSubsection::map(IO &IO) {
346  IO.mapTag("!CrossModuleImports", true);
347  IO.mapOptional("Imports", Imports);
348 }
349 
350 void YAMLSymbolsSubsection::map(IO &IO) {
351  IO.mapTag("!Symbols", true);
352  IO.mapRequired("Records", Symbols);
353 }
354 
355 void YAMLStringTableSubsection::map(IO &IO) {
356  IO.mapTag("!StringTable", true);
357  IO.mapRequired("Strings", Strings);
358 }
359 
360 void YAMLFrameDataSubsection::map(IO &IO) {
361  IO.mapTag("!FrameData", true);
362  IO.mapRequired("Frames", Frames);
363 }
364 
365 void YAMLCoffSymbolRVASubsection::map(IO &IO) {
366  IO.mapTag("!COFFSymbolRVAs", true);
367  IO.mapRequired("RVAs", RVAs);
368 }
369 
371  IO &IO, YAMLDebugSubsection &Subsection) {
372  if (!IO.outputting()) {
373  if (IO.mapTag("!FileChecksums")) {
374  auto SS = std::make_shared<YAMLChecksumsSubsection>();
375  Subsection.Subsection = SS;
376  } else if (IO.mapTag("!Lines")) {
377  Subsection.Subsection = std::make_shared<YAMLLinesSubsection>();
378  } else if (IO.mapTag("!InlineeLines")) {
379  Subsection.Subsection = std::make_shared<YAMLInlineeLinesSubsection>();
380  } else if (IO.mapTag("!CrossModuleExports")) {
381  Subsection.Subsection =
382  std::make_shared<YAMLCrossModuleExportsSubsection>();
383  } else if (IO.mapTag("!CrossModuleImports")) {
384  Subsection.Subsection =
385  std::make_shared<YAMLCrossModuleImportsSubsection>();
386  } else if (IO.mapTag("!Symbols")) {
387  Subsection.Subsection = std::make_shared<YAMLSymbolsSubsection>();
388  } else if (IO.mapTag("!StringTable")) {
389  Subsection.Subsection = std::make_shared<YAMLStringTableSubsection>();
390  } else if (IO.mapTag("!FrameData")) {
391  Subsection.Subsection = std::make_shared<YAMLFrameDataSubsection>();
392  } else if (IO.mapTag("!COFFSymbolRVAs")) {
393  Subsection.Subsection = std::make_shared<YAMLCoffSymbolRVASubsection>();
394  } else {
395  llvm_unreachable("Unexpected subsection tag!");
396  }
397  }
398  Subsection.Subsection->map(IO);
399 }
400 
401 std::shared_ptr<DebugSubsection> YAMLChecksumsSubsection::toCodeViewSubsection(
403  const codeview::StringsAndChecksums &SC) const {
404  assert(SC.hasStrings());
405  auto Result = std::make_shared<DebugChecksumsSubsection>(*SC.strings());
406  for (const auto &CS : Checksums) {
407  Result->addChecksum(CS.FileName, CS.Kind, CS.ChecksumBytes.Bytes);
408  }
409  return Result;
410 }
411 
412 std::shared_ptr<DebugSubsection> YAMLLinesSubsection::toCodeViewSubsection(
414  const codeview::StringsAndChecksums &SC) const {
415  assert(SC.hasStrings() && SC.hasChecksums());
416  auto Result =
417  std::make_shared<DebugLinesSubsection>(*SC.checksums(), *SC.strings());
418  Result->setCodeSize(Lines.CodeSize);
419  Result->setRelocationAddress(Lines.RelocSegment, Lines.RelocOffset);
420  Result->setFlags(Lines.Flags);
421  for (const auto &LC : Lines.Blocks) {
422  Result->createBlock(LC.FileName);
423  if (Result->hasColumnInfo()) {
424  for (auto Item : zip(LC.Lines, LC.Columns)) {
425  auto &L = std::get<0>(Item);
426  auto &C = std::get<1>(Item);
427  uint32_t LE = L.LineStart + L.EndDelta;
428  Result->addLineAndColumnInfo(L.Offset,
429  LineInfo(L.LineStart, LE, L.IsStatement),
430  C.StartColumn, C.EndColumn);
431  }
432  } else {
433  for (const auto &L : LC.Lines) {
434  uint32_t LE = L.LineStart + L.EndDelta;
435  Result->addLineInfo(L.Offset, LineInfo(L.LineStart, LE, L.IsStatement));
436  }
437  }
438  }
439  return Result;
440 }
441 
442 std::shared_ptr<DebugSubsection>
443 YAMLInlineeLinesSubsection::toCodeViewSubsection(
445  const codeview::StringsAndChecksums &SC) const {
446  assert(SC.hasChecksums());
447  auto Result = std::make_shared<DebugInlineeLinesSubsection>(
448  *SC.checksums(), InlineeLines.HasExtraFiles);
449 
450  for (const auto &Site : InlineeLines.Sites) {
451  Result->addInlineSite(TypeIndex(Site.Inlinee), Site.FileName,
452  Site.SourceLineNum);
453  if (!InlineeLines.HasExtraFiles)
454  continue;
455 
456  for (auto EF : Site.ExtraFiles) {
457  Result->addExtraFile(EF);
458  }
459  }
460  return Result;
461 }
462 
463 std::shared_ptr<DebugSubsection>
464 YAMLCrossModuleExportsSubsection::toCodeViewSubsection(
466  const codeview::StringsAndChecksums &SC) const {
467  auto Result = std::make_shared<DebugCrossModuleExportsSubsection>();
468  for (const auto &M : Exports)
469  Result->addMapping(M.Local, M.Global);
470  return Result;
471 }
472 
473 std::shared_ptr<DebugSubsection>
474 YAMLCrossModuleImportsSubsection::toCodeViewSubsection(
476  const codeview::StringsAndChecksums &SC) const {
477  assert(SC.hasStrings());
478 
479  auto Result =
480  std::make_shared<DebugCrossModuleImportsSubsection>(*SC.strings());
481  for (const auto &M : Imports) {
482  for (const auto Id : M.ImportIds)
483  Result->addImport(M.ModuleName, Id);
484  }
485  return Result;
486 }
487 
488 std::shared_ptr<DebugSubsection> YAMLSymbolsSubsection::toCodeViewSubsection(
490  const codeview::StringsAndChecksums &SC) const {
491  auto Result = std::make_shared<DebugSymbolsSubsection>();
492  for (const auto &Sym : Symbols)
493  Result->addSymbol(
494  Sym.toCodeViewSymbol(Allocator, CodeViewContainer::ObjectFile));
495  return Result;
496 }
497 
498 std::shared_ptr<DebugSubsection>
499 YAMLStringTableSubsection::toCodeViewSubsection(
501  const codeview::StringsAndChecksums &SC) const {
502  auto Result = std::make_shared<DebugStringTableSubsection>();
503  for (const auto &Str : this->Strings)
504  Result->insert(Str);
505  return Result;
506 }
507 
508 std::shared_ptr<DebugSubsection> YAMLFrameDataSubsection::toCodeViewSubsection(
510  const codeview::StringsAndChecksums &SC) const {
511  assert(SC.hasStrings());
512 
513  auto Result = std::make_shared<DebugFrameDataSubsection>(true);
514  for (const auto &YF : Frames) {
516  F.CodeSize = YF.CodeSize;
517  F.Flags = YF.Flags;
518  F.LocalSize = YF.LocalSize;
519  F.MaxStackSize = YF.MaxStackSize;
520  F.ParamsSize = YF.ParamsSize;
521  F.PrologSize = YF.PrologSize;
522  F.RvaStart = YF.RvaStart;
523  F.SavedRegsSize = YF.SavedRegsSize;
524  F.FrameFunc = SC.strings()->insert(YF.FrameFunc);
525  Result->addFrameData(F);
526  }
527  return Result;
528 }
529 
530 std::shared_ptr<DebugSubsection>
531 YAMLCoffSymbolRVASubsection::toCodeViewSubsection(
533  const codeview::StringsAndChecksums &SC) const {
534  auto Result = std::make_shared<DebugSymbolRVASubsection>();
535  for (const auto &RVA : RVAs)
536  Result->addRVA(RVA);
537  return Result;
538 }
539 
542  const FileChecksumEntry &CS) {
543  auto ExpectedString = Strings.getString(CS.FileNameOffset);
544  if (!ExpectedString)
545  return ExpectedString.takeError();
546 
548  Result.ChecksumBytes.Bytes = CS.Checksum;
549  Result.Kind = CS.Kind;
550  Result.FileName = *ExpectedString;
551  return Result;
552 }
553 
554 static Expected<StringRef>
556  const DebugChecksumsSubsectionRef &Checksums, uint32_t FileID) {
557  auto Iter = Checksums.getArray().at(FileID);
558  if (Iter == Checksums.getArray().end())
559  return make_error<CodeViewError>(cv_error_code::no_records);
560  uint32_t Offset = Iter->FileNameOffset;
561  return Strings.getString(Offset);
562 }
563 
565 YAMLChecksumsSubsection::fromCodeViewSubsection(
566  const DebugStringTableSubsectionRef &Strings,
568  auto Result = std::make_shared<YAMLChecksumsSubsection>();
569 
570  for (const auto &CS : FC) {
571  auto ConvertedCS = convertOneChecksum(Strings, CS);
572  if (!ConvertedCS)
573  return ConvertedCS.takeError();
574  Result->Checksums.push_back(*ConvertedCS);
575  }
576  return Result;
577 }
578 
580 YAMLLinesSubsection::fromCodeViewSubsection(
581  const DebugStringTableSubsectionRef &Strings,
582  const DebugChecksumsSubsectionRef &Checksums,
583  const DebugLinesSubsectionRef &Lines) {
584  auto Result = std::make_shared<YAMLLinesSubsection>();
585  Result->Lines.CodeSize = Lines.header()->CodeSize;
586  Result->Lines.RelocOffset = Lines.header()->RelocOffset;
587  Result->Lines.RelocSegment = Lines.header()->RelocSegment;
588  Result->Lines.Flags = static_cast<LineFlags>(uint16_t(Lines.header()->Flags));
589  for (const auto &L : Lines) {
591  auto EF = getFileName(Strings, Checksums, L.NameIndex);
592  if (!EF)
593  return EF.takeError();
594  Block.FileName = *EF;
595  if (Lines.hasColumnInfo()) {
596  for (const auto &C : L.Columns) {
598  SCE.EndColumn = C.EndColumn;
599  SCE.StartColumn = C.StartColumn;
600  Block.Columns.push_back(SCE);
601  }
602  }
603  for (const auto &LN : L.LineNumbers) {
604  SourceLineEntry SLE;
605  LineInfo LI(LN.Flags);
606  SLE.Offset = LN.Offset;
607  SLE.LineStart = LI.getStartLine();
608  SLE.EndDelta = LI.getLineDelta();
609  SLE.IsStatement = LI.isStatement();
610  Block.Lines.push_back(SLE);
611  }
612  Result->Lines.Blocks.push_back(Block);
613  }
614  return Result;
615 }
616 
618 YAMLInlineeLinesSubsection::fromCodeViewSubsection(
619  const DebugStringTableSubsectionRef &Strings,
620  const DebugChecksumsSubsectionRef &Checksums,
621  const DebugInlineeLinesSubsectionRef &Lines) {
622  auto Result = std::make_shared<YAMLInlineeLinesSubsection>();
623 
624  Result->InlineeLines.HasExtraFiles = Lines.hasExtraFiles();
625  for (const auto &IL : Lines) {
626  InlineeSite Site;
627  auto ExpF = getFileName(Strings, Checksums, IL.Header->FileID);
628  if (!ExpF)
629  return ExpF.takeError();
630  Site.FileName = *ExpF;
631  Site.Inlinee = IL.Header->Inlinee.getIndex();
632  Site.SourceLineNum = IL.Header->SourceLineNum;
633  if (Lines.hasExtraFiles()) {
634  for (const auto EF : IL.ExtraFiles) {
635  auto ExpF2 = getFileName(Strings, Checksums, EF);
636  if (!ExpF2)
637  return ExpF2.takeError();
638  Site.ExtraFiles.push_back(*ExpF2);
639  }
640  }
641  Result->InlineeLines.Sites.push_back(Site);
642  }
643  return Result;
644 }
645 
647 YAMLCrossModuleExportsSubsection::fromCodeViewSubsection(
648  const DebugCrossModuleExportsSubsectionRef &Exports) {
649  auto Result = std::make_shared<YAMLCrossModuleExportsSubsection>();
650  Result->Exports.assign(Exports.begin(), Exports.end());
651  return Result;
652 }
653 
655 YAMLCrossModuleImportsSubsection::fromCodeViewSubsection(
656  const DebugStringTableSubsectionRef &Strings,
657  const DebugCrossModuleImportsSubsectionRef &Imports) {
658  auto Result = std::make_shared<YAMLCrossModuleImportsSubsection>();
659  for (const auto &CMI : Imports) {
661  auto ExpectedStr = Strings.getString(CMI.Header->ModuleNameOffset);
662  if (!ExpectedStr)
663  return ExpectedStr.takeError();
664  YCMI.ModuleName = *ExpectedStr;
665  YCMI.ImportIds.assign(CMI.Imports.begin(), CMI.Imports.end());
666  Result->Imports.push_back(YCMI);
667  }
668  return Result;
669 }
670 
672 YAMLSymbolsSubsection::fromCodeViewSubsection(
673  const DebugSymbolsSubsectionRef &Symbols) {
674  auto Result = std::make_shared<YAMLSymbolsSubsection>();
675  for (const auto &Sym : Symbols) {
677  if (!S)
678  return joinErrors(make_error<CodeViewError>(
680  "Invalid CodeView Symbol Record in SymbolRecord "
681  "subsection of .debug$S while converting to YAML!"),
682  S.takeError());
683 
684  Result->Symbols.push_back(*S);
685  }
686  return Result;
687 }
688 
690 YAMLStringTableSubsection::fromCodeViewSubsection(
691  const DebugStringTableSubsectionRef &Strings) {
692  auto Result = std::make_shared<YAMLStringTableSubsection>();
693  BinaryStreamReader Reader(Strings.getBuffer());
694  StringRef S;
695  // First item is a single null string, skip it.
696  if (auto EC = Reader.readCString(S))
697  return std::move(EC);
698  assert(S.empty());
699  while (Reader.bytesRemaining() > 0) {
700  if (auto EC = Reader.readCString(S))
701  return std::move(EC);
702  Result->Strings.push_back(S);
703  }
704  return Result;
705 }
706 
708 YAMLFrameDataSubsection::fromCodeViewSubsection(
709  const DebugStringTableSubsectionRef &Strings,
710  const DebugFrameDataSubsectionRef &Frames) {
711  auto Result = std::make_shared<YAMLFrameDataSubsection>();
712  for (const auto &F : Frames) {
713  YAMLFrameData YF;
714  YF.CodeSize = F.CodeSize;
715  YF.Flags = F.Flags;
716  YF.LocalSize = F.LocalSize;
717  YF.MaxStackSize = F.MaxStackSize;
718  YF.ParamsSize = F.ParamsSize;
719  YF.PrologSize = F.PrologSize;
720  YF.RvaStart = F.RvaStart;
721  YF.SavedRegsSize = F.SavedRegsSize;
722 
723  auto ES = Strings.getString(F.FrameFunc);
724  if (!ES)
725  return joinErrors(
726  make_error<CodeViewError>(
728  "Could not find string for string id while mapping FrameData!"),
729  ES.takeError());
730  YF.FrameFunc = *ES;
731  Result->Frames.push_back(YF);
732  }
733  return Result;
734 }
735 
737 YAMLCoffSymbolRVASubsection::fromCodeViewSubsection(
739  auto Result = std::make_shared<YAMLCoffSymbolRVASubsection>();
740  for (const auto &RVA : Section) {
741  Result->RVAs.push_back(RVA);
742  }
743  return Result;
744 }
745 
750  std::vector<std::shared_ptr<DebugSubsection>> Result;
751  if (Subsections.empty())
752  return std::move(Result);
753 
754  for (const auto &SS : Subsections) {
755  std::shared_ptr<DebugSubsection> CVS;
756  CVS = SS.Subsection->toCodeViewSubsection(Allocator, SC);
757  assert(CVS != nullptr);
758  Result.push_back(std::move(CVS));
759  }
760  return std::move(Result);
761 }
762 
763 namespace {
764 
765 struct SubsectionConversionVisitor : public DebugSubsectionVisitor {
766  SubsectionConversionVisitor() = default;
767 
768  Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override;
769  Error visitLines(DebugLinesSubsectionRef &Lines,
770  const StringsAndChecksumsRef &State) override;
771  Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums,
772  const StringsAndChecksumsRef &State) override;
773  Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees,
774  const StringsAndChecksumsRef &State) override;
775  Error visitCrossModuleExports(DebugCrossModuleExportsSubsectionRef &Checksums,
776  const StringsAndChecksumsRef &State) override;
777  Error visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &Inlinees,
778  const StringsAndChecksumsRef &State) override;
779  Error visitStringTable(DebugStringTableSubsectionRef &ST,
780  const StringsAndChecksumsRef &State) override;
781  Error visitSymbols(DebugSymbolsSubsectionRef &Symbols,
782  const StringsAndChecksumsRef &State) override;
783  Error visitFrameData(DebugFrameDataSubsectionRef &Symbols,
784  const StringsAndChecksumsRef &State) override;
785  Error visitCOFFSymbolRVAs(DebugSymbolRVASubsectionRef &Symbols,
786  const StringsAndChecksumsRef &State) override;
787 
788  YAMLDebugSubsection Subsection;
789 };
790 
791 } // end anonymous namespace
792 
793 Error SubsectionConversionVisitor::visitUnknown(
794  DebugUnknownSubsectionRef &Unknown) {
795  return make_error<CodeViewError>(cv_error_code::operation_unsupported);
796 }
797 
798 Error SubsectionConversionVisitor::visitLines(
799  DebugLinesSubsectionRef &Lines, const StringsAndChecksumsRef &State) {
800  auto Result = YAMLLinesSubsection::fromCodeViewSubsection(
801  State.strings(), State.checksums(), Lines);
802  if (!Result)
803  return Result.takeError();
804  Subsection.Subsection = *Result;
805  return Error::success();
806 }
807 
808 Error SubsectionConversionVisitor::visitFileChecksums(
809  DebugChecksumsSubsectionRef &Checksums,
810  const StringsAndChecksumsRef &State) {
811  auto Result = YAMLChecksumsSubsection::fromCodeViewSubsection(State.strings(),
812  Checksums);
813  if (!Result)
814  return Result.takeError();
815  Subsection.Subsection = *Result;
816  return Error::success();
817 }
818 
819 Error SubsectionConversionVisitor::visitInlineeLines(
821  const StringsAndChecksumsRef &State) {
822  auto Result = YAMLInlineeLinesSubsection::fromCodeViewSubsection(
823  State.strings(), State.checksums(), Inlinees);
824  if (!Result)
825  return Result.takeError();
826  Subsection.Subsection = *Result;
827  return Error::success();
828 }
829 
830 Error SubsectionConversionVisitor::visitCrossModuleExports(
832  const StringsAndChecksumsRef &State) {
833  auto Result =
834  YAMLCrossModuleExportsSubsection::fromCodeViewSubsection(Exports);
835  if (!Result)
836  return Result.takeError();
837  Subsection.Subsection = *Result;
838  return Error::success();
839 }
840 
841 Error SubsectionConversionVisitor::visitCrossModuleImports(
843  const StringsAndChecksumsRef &State) {
844  auto Result = YAMLCrossModuleImportsSubsection::fromCodeViewSubsection(
845  State.strings(), Imports);
846  if (!Result)
847  return Result.takeError();
848  Subsection.Subsection = *Result;
849  return Error::success();
850 }
851 
852 Error SubsectionConversionVisitor::visitStringTable(
854  const StringsAndChecksumsRef &State) {
855  auto Result = YAMLStringTableSubsection::fromCodeViewSubsection(Strings);
856  if (!Result)
857  return Result.takeError();
858  Subsection.Subsection = *Result;
859  return Error::success();
860 }
861 
862 Error SubsectionConversionVisitor::visitSymbols(
863  DebugSymbolsSubsectionRef &Symbols, const StringsAndChecksumsRef &State) {
864  auto Result = YAMLSymbolsSubsection::fromCodeViewSubsection(Symbols);
865  if (!Result)
866  return Result.takeError();
867  Subsection.Subsection = *Result;
868  return Error::success();
869 }
870 
871 Error SubsectionConversionVisitor::visitFrameData(
872  DebugFrameDataSubsectionRef &Frames, const StringsAndChecksumsRef &State) {
873  auto Result =
874  YAMLFrameDataSubsection::fromCodeViewSubsection(State.strings(), Frames);
875  if (!Result)
876  return Result.takeError();
877  Subsection.Subsection = *Result;
878  return Error::success();
879 }
880 
881 Error SubsectionConversionVisitor::visitCOFFSymbolRVAs(
883  auto Result = YAMLCoffSymbolRVASubsection::fromCodeViewSubsection(RVAs);
884  if (!Result)
885  return Result.takeError();
886  Subsection.Subsection = *Result;
887  return Error::success();
888 }
889 
891 YAMLDebugSubsection::fromCodeViewSubection(const StringsAndChecksumsRef &SC,
892  const DebugSubsectionRecord &SS) {
893  SubsectionConversionVisitor V;
894  if (auto EC = visitDebugSubsection(SS, V, SC))
895  return std::move(EC);
896 
897  return V.Subsection;
898 }
899 
900 std::vector<YAMLDebugSubsection>
902  const StringsAndChecksumsRef &SC) {
904  uint32_t Magic;
905 
906  ExitOnError Err("Invalid .debug$S section!");
907  Err(Reader.readInteger(Magic));
908  assert(Magic == COFF::DEBUG_SECTION_MAGIC && "Invalid .debug$S section!");
909 
910  DebugSubsectionArray Subsections;
911  Err(Reader.readArray(Subsections, Reader.bytesRemaining()));
912 
913  std::vector<YAMLDebugSubsection> Result;
914 
915  for (const auto &SS : Subsections) {
916  auto YamlSS = Err(YAMLDebugSubsection::fromCodeViewSubection(SC, SS));
917  Result.push_back(YamlSS);
918  }
919  return Result;
920 }
921 
924  // String Table and Checksums subsections don't use the allocator.
926 
927  // It's possible for checksums and strings to even appear in different debug$S
928  // sections, so we have to make this a stateful function that can build up
929  // the strings and checksums field over multiple iterations.
930 
931  // File Checksums require the string table, but may become before it, so we
932  // have to scan for strings first, then scan for checksums again from the
933  // beginning.
934  if (!SC.hasStrings()) {
935  for (const auto &SS : Sections) {
936  if (SS.Subsection->Kind != DebugSubsectionKind::StringTable)
937  continue;
938 
939  auto Result = SS.Subsection->toCodeViewSubsection(Allocator, SC);
940  SC.setStrings(
941  std::static_pointer_cast<DebugStringTableSubsection>(Result));
942  break;
943  }
944  }
945 
946  if (SC.hasStrings() && !SC.hasChecksums()) {
947  for (const auto &SS : Sections) {
948  if (SS.Subsection->Kind != DebugSubsectionKind::FileChecksums)
949  continue;
950 
951  auto Result = SS.Subsection->toCodeViewSubsection(Allocator, SC);
952  SC.setChecksums(
953  std::static_pointer_cast<DebugChecksumsSubsection>(Result));
954  break;
955  }
956  }
957 }
llvm::codeview::DebugUnknownSubsectionRef
Definition: DebugUnknownSubsection.h:18
BinaryStreamReader.h
CodeViewYAMLDebugSections.h
llvm::BinaryStreamReader::bytesRemaining
uint32_t bytesRemaining() const
Definition: BinaryStreamReader.h:257
LLVM_YAML_DECLARE_MAPPING_TRAITS
#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type)
llvm::CodeViewYAML::YAMLCrossModuleImport::ModuleName
StringRef ModuleName
Definition: CodeViewYAMLDebugSections.h:58
llvm::codeview::DebugSubsectionKind::InlineeLines
@ InlineeLines
llvm
Definition: AllocatorList.h:23
llvm::codeview::cv_error_code::operation_unsupported
@ operation_unsupported
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::CodeViewYAML::InlineeSite
Definition: CodeViewYAMLDebugSections.h:98
LLVM_YAML_DECLARE_ENUM_TRAITS
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type)
llvm::CodeViewYAML::YAMLCrossModuleImport::ImportIds
std::vector< uint32_t > ImportIds
Definition: CodeViewYAMLDebugSections.h:59
llvm::codeview::DebugSubsectionKind::CoffSymbolRVA
@ CoffSymbolRVA
llvm::codeview::DebugSubsectionKind::Lines
@ Lines
llvm::CodeViewYAML::YAMLDebugSubsection
Definition: CodeViewYAMLDebugSections.h:110
StringRef.h
DebugSymbolRVASubsection.h
llvm::codeview::StringsAndChecksums
Definition: StringsAndChecksums.h:81
output
Current output
Definition: README.txt:1350
llvm::codeview::LF_HaveColumns
@ LF_HaveColumns
Definition: CodeView.h:565
llvm::CodeViewYAML::detail::YAMLSubsectionBase::YAMLSubsectionBase
YAMLSubsectionBase(DebugSubsectionKind Kind)
Definition: CodeViewYAMLDebugSections.cpp:88
llvm::codeview::FileChecksumKind
FileChecksumKind
Definition: CodeView.h:561
llvm::codeview::DebugFrameDataSubsectionRef
Definition: DebugFrameDataSubsection.h:20
llvm::CodeViewYAML::SourceLineInfo
Definition: CodeViewYAMLDebugSections.h:90
ErrorHandling.h
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
Allocator.h
R600_InstFlag::FC
@ FC
Definition: R600Defines.h:32
Error.h
LLVM_YAML_IS_SEQUENCE_VECTOR
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
COFF.h
llvm::CodeViewYAML::YAMLDebugSubsection::Subsection
std::shared_ptr< detail::YAMLSubsectionBase > Subsection
Definition: CodeViewYAMLDebugSections.h:115
llvm::CodeViewYAML::YAMLFrameData::LocalSize
uint32_t LocalSize
Definition: CodeViewYAMLDebugSections.h:48
CodeViewYAMLSymbols.h
llvm::codeview::FrameData
Data in the SUBSEC_FRAMEDATA subection.
Definition: CodeView.h:569
llvm::ExitOnError
Helper for check-and-exit error handling.
Definition: Error.h:1306
llvm::codeview::FileChecksumEntry::FileNameOffset
uint32_t FileNameOffset
Definition: DebugChecksumsSubsection.h:32
llvm::codeview::DebugSubsectionKind::CrossScopeExports
@ CrossScopeExports
llvm::CodeViewYAML::InlineeSite::Inlinee
uint32_t Inlinee
Definition: CodeViewYAMLDebugSections.h:99
llvm::CodeViewYAML::SourceLineBlock
Definition: CodeViewYAMLDebugSections.h:74
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::VarStreamArray::end
Iterator end() const
Definition: BinaryStreamArray.h:115
llvm::CodeViewYAML::SourceColumnEntry::StartColumn
uint16_t StartColumn
Definition: CodeViewYAMLDebugSections.h:70
llvm::codeview::DebugSubsectionKind::StringTable
@ StringTable
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
STLExtras.h
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:50
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::codeview::CrossModuleImportItem
Definition: DebugCrossImpSubsection.h:28
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
DebugCrossExSubsection.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::codeview::CrossModuleExport
Definition: CodeView.h:593
llvm::CodeViewYAML::YAMLFrameData::FrameFunc
StringRef FrameFunc
Definition: CodeViewYAMLDebugSections.h:51
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::CodeViewYAML::detail
Definition: CodeViewYAMLDebugSections.h:39
llvm::codeview::CrossModuleExport::Local
support::ulittle32_t Local
Definition: CodeView.h:594
llvm::CodeViewYAML::SourceLineEntry::IsStatement
bool IsStatement
Definition: CodeViewYAMLDebugSections.h:66
llvm::codeview::StringsAndChecksumsRef
Definition: StringsAndChecksums.h:21
llvm::X86AS::SS
@ SS
Definition: X86.h:184
llvm::CodeViewYAML::SourceLineBlock::FileName
StringRef FileName
Definition: CodeViewYAMLDebugSections.h:75
llvm::CodeViewYAML::SymbolRecord::fromCodeViewSymbol
static Expected< SymbolRecord > fromCodeViewSymbol(codeview::CVSymbol Symbol)
Definition: CodeViewYAMLSymbols.cpp:617
llvm::codeview::DebugCrossModuleExportsSubsectionRef
Definition: DebugCrossExSubsection.h:24
DebugChecksumsSubsection.h
llvm::PPCISD::SC
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
Definition: PPCISelLowering.h:410
llvm::CodeViewYAML::YAMLFrameData::SavedRegsSize
uint32_t SavedRegsSize
Definition: CodeViewYAMLDebugSections.h:53
llvm::CodeViewYAML::YAMLFrameData::Flags
uint32_t Flags
Definition: CodeViewYAMLDebugSections.h:54
llvm::codeview::DebugSubsectionKind::CrossScopeImports
@ CrossScopeImports
llvm::support::little
@ little
Definition: Endian.h:27
llvm::CodeViewYAML::SourceLineEntry::EndDelta
uint32_t EndDelta
Definition: CodeViewYAMLDebugSections.h:65
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::codeview::DebugSymbolRVASubsectionRef
Definition: DebugSymbolRVASubsection.h:26
llvm::CodeViewYAML::InlineeSite::SourceLineNum
uint32_t SourceLineNum
Definition: CodeViewYAMLDebugSections.h:101
llvm::VarStreamArray< DebugSubsectionRecord >
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
getFileName
static Expected< StringRef > getFileName(const DebugStringTableSubsectionRef &Strings, const DebugChecksumsSubsectionRef &Checksums, uint32_t FileID)
Definition: CodeViewYAMLDebugSections.cpp:555
llvm::codeview::cv_error_code::no_records
@ no_records
llvm::CodeViewYAML::YAMLFrameData
Definition: CodeViewYAMLDebugSections.h:45
llvm::codeview::DebugSubsectionKind::FileChecksums
@ FileChecksums
llvm::BinaryStreamReader::readInteger
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
Definition: BinaryStreamReader.h:75
llvm::CodeViewYAML::YAMLCrossModuleImport
Definition: CodeViewYAMLDebugSections.h:57
llvm::codeview::FileChecksumEntry
Definition: DebugChecksumsSubsection.h:31
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::AArch64CC::LE
@ LE
Definition: AArch64BaseInfo.h:249
llvm::codeview::FileChecksumKind::SHA1
@ SHA1
input
The initial backend is deliberately restricted to z10 We should add support for later architectures at some point If an asm ties an i32 r result to an i64 input
Definition: README.txt:10
CodeView.h
DebugSubsectionVisitor.h
llvm::None
const NoneType None
Definition: None.h:23
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
LLVM_YAML_DECLARE_SCALAR_TRAITS
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote)
Line.h
llvm::CodeViewYAML::SourceLineEntry
Definition: CodeViewYAMLDebugSections.h:62
DebugSubsection.h
llvm::CodeViewYAML::toCodeViewSubsectionList
Expected< std::vector< std::shared_ptr< codeview::DebugSubsection > > > toCodeViewSubsectionList(BumpPtrAllocator &Allocator, ArrayRef< YAMLDebugSubsection > Subsections, const codeview::StringsAndChecksums &SC)
Definition: CodeViewYAMLDebugSections.cpp:747
llvm::CodeViewYAML::SourceFileChecksumEntry::ChecksumBytes
HexFormattedString ChecksumBytes
Definition: CodeViewYAMLDebugSections.h:87
llvm::codeview::FileChecksumKind::None
@ None
llvm::CodeViewYAML::detail::YAMLSubsectionBase
Definition: CodeViewYAMLDebugSections.cpp:87
llvm::CodeViewYAML::initializeStringsAndChecksums
void initializeStringsAndChecksums(ArrayRef< YAMLDebugSubsection > Sections, codeview::StringsAndChecksums &SC)
Definition: CodeViewYAMLDebugSections.cpp:922
llvm::codeview::StringsAndChecksumsRef::checksums
const DebugChecksumsSubsectionRef & checksums() const
Definition: StringsAndChecksums.h:65
DebugLinesSubsection.h
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::codeview::DebugLinesSubsectionRef
Definition: DebugLinesSubsection.h:78
StringExtras.h
llvm::CodeViewYAML::HexFormattedString
Definition: CodeViewYAMLDebugSections.h:80
llvm::CodeViewYAML::SourceLineBlock::Lines
std::vector< SourceLineEntry > Lines
Definition: CodeViewYAMLDebugSections.h:76
Magic
const char Magic[]
Definition: Archive.cpp:41
llvm::joinErrors
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition: Error.h:429
LLVM_YAML_DECLARE_BITSET_TRAITS
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type)
llvm::codeview::DebugCrossModuleImportsSubsectionRef
Definition: DebugCrossImpSubsection.h:47
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::codeview::FileChecksumEntry::Kind
FileChecksumKind Kind
Definition: DebugChecksumsSubsection.h:33
llvm::codeview::CrossModuleExport::Global
support::ulittle32_t Global
Definition: CodeView.h:595
llvm::codeview::DebugSubsectionRecord
Definition: DebugSubsectionRecord.h:35
llvm::CodeViewYAML
Definition: CodeViewYAMLDebugSections.h:37
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm::codeview::CodeViewContainer::ObjectFile
@ ObjectFile
llvm::zip
detail::zippy< detail::zip_shortest, T, U, Args... > zip(T &&t, U &&u, Args &&... args)
zip iterator for two or more iteratable types.
Definition: STLExtras.h:719
llvm::codeview::DebugCrossModuleExportsSubsectionRef::end
Iterator end() const
Definition: DebugCrossExSubsection.h:40
YAMLTraits.h
convertOneChecksum
static Expected< SourceFileChecksumEntry > convertOneChecksum(const DebugStringTableSubsectionRef &Strings, const FileChecksumEntry &CS)
Definition: CodeViewYAMLDebugSections.cpp:541
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
uint32_t
llvm::CodeViewYAML::SourceColumnEntry
Definition: CodeViewYAMLDebugSections.h:69
llvm::CodeViewYAML::InlineeSite::ExtraFiles
std::vector< StringRef > ExtraFiles
Definition: CodeViewYAMLDebugSections.h:102
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::CodeViewYAML::detail::YAMLSubsectionBase::Kind
DebugSubsectionKind Kind
Definition: CodeViewYAMLDebugSections.cpp:96
llvm::CodeViewYAML::YAMLFrameData::CodeSize
uint32_t CodeSize
Definition: CodeViewYAMLDebugSections.h:47
llvm::codeview::FileChecksumKind::MD5
@ MD5
llvm::CodeViewYAML::SourceFileChecksumEntry::Kind
codeview::FileChecksumKind Kind
Definition: CodeViewYAMLDebugSections.h:86
llvm::CodeViewYAML::YAMLFrameData::MaxStackSize
uint32_t MaxStackSize
Definition: CodeViewYAMLDebugSections.h:50
llvm::CodeViewYAML::YAMLFrameData::RvaStart
uint32_t RvaStart
Definition: CodeViewYAMLDebugSections.h:46
llvm::codeview::visitDebugSubsection
Error visitDebugSubsection(const DebugSubsectionRecord &R, DebugSubsectionVisitor &V, const StringsAndChecksumsRef &State)
Definition: DebugSubsectionVisitor.cpp:28
llvm::COFF::DEBUG_SECTION_MAGIC
@ DEBUG_SECTION_MAGIC
Definition: COFF.h:725
llvm::CodeViewYAML::SourceColumnEntry::EndColumn
uint16_t EndColumn
Definition: CodeViewYAMLDebugSections.h:71
llvm::codeview::LineInfo
Definition: Line.h:21
DebugInlineeLinesSubsection.h
H
#define H(x, y, z)
Definition: MD5.cpp:58
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
StringsAndChecksums.h
DebugCrossImpSubsection.h
llvm::CodeViewYAML::YAMLFrameData::ParamsSize
uint32_t ParamsSize
Definition: CodeViewYAMLDebugSections.h:49
DebugSymbolsSubsection.h
llvm::CodeViewYAML::fromDebugS
std::vector< YAMLDebugSubsection > fromDebugS(ArrayRef< uint8_t > Data, const codeview::StringsAndChecksumsRef &SC)
Definition: CodeViewYAMLDebugSections.cpp:901
llvm::CodeViewYAML::SourceLineEntry::LineStart
uint32_t LineStart
Definition: CodeViewYAMLDebugSections.h:64
llvm::codeview::cv_error_code::corrupt_record
@ corrupt_record
llvm::yaml
Definition: MIRYamlMapping.h:30
TypeIndex.h
llvm::codeview::DebugInlineeLinesSubsectionRef
Definition: DebugInlineeLinesSubsection.h:61
DebugStringTableSubsection.h
llvm::codeview::DebugSubsectionKind
DebugSubsectionKind
Definition: CodeView.h:310
llvm::codeview::DebugSubsectionVisitor
Definition: DebugSubsectionVisitor.h:32
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::FileChecksumEntry::Checksum
ArrayRef< uint8_t > Checksum
Definition: DebugChecksumsSubsection.h:34
llvm::codeview::DebugStringTableSubsectionRef
Represents a read-only view of a CodeView string table.
Definition: DebugStringTableSubsection.h:31
llvm::CodeViewYAML::SourceLineEntry::Offset
uint32_t Offset
Definition: CodeViewYAMLDebugSections.h:63
llvm::codeview::StringsAndChecksumsRef::strings
const DebugStringTableSubsectionRef & strings() const
Definition: StringsAndChecksums.h:64
llvm::CodeViewYAML::InlineeSite::FileName
StringRef FileName
Definition: CodeViewYAMLDebugSections.h:100
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
DebugFrameDataSubsection.h
llvm::CodeViewYAML::SourceFileChecksumEntry
Definition: CodeViewYAMLDebugSections.h:84
llvm::CodeViewYAML::YAMLFrameData::PrologSize
uint32_t PrologSize
Definition: CodeViewYAMLDebugSections.h:52
llvm::VarStreamArray::at
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Definition: BinaryStreamArray.h:132
llvm::codeview::FileChecksumKind::SHA256
@ SHA256
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:95
llvm::codeview::DebugSymbolsSubsectionRef
Definition: DebugSymbolsSubsection.h:18
CodeViewError.h
raw_ostream.h
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:221
llvm::codeview::DebugCrossModuleExportsSubsectionRef::begin
Iterator begin() const
Definition: DebugCrossExSubsection.h:39
llvm::DebuggerKind::SCE
@ SCE
Tune debug info for SCE targets (e.g. PS4).
Endian.h
llvm::pdb::PDB_SymType::Block
@ Block
llvm::codeview::LineFlags
LineFlags
Definition: CodeView.h:563
llvm::codeview::DebugChecksumsSubsectionRef::getArray
const FileChecksumArray & getArray() const
Definition: DebugChecksumsSubsection.h:69
llvm::codeview::DebugChecksumsSubsectionRef
Definition: DebugChecksumsSubsection.h:49
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::BinaryStreamReader::readArray
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Definition: BinaryStreamReader.h:187
llvm::CodeViewYAML::InlineeInfo
Definition: CodeViewYAMLDebugSections.h:105
llvm::CodeViewYAML::SourceLineBlock::Columns
std::vector< SourceColumnEntry > Columns
Definition: CodeViewYAMLDebugSections.h:77
llvm::CodeViewYAML::SourceFileChecksumEntry::FileName
StringRef FileName
Definition: CodeViewYAMLDebugSections.h:85