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


C++ DWARFFormValue::Signed方法代码示例

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


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

示例1: if

int
DWARFFormValue::Compare (const DWARFFormValue& a_value, const DWARFFormValue& b_value, const DWARFCompileUnit* a_cu, const DWARFCompileUnit* b_cu, const DWARFDataExtractor* debug_str_data_ptr)
{
    dw_form_t a_form = a_value.Form();
    dw_form_t b_form = b_value.Form();
    if (a_form < b_form)
        return -1;
    if (a_form > b_form)
        return 1;
    switch (a_form)
    {
    case DW_FORM_addr:
    case DW_FORM_flag:
    case DW_FORM_data1:
    case DW_FORM_data2:
    case DW_FORM_data4:
    case DW_FORM_data8:
    case DW_FORM_udata:
    case DW_FORM_ref_addr:
    case DW_FORM_sec_offset:
    case DW_FORM_flag_present:
    case DW_FORM_ref_sig8:
        {
            uint64_t a = a_value.Unsigned();
            uint64_t b = b_value.Unsigned();
            if (a < b)
                return -1;
            if (a > b)
                return 1;
            return 0;
        }

    case DW_FORM_sdata:
        {
            int64_t a = a_value.Signed();
            int64_t b = b_value.Signed();
            if (a < b)
                return -1;
            if (a > b)
                return 1;
            return 0;
        }

    case DW_FORM_string:
    case DW_FORM_strp:
        {
            const char *a_string = a_value.AsCString(debug_str_data_ptr);
            const char *b_string = b_value.AsCString(debug_str_data_ptr);
            if (a_string == b_string)
                return 0;
            else if (a_string && b_string)
                return strcmp(a_string, b_string);
            else if (a_string == NULL)
                return -1;  // A string is NULL, and B is valid
            else
                return 1;   // A string valid, and B is NULL
        }


    case DW_FORM_block:
    case DW_FORM_block1:
    case DW_FORM_block2:
    case DW_FORM_block4:
    case DW_FORM_exprloc:
        {
            uint64_t a_len = a_value.Unsigned();
            uint64_t b_len = b_value.Unsigned();
            if (a_len < b_len)
                return -1;
            if (a_len > b_len)
                return 1;
            // The block lengths are the same
            return memcmp(a_value.BlockData(), b_value.BlockData(), a_value.Unsigned());
        }
        break;

    case DW_FORM_ref1:
    case DW_FORM_ref2:
    case DW_FORM_ref4:
    case DW_FORM_ref8:
    case DW_FORM_ref_udata:
        {
            uint64_t a = a_value.Reference(a_cu);
            uint64_t b = b_value.Reference(b_cu);
            if (a < b)
                return -1;
            if (a > b)
                return 1;
            return 0;
        }

    case DW_FORM_indirect:
        assert(!"This shouldn't happen after the form has been extracted...");
        break;

    default:
        assert(!"Unhandled DW_FORM");
        break;
    }
    return -1;
//.........这里部分代码省略.........
开发者ID:badlogic,项目名称:lldb,代码行数:101,代码来源:DWARFFormValue.cpp


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