2011-09-13 19:42:23 +00:00
|
|
|
//===-- DWARFFormValue.h ----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_DEBUGINFO_DWARFFORMVALUE_H
|
|
|
|
#define LLVM_DEBUGINFO_DWARFFORMVALUE_H
|
|
|
|
|
|
|
|
#include "llvm/Support/DataExtractor.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class DWARFCompileUnit;
|
|
|
|
class raw_ostream;
|
|
|
|
|
|
|
|
class DWARFFormValue {
|
|
|
|
public:
|
|
|
|
struct ValueType {
|
2013-08-27 09:20:22 +00:00
|
|
|
ValueType() : data(NULL), IsDWOIndex(false) {
|
2011-09-13 19:42:23 +00:00
|
|
|
uval = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
union {
|
|
|
|
uint64_t uval;
|
|
|
|
int64_t sval;
|
|
|
|
const char* cstr;
|
|
|
|
};
|
|
|
|
const uint8_t* data;
|
2013-08-27 09:20:22 +00:00
|
|
|
bool IsDWOIndex;
|
2011-09-13 19:42:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
eValueTypeInvalid = 0,
|
|
|
|
eValueTypeUnsigned,
|
|
|
|
eValueTypeSigned,
|
|
|
|
eValueTypeCStr,
|
|
|
|
eValueTypeBlock
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint16_t Form; // Form for this value.
|
|
|
|
ValueType Value; // Contains all data for the form.
|
|
|
|
|
|
|
|
public:
|
|
|
|
DWARFFormValue(uint16_t form = 0) : Form(form) {}
|
|
|
|
uint16_t getForm() const { return Form; }
|
|
|
|
const ValueType& value() const { return Value; }
|
2011-09-15 16:57:13 +00:00
|
|
|
void dump(raw_ostream &OS, const DWARFCompileUnit* cu) const;
|
2011-09-13 19:42:23 +00:00
|
|
|
bool extractValue(DataExtractor data, uint32_t *offset_ptr,
|
2011-09-13 21:47:32 +00:00
|
|
|
const DWARFCompileUnit *cu);
|
2011-09-13 19:42:23 +00:00
|
|
|
bool isInlinedCStr() const {
|
2012-09-05 22:26:57 +00:00
|
|
|
return Value.data != NULL && Value.data == (const uint8_t*)Value.cstr;
|
2011-09-13 19:42:23 +00:00
|
|
|
}
|
|
|
|
const uint8_t *BlockData() const;
|
|
|
|
uint64_t getReference(const DWARFCompileUnit* cu) const;
|
|
|
|
|
|
|
|
uint64_t getUnsigned() const { return Value.uval; }
|
|
|
|
int64_t getSigned() const { return Value.sval; }
|
2013-08-27 09:20:22 +00:00
|
|
|
const char *getAsCString(const DWARFCompileUnit *CU) const;
|
|
|
|
uint64_t getAsAddress(const DWARFCompileUnit *CU) const;
|
2011-09-13 19:42:23 +00:00
|
|
|
bool skipValue(DataExtractor debug_info_data, uint32_t *offset_ptr,
|
|
|
|
const DWARFCompileUnit *cu) const;
|
|
|
|
static bool skipValue(uint16_t form, DataExtractor debug_info_data,
|
|
|
|
uint32_t *offset_ptr, const DWARFCompileUnit *cu);
|
|
|
|
static bool isBlockForm(uint16_t form);
|
|
|
|
static bool isDataForm(uint16_t form);
|
2013-04-09 14:09:42 +00:00
|
|
|
static const uint8_t *getFixedFormSizes(uint8_t AddrSize, uint16_t Version);
|
2011-09-13 19:42:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|