当前位置: 首页>>代码示例>>C++>>正文


C++ DWARFDataExtractor::GetMaxU64方法代码示例

本文整理汇总了C++中DWARFDataExtractor::GetMaxU64方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFDataExtractor::GetMaxU64方法的具体用法?C++ DWARFDataExtractor::GetMaxU64怎么用?C++ DWARFDataExtractor::GetMaxU64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DWARFDataExtractor的用法示例。


在下文中一共展示了DWARFDataExtractor::GetMaxU64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

bool
DWARFFormValue::ExtractValue(const DWARFDataExtractor& data, lldb::offset_t* offset_ptr, const DWARFCompileUnit* cu)
{
    bool indirect = false;
    bool is_block = false;
    m_value.data = NULL;
    uint8_t ref_addr_size;
    // Read the value for the form into value and follow and DW_FORM_indirect instances we run into
    do
    {
        indirect = false;
        switch (m_form)
        {
        case DW_FORM_addr:      m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::GetAddressByteSize(cu));  break;
        case DW_FORM_block2:    m_value.value.uval = data.GetU16(offset_ptr); is_block = true;          break;
        case DW_FORM_block4:    m_value.value.uval = data.GetU32(offset_ptr); is_block = true;          break;
        case DW_FORM_data2:     m_value.value.uval = data.GetU16(offset_ptr);                           break;
        case DW_FORM_data4:     m_value.value.uval = data.GetU32(offset_ptr);                           break;
        case DW_FORM_data8:     m_value.value.uval = data.GetU64(offset_ptr);                           break;
        case DW_FORM_string:    m_value.value.cstr = data.GetCStr(offset_ptr);
                                // Set the string value to also be the data for inlined cstr form values only
                                // so we can tell the difference between DW_FORM_string and DW_FORM_strp form
                                // values;
                                m_value.data = (uint8_t*)m_value.value.cstr;                            break;
        case DW_FORM_exprloc:
        case DW_FORM_block:     m_value.value.uval = data.GetULEB128(offset_ptr); is_block = true;      break;
        case DW_FORM_block1:    m_value.value.uval = data.GetU8(offset_ptr); is_block = true;           break;
        case DW_FORM_data1:     m_value.value.uval = data.GetU8(offset_ptr);                            break;
        case DW_FORM_flag:      m_value.value.uval = data.GetU8(offset_ptr);                            break;
        case DW_FORM_sdata:     m_value.value.sval = data.GetSLEB128(offset_ptr);                       break;
        case DW_FORM_strp:      m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(cu) ? 8 : 4);  break;
    //  case DW_FORM_APPLE_db_str:
        case DW_FORM_udata:     m_value.value.uval = data.GetULEB128(offset_ptr);                       break;
        case DW_FORM_ref_addr:  ref_addr_size = 4;
                                if (cu) {
                                    if (cu->GetVersion() <= 2)
                                        ref_addr_size = cu->GetAddressByteSize();
                                    else
                                        ref_addr_size = cu->IsDWARF64() ? 8 : 4;
                                }
                                m_value.value.uval = data.GetMaxU64(offset_ptr, ref_addr_size);         break;
        case DW_FORM_ref1:      m_value.value.uval = data.GetU8(offset_ptr);                            break;
        case DW_FORM_ref2:      m_value.value.uval = data.GetU16(offset_ptr);                           break;
        case DW_FORM_ref4:      m_value.value.uval = data.GetU32(offset_ptr);                           break;
        case DW_FORM_ref8:      m_value.value.uval = data.GetU64(offset_ptr);                           break;
        case DW_FORM_ref_udata: m_value.value.uval = data.GetULEB128(offset_ptr);                       break;
        case DW_FORM_indirect:
            m_form = data.GetULEB128(offset_ptr);
            indirect = true;
            break;

        case DW_FORM_sec_offset:    m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(cu) ? 8 : 4);  break;
        case DW_FORM_flag_present:  m_value.value.uval = 1;                                             break;
        case DW_FORM_ref_sig8:      m_value.value.uval = data.GetU64(offset_ptr);                       break;
        default:
            return false;
            break;
        }
    } while (indirect);

    if (is_block)
    {
        m_value.data = data.PeekData(*offset_ptr, m_value.value.uval);
        if (m_value.data != NULL)
        {
            *offset_ptr += m_value.value.uval;
        }
    }

    return true;
}
开发者ID:badlogic,项目名称:lldb,代码行数:71,代码来源:DWARFFormValue.cpp

