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,
48 DWARFFormValue(dw_form_t form = 0);
49 dw_form_t Form() const { return m_form; }
50 void SetForm(dw_form_t form) { m_form = form; }
51 const ValueType& Value() const { return m_value; }
52 void Dump(lldb_private::Stream &s, const lldb_private::DWARFDataExtractor* debug_str_data, const DWARFCompileUnit* cu) const;
53 bool ExtractValue(const lldb_private::DWARFDataExtractor& data,
54 lldb::offset_t* offset_ptr,
55 const DWARFCompileUnit* cu);
56 bool IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (const uint8_t*)m_value.value.cstr; }
57 const uint8_t* BlockData() const;
58 uint64_t Reference(const DWARFCompileUnit* cu) const;
59 uint64_t Reference (dw_offset_t offset) const;
60 bool ResolveCompileUnitReferences(const DWARFCompileUnit* cu);
61 bool Boolean() const { return m_value.value.uval != 0; }
62 uint64_t Unsigned() const { return m_value.value.uval; }
63 void SetUnsigned(uint64_t uval) { m_value.value.uval = uval; }
64 int64_t Signed() const { return m_value.value.sval; }
65 void SetSigned(int64_t sval) { m_value.value.sval = sval; }
66 const char* AsCString(const lldb_private::DWARFDataExtractor* debug_str_data_ptr) const;
67 bool SkipValue(const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu) const;
68 static bool SkipValue(const dw_form_t form, const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu);
69 // static bool TransferValue(dw_form_t form, const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu, BinaryStreamBuf& out_buff);
70 // static bool TransferValue(const DWARFFormValue& formValue, const DWARFCompileUnit* cu, BinaryStreamBuf& out_buff);
71 // static bool PutUnsigned(dw_form_t form, dw_offset_t offset, uint64_t value, BinaryStreamBuf& out_buff, const DWARFCompileUnit* cu, bool fixup_cu_relative_refs);
72 static bool IsBlockForm(const dw_form_t form);
73 static bool IsDataForm(const dw_form_t form);
74 static const uint8_t * GetFixedFormSizesForAddressSize (uint8_t addr_size);
75 static int Compare (const DWARFFormValue& a, const DWARFFormValue& b, const DWARFCompileUnit* a_cu, const DWARFCompileUnit* b_cu, const lldb_private::DWARFDataExtractor* debug_str_data_ptr);
77 dw_form_t m_form; // Form for this value
78 ValueType m_value; // Contains all data for the form
82 #endif // SymbolFileDWARF_DWARFFormValue_h_