本文整理汇总了C++中Trace::create_xref方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::create_xref方法的具体用法?C++ Trace::create_xref怎么用?C++ Trace::create_xref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace::create_xref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if (good)
{
// fixme
Instruction * inst = t->m_arch->create_instruction(t, addr);//new Instruction(t, addr, opcode);
t->insert_memlocd(inst);
} else {
printf("Instruction was missing addr!\n");
}
}
else
printf("warning, no Instruction content found for xml doc\n");
xmlNodePtr symbols_n = findChild(root_element, "symbols");
if (symbols_n)
{
for(xmlNodePtr node_a = symbols_n->children; node_a != NULL; node_a = node_a->next) {
std::string name;
u32 addr;
bool goodname = false;
bool goodaddr = false;
for(xmlNodePtr node_b = node_a->children; node_b != NULL; node_b = node_b->next) {
char * content = (char *) xmlNodeGetContent(node_b);
if (!content)
continue;
if (xmlStrcmp(node_b->name, BAD_CAST "addr") == 0)
{
goodaddr = true;
addr = strtoul(content, NULL, 16);
}
else if (xmlStrcmp(node_b->name, BAD_CAST "name") == 0)
{
name = content;
goodname = true;
}
xmlFree(content);
}
if (goodname && goodaddr)
t->create_sym(name.c_str(), addr);
else
printf("Symbol did not load %d %d\n", goodname, goodaddr);
}
} else {
printf("Warning - no symbol section found in saved file!\n");
}
xmlNodePtr xrefs_n = findChild(root_element, "xrefs");
if (xrefs_n)
{
for(xmlNodePtr node_a = xrefs_n->children; node_a != NULL; node_a = node_a->next) {
u32 srcaddr;
u32 dstaddr;
u32 type;
bool goodsrc = false;
bool gooddst = false;
bool goodtype = false;
for(xmlNodePtr node_b = node_a->children; node_b != NULL; node_b = node_b->next) {
char * content = (char *) xmlNodeGetContent(node_b);
if (!content)
continue;
if (xmlStrcmp(node_b->name, BAD_CAST "srcaddr") == 0)
{
goodsrc = true;
srcaddr = strtoul(content, NULL, 16);
} else if (xmlStrcmp(node_b->name, BAD_CAST "dstaddr") == 0)
{
gooddst = true;
dstaddr = strtoul(content, NULL, 16);
} else if (xmlStrcmp(node_b->name, BAD_CAST "type") == 0)
{
goodtype = true;
type = strtoul(content, NULL, 16);
}
xmlFree(content);
}
if (goodsrc && gooddst && goodtype)
t->create_xref(srcaddr, dstaddr, type);
else
printf("Xref did not load %d %d %d\n", goodsrc, gooddst, goodtype);
}
} else {
printf("Warning - no xref section found in saved file!\n");
}
xmlFreeDoc(doc);
return t;
}