mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
e26d79386b
This reverts commit r221842 which was a revert of r221836 and of the test parts of r221837. This new version fixes an UB bug pointed out by David (along with addressing some other review comments), makes some dumping more resilient to broken input data and forces the accelerator tables to be dumped in the tests where we use them (this decision is platform specific otherwise). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222003 91177308-0d34-0410-b5e6-96231b3b80d8
39 lines
792 B
C++
39 lines
792 B
C++
|
|
#include "llvm/ADT/SmallVector.h"
|
|
#include "llvm/DebugInfo/DWARFFormValue.h"
|
|
|
|
#include <cstdint>
|
|
|
|
namespace llvm {
|
|
|
|
class DWARFAcceleratorTable {
|
|
|
|
struct Header {
|
|
uint32_t Magic;
|
|
uint16_t Version;
|
|
uint16_t HashFunction;
|
|
uint32_t NumBuckets;
|
|
uint32_t NumHashes;
|
|
uint32_t HeaderDataLength;
|
|
};
|
|
|
|
struct HeaderData {
|
|
typedef uint16_t AtomType;
|
|
uint32_t DIEOffsetBase;
|
|
SmallVector<std::pair<AtomType, DWARFFormValue>, 1> Atoms;
|
|
};
|
|
|
|
struct Header Hdr;
|
|
struct HeaderData HdrData;
|
|
DataExtractor AccelSection;
|
|
DataExtractor StringSection;
|
|
public:
|
|
DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection)
|
|
: AccelSection(AccelSection), StringSection(StringSection) {}
|
|
|
|
bool extract();
|
|
void dump(raw_ostream &OS);
|
|
};
|
|
|
|
}
|