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


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

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


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

示例1: getAttributeValueAsAddress

uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsAddress(
    const DWARFUnit *U, const uint16_t Attr, uint64_t FailValue) const {
  DWARFFormValue FormValue;
  if (!getAttributeValue(U, Attr, FormValue))
    return FailValue;
  Optional<uint64_t> Result = FormValue.getAsAddress(U);
  return Result.hasValue() ? Result.getValue() : FailValue;
}
开发者ID:Fairly,项目名称:opencor,代码行数:8,代码来源:DWARFDebugInfoEntry.cpp

示例2: getDebugInfoForLocals

void ObjectLoadListener::getDebugInfoForLocals(
    DWARFContextInMemory &DwarfContext, uint64_t Addr, uint64_t Size) {
  for (const auto &CU : DwarfContext.compile_units()) {
    const DWARFDebugInfoEntryMinimal *UnitDIE = CU->getUnitDIE(false);
    const DWARFDebugInfoEntryMinimal *SubprogramDIE = getSubprogramDIE(UnitDIE);

    ICorDebugInfo::RegNum FrameBaseRegister = ICorDebugInfo::REGNUM_COUNT;
    DWARFFormValue FormValue;

    // Find the frame_base register value
    if (SubprogramDIE->getAttributeValue(CU.get(), dwarf::DW_AT_frame_base,
                                         FormValue)) {
      Optional<ArrayRef<uint8_t>> FormValues = FormValue.getAsBlock();
      FrameBaseRegister = mapDwarfRegisterToRegNum(FormValues->back());
    }

    if (SubprogramDIE->getAttributeValue(CU.get(), dwarf::DW_AT_low_pc,
                                         FormValue)) {
      Optional<uint64_t> FormAddress = FormValue.getAsAddress(CU.get());

      // If the Form address doesn't match the address for the function passed
      // do not collect debug for locals since they do not go with the current
      // function being processed
      if (FormAddress.getValue() != Addr) {
        return;
      }
    }

    std::vector<uint64_t> Offsets;
    extractLocalLocations(CU.get(), SubprogramDIE, Offsets);

    // Allocate the array of NativeVarInfo objects that will be sent to the EE
    ICorDebugInfo::NativeVarInfo *LocalVars;
    unsigned SizeOfArray =
        Offsets.size() * sizeof(ICorDebugInfo::NativeVarInfo);
    if (SizeOfArray > 0) {
      LocalVars =
          (ICorDebugInfo::NativeVarInfo *)Context->JitInfo->allocateArray(
              SizeOfArray);

      unsigned CurrentDebugEntry = 0;

      for (auto &Offset : Offsets) {
        LocalVars[CurrentDebugEntry].startOffset = Addr;
        LocalVars[CurrentDebugEntry].endOffset = Addr + Size;
        LocalVars[CurrentDebugEntry].varNumber = CurrentDebugEntry;

        // Assume all locals are on the stack
        ICorDebugInfo::VarLoc VarLoc;
        VarLoc.vlType = ICorDebugInfo::VLT_STK;
        VarLoc.vlStk.vlsBaseReg = FrameBaseRegister;
        VarLoc.vlStk.vlsOffset = Offset;

        LocalVars[CurrentDebugEntry].loc = VarLoc;

        CurrentDebugEntry++;
      }

      CORINFO_METHOD_INFO *MethodInfo = Context->MethodInfo;
      CORINFO_METHOD_HANDLE MethodHandle = MethodInfo->ftn;

      Context->JitInfo->setVars(MethodHandle, Offsets.size(), LocalVars);
    }
  }
}
开发者ID:manu-silicon,项目名称:llilc,代码行数:65,代码来源:LLILCJit.cpp


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