本文整理汇总了C++中Document::GetFunctionDetail方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::GetFunctionDetail方法的具体用法?C++ Document::GetFunctionDetail怎么用?C++ Document::GetFunctionDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::GetFunctionDetail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormatFunction
bool Architecture::FormatFunction(
Document const& rDoc,
Address const& rAddr,
Function const& rFunc,
PrintData & rPrintData) const
{
auto FuncLabel = rDoc.GetLabelFromAddress(rAddr);
if (rFunc.GetSize() != 0 && rFunc.GetInstructionCounter() != 0)
{
std::ostringstream oss;
oss
<< std::hex << std::showbase << std::left
<< "; size=" << rFunc.GetSize()
<< ", insn_cnt=" << rFunc.GetInstructionCounter();
rPrintData.AppendComment(oss.str());
}
else
rPrintData.AppendComment("; imported");
Id CurId;
if (!rDoc.RetrieveDetailId(rAddr, 0, CurId))
return true;
FunctionDetail FuncDtl;
if (!rDoc.GetFunctionDetail(CurId, FuncDtl))
return true;
rPrintData.AppendNewLine().AppendSpace(2).AppendComment(";").AppendSpace();
auto const& RetType = FuncDtl.GetReturnType();
std::string FuncName;
Label CurLbl = rDoc.GetLabelFromAddress(rAddr);
if (CurLbl.GetType() == Label::Unknown)
FuncName = FuncDtl.GetName();
else
FuncName = CurLbl.GetName();
FormatTypeDetail(RetType, rPrintData);
rPrintData.AppendSpace().AppendLabel(FuncName).AppendOperator("(");
bool FirstParam = true;
auto const& Params = FuncDtl.GetParameters();
for (auto const& Param : Params)
{
if (FirstParam)
FirstParam = false;
else
rPrintData.AppendOperator(",").AppendSpace();
FormatTypeDetail(Param.GetType(), rPrintData);
rPrintData.AppendSpace().AppendLabel(Param.GetValue().GetName());
}
rPrintData.AppendOperator(");");
return true;
}
示例2: FormatInstruction
bool Architecture::FormatInstruction(
Document const& rDoc,
Address const& rAddr,
Instruction const& rInsn,
PrintData & rPrintData) const
{
char const* Sep = nullptr;
rPrintData.AppendMnemonic(rInsn.GetName());
std::string OpRefCmt;
rDoc.GetComment(rAddr, OpRefCmt);
for (unsigned int i = 0; i < OPERAND_NO; ++i)
{
Operand const* pOprd = rInsn.Operand(i);
if (pOprd == nullptr)
break;
if (pOprd->GetType() == O_NONE)
break;
if (Sep != nullptr)
rPrintData.AppendOperator(Sep).AppendSpace();
else
Sep = ",";
if (!FormatOperand(rDoc, rAddr, rInsn, *pOprd, i, rPrintData))
return false;
Address OpRefAddr;
if (OpRefCmt.empty() && rInsn.GetOperandReference(rDoc, i, rAddr, OpRefAddr))
{
Id OpId;
if (rDoc.RetrieveDetailId(OpRefAddr, 0, OpId))
{
FunctionDetail FuncDtl;
if (rDoc.GetFunctionDetail(OpId, FuncDtl))
{
// TODO: provide helper to avoid this...
u16 CmtOff = static_cast<u16>(rPrintData.GetCurrentText().length()) - 6 - 1 - rAddr.ToString().length();
rPrintData.AppendSpace().AppendComment(";").AppendSpace();
FormatTypeDetail(FuncDtl.GetReturnType(), rPrintData);
rPrintData.AppendSpace().AppendLabel(FuncDtl.GetName()).AppendOperator("(");
if (!FuncDtl.GetParameters().empty())
rPrintData.AppendNewLine().AppendSpace(CmtOff).AppendComment(";").AppendSpace(3);
bool FirstParam = true;
for (auto const& rParam : FuncDtl.GetParameters())
{
if (FirstParam)
FirstParam = false;
else
rPrintData.AppendOperator(",").AppendNewLine().AppendSpace(CmtOff).AppendComment(";").AppendSpace(3);
FormatTypeDetail(rParam.GetType(), rPrintData);
rPrintData.AppendSpace().AppendLabel(rParam.GetValue().GetName());
}
rPrintData.AppendOperator(");");
}
}
}
}
return true;
}