1 //===-- DWARFFormValue.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef SymbolFileDWARF_DWARFFormValue_h_
11 #define SymbolFileDWARF_DWARFFormValue_h_
13 #include <stddef.h> // for NULL
14 #include "DWARFDataExtractor.h"
16 class DWARFCompileUnit;
21 typedef struct ValueTypeTag
41 eValueTypeInvalid = 0,
49 DWARFFormValue(const DWARFCompileUnit* cu, dw_form_t form);
50 const DWARFCompileUnit* GetCompileUnit () const { return m_cu; }
51 void SetCompileUnit (const DWARFCompileUnit* cu) { m_cu = cu; }
52 dw_form_t Form() const { return m_form; }
53 void SetForm(dw_form_t form) { m_form = form; }
54 const ValueType& Value() const { return m_value; }
55 void Dump(lldb_private::Stream &s, const lldb_private::DWARFDataExtractor* debug_str_data) const;
56 bool ExtractValue(const lldb_private::DWARFDataExtractor& data,
57 lldb::offset_t* offset_ptr);
58 bool IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (const uint8_t*)m_value.value.cstr; }
59 const uint8_t* BlockData() const;
60 uint64_t Reference() const;
61 uint64_t Reference (dw_offset_t offset) const;
62 bool Boolean() const { return m_value.value.uval != 0; }
63 uint64_t Unsigned() const { return m_value.value.uval; }
64 void SetUnsigned(uint64_t uval) { m_value.value.uval = uval; }
65 int64_t Signed() const { return m_value.value.sval; }
66 void SetSigned(int64_t sval) { m_value.value.sval = sval; }
67 const char* AsCString(const lldb_private::DWARFDataExtractor* debug_str_data_ptr) const;
68 bool SkipValue(const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr) const;
69 static bool SkipValue(const dw_form_t form, const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu);
70 static bool IsBlockForm(const dw_form_t form);
71 static bool IsDataForm(const dw_form_t form);
72 static const uint8_t * GetFixedFormSizesForAddressSize (uint8_t addr_size, bool is_dwarf64);
73 static int Compare (const DWARFFormValue& a, const DWARFFormValue& b, const lldb_private::DWARFDataExtractor* debug_str_data_ptr);
75 const DWARFCompileUnit* m_cu; // Compile unit for this form
76 dw_form_t m_form; // Form for this value
77 ValueType m_value; // Contains all data for the form
81 #endif // SymbolFileDWARF_DWARFFormValue_h_