@@ -180,6 +180,16 @@ struct GroupSection {
180
180
std::vector<GroupMember> Members;
181
181
};
182
182
183
+ struct CoreFileMapping {
184
+ uint64_t Start, End, Offset;
185
+ StringRef Filename;
186
+ };
187
+
188
+ struct CoreNote {
189
+ uint64_t PageSize;
190
+ std::vector<CoreFileMapping> Mappings;
191
+ };
192
+
183
193
namespace {
184
194
185
195
struct NoteType {
@@ -762,6 +772,7 @@ template <typename ELFT> class LLVMELFDumper : public ELFDumper<ELFT> {
762
772
const unsigned SecNdx);
763
773
virtual void printSectionGroupMembers (StringRef Name, uint64_t Idx) const ;
764
774
virtual void printEmptyGroupMessage () const ;
775
+ virtual void printCoreNote (const CoreNote &Note, ScopedPrinter &W) const ;
765
776
766
777
ScopedPrinter &W;
767
778
};
@@ -793,6 +804,8 @@ template <typename ELFT> class JSONELFDumper : public LLVMELFDumper<ELFT> {
793
804
794
805
void printEmptyGroupMessage () const override ;
795
806
807
+ void printCoreNote (const CoreNote &Note, ScopedPrinter &W) const override ;
808
+
796
809
private:
797
810
std::unique_ptr<DictScope> FileScope;
798
811
};
@@ -5736,16 +5749,6 @@ static AMDGPUNote getAMDGPUNote(uint32_t NoteType, ArrayRef<uint8_t> Desc) {
5736
5749
}
5737
5750
}
5738
5751
5739
- struct CoreFileMapping {
5740
- uint64_t Start, End, Offset;
5741
- StringRef Filename;
5742
- };
5743
-
5744
- struct CoreNote {
5745
- uint64_t PageSize;
5746
- std::vector<CoreFileMapping> Mappings;
5747
- };
5748
-
5749
5752
static Expected<CoreNote> readCoreNote (DataExtractor Desc) {
5750
5753
// Expected format of the NT_FILE note description:
5751
5754
// 1. # of file mappings (call it N)
@@ -7838,7 +7841,9 @@ static bool printLLVMOMPOFFLOADNoteLLVMStyle(uint32_t NoteType,
7838
7841
return true ;
7839
7842
}
7840
7843
7841
- static void printCoreNoteLLVMStyle (const CoreNote &Note, ScopedPrinter &W) {
7844
+ template <class ELFT >
7845
+ void LLVMELFDumper<ELFT>::printCoreNote(const CoreNote &Note,
7846
+ ScopedPrinter &W) const {
7842
7847
W.printNumber (" Page Size" , Note.PageSize );
7843
7848
for (const CoreFileMapping &Mapping : Note.Mappings ) {
7844
7849
ListScope D (W, " Mapping" );
@@ -7849,6 +7854,20 @@ static void printCoreNoteLLVMStyle(const CoreNote &Note, ScopedPrinter &W) {
7849
7854
}
7850
7855
}
7851
7856
7857
+ template <class ELFT >
7858
+ void JSONELFDumper<ELFT>::printCoreNote(const CoreNote &Note,
7859
+ ScopedPrinter &W) const {
7860
+ W.printNumber (" Page Size" , Note.PageSize );
7861
+ ListScope D (W, " Mappings" );
7862
+ for (const CoreFileMapping &Mapping : Note.Mappings ) {
7863
+ auto MappingDict = std::make_unique<DictScope>(W);
7864
+ W.printHex (" Start" , Mapping.Start );
7865
+ W.printHex (" End" , Mapping.End );
7866
+ W.printHex (" Offset" , Mapping.Offset );
7867
+ W.printString (" Filename" , Mapping.Filename );
7868
+ }
7869
+ }
7870
+
7852
7871
template <class ELFT > void LLVMELFDumper<ELFT>::printNotes() {
7853
7872
ListScope L (W, " Notes" );
7854
7873
@@ -7916,7 +7935,7 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printNotes() {
7916
7935
Descriptor, ELFT::Endianness == llvm::endianness::little,
7917
7936
sizeof (Elf_Addr));
7918
7937
if (Expected<CoreNote> N = readCoreNote (DescExtractor)) {
7919
- printCoreNoteLLVMStyle (*N, W);
7938
+ printCoreNote (*N, W);
7920
7939
return Error::success ();
7921
7940
} else {
7922
7941
return N.takeError ();
0 commit comments