File tree Expand file tree Collapse file tree 2 files changed +22
-27
lines changed Expand file tree Collapse file tree 2 files changed +22
-27
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,28 @@ Expected<ArrayRef<T>> MinidumpFile::getDataSliceAs(ArrayRef<uint8_t> Data,
371371 return ArrayRef<T>(reinterpret_cast <const T *>(Slice->data ()), Count);
372372}
373373
374+ template <typename T>
375+ Expected<ArrayRef<T>>
376+ MinidumpFile::getListStream (minidump::StreamType Type) const {
377+ std::optional<ArrayRef<uint8_t >> Stream = getRawStream (Type);
378+ if (!Stream)
379+ return createError (" No such stream" );
380+ auto ExpectedSize = getDataSliceAs<support::ulittle32_t >(*Stream, 0 , 1 );
381+ if (!ExpectedSize)
382+ return ExpectedSize.takeError ();
383+
384+ size_t ListSize = ExpectedSize.get ()[0 ];
385+
386+ size_t ListOffset = 4 ;
387+ // Some producers insert additional padding bytes to align the list to an
388+ // 8-byte boundary. Check for that by comparing the list size with the overall
389+ // stream size.
390+ if (ListOffset + sizeof (T) * ListSize < Stream->size ())
391+ ListOffset = 8 ;
392+
393+ return getDataSliceAs<T>(*Stream, ListOffset, ListSize);
394+ }
395+
374396} // end namespace object
375397} // end namespace llvm
376398
Original file line number Diff line number Diff line change @@ -78,33 +78,6 @@ MinidumpFile::getMemoryInfoList() const {
7878 MemoryInfoIterator ({}, H.SizeOfEntry ));
7979}
8080
81- template <typename T>
82- Expected<ArrayRef<T>> MinidumpFile::getListStream (StreamType Type) const {
83- std::optional<ArrayRef<uint8_t >> Stream = getRawStream (Type);
84- if (!Stream)
85- return createError (" No such stream" );
86- auto ExpectedSize = getDataSliceAs<support::ulittle32_t >(*Stream, 0 , 1 );
87- if (!ExpectedSize)
88- return ExpectedSize.takeError ();
89-
90- size_t ListSize = ExpectedSize.get ()[0 ];
91-
92- size_t ListOffset = 4 ;
93- // Some producers insert additional padding bytes to align the list to an
94- // 8-byte boundary. Check for that by comparing the list size with the overall
95- // stream size.
96- if (ListOffset + sizeof (T) * ListSize < Stream->size ())
97- ListOffset = 8 ;
98-
99- return getDataSliceAs<T>(*Stream, ListOffset, ListSize);
100- }
101- template Expected<ArrayRef<Module>>
102- MinidumpFile::getListStream (StreamType) const ;
103- template Expected<ArrayRef<Thread>>
104- MinidumpFile::getListStream (StreamType) const ;
105- template Expected<ArrayRef<MemoryDescriptor>>
106- MinidumpFile::getListStream (StreamType) const ;
107-
10881Expected<ArrayRef<uint8_t >> MinidumpFile::getDataSlice (ArrayRef<uint8_t > Data,
10982 uint64_t Offset,
11083 uint64_t Size) {
You can’t perform that action at this time.
0 commit comments