示例2: ExtractValue

bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data,
                                  lldb::offset_t *offset_ptr) {
  bool indirect = false;
  bool is_block = false;
  m_value.data = NULL;
  uint8_t ref_addr_size;
  // Read the value for the form into value and follow and DW_FORM_indirect
  // instances we run into
  do {
    indirect = false;
    switch (m_form) {
    case DW_FORM_addr:
      assert(m_cu);
      m_value.value.uval = data.GetMaxU64(
          offset_ptr, DWARFCompileUnit::GetAddressByteSize(m_cu));
      break;
    case DW_FORM_block2:
      m_value.value.uval = data.GetU16(offset_ptr);
      is_block = true;
      break;
    case DW_FORM_block4:
      m_value.value.uval = data.GetU32(offset_ptr);
      is_block = true;
      break;
    case DW_FORM_data2:
      m_value.value.uval = data.GetU16(offset_ptr);
      break;
    case DW_FORM_data4:
      m_value.value.uval = data.GetU32(offset_ptr);
      break;
    case DW_FORM_data8:
      m_value.value.uval = data.GetU64(offset_ptr);
      break;
    case DW_FORM_string:
      m_value.value.cstr = data.GetCStr(offset_ptr);
      break;
    case DW_FORM_exprloc:
    case DW_FORM_block:
      m_value.value.uval = data.GetULEB128(offset_ptr);
      is_block = true;
      break;
    case DW_FORM_block1:
      m_value.value.uval = data.GetU8(offset_ptr);
      is_block = true;
      break;
    case DW_FORM_data1:
      m_value.value.uval = data.GetU8(offset_ptr);
      break;
    case DW_FORM_flag:
      m_value.value.uval = data.GetU8(offset_ptr);
      break;
    case DW_FORM_sdata:
      m_value.value.sval = data.GetSLEB128(offset_ptr);
      break;
    case DW_FORM_strp:
      assert(m_cu);
      m_value.value.uval =
          data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(m_cu) ? 8 : 4);
      break;
    //  case DW_FORM_APPLE_db_str:
    case DW_FORM_udata:
      m_value.value.uval = data.GetULEB128(offset_ptr);
      break;
    case DW_FORM_ref_addr:
      assert(m_cu);
      ref_addr_size = 4;
      if (m_cu->GetVersion() <= 2)
        ref_addr_size = m_cu->GetAddressByteSize();
      else
        ref_addr_size = m_cu->IsDWARF64() ? 8 : 4;
      m_value.value.uval = data.GetMaxU64(offset_ptr, ref_addr_size);
      break;
    case DW_FORM_ref1:
      m_value.value.uval = data.GetU8(offset_ptr);
      break;
    case DW_FORM_ref2:
      m_value.value.uval = data.GetU16(offset_ptr);
      break;
    case DW_FORM_ref4:
      m_value.value.uval = data.GetU32(offset_ptr);
      break;
    case DW_FORM_ref8:
      m_value.value.uval = data.GetU64(offset_ptr);
      break;
    case DW_FORM_ref_udata:
      m_value.value.uval = data.GetULEB128(offset_ptr);
      break;
    case DW_FORM_indirect:
      m_form = data.GetULEB128(offset_ptr);
      indirect = true;
      break;

    case DW_FORM_sec_offset:
      assert(m_cu);
      m_value.value.uval =
          data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(m_cu) ? 8 : 4);
      break;
    case DW_FORM_flag_present:
      m_value.value.uval = 1;
      break;
//.........这里部分代码省略.........
开发者ID:mulichao,项目名称:freebsd,代码行数:101,代码来源:DWARFFormValue.cpp


注:本文中的DWARFDataExtractor::GetMaxU64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。