7 #include "rosePublicConfig.h"
8 #ifdef ROSE_HAVE_GCRYPT_H
19 return (prefix +
"E = entry address H = CFG head C = function call(*)\n" +
20 prefix +
"X = exception frame T = thunk I = imported/dyn-linked\n" +
21 prefix +
"O = exported S = function symbol P = instruction pattern\n" +
22 prefix +
"G = CFG graph analysis U = user-def detection N = NOP/zero padding\n" +
23 prefix +
"D = discontiguous blocks V = intra-function block L = leftover blocks\n" +
24 prefix +
"Mxxx are miscellaneous reasons (at most one misc reason per function):\n" +
25 prefix +
" M001 = code between function padding bytes\n" +
26 prefix +
"Note: \"c\" means this is the target of a call-like instruction or instruction\n" +
27 prefix +
" sequence but the call is not present in the global control flow graph, while\n" +
28 prefix +
" \"C\" means the call is in the CFG.\n");
35 return reason_str(do_pad, get_reason());
47 if (r & FUNC_ENTRY_POINT) {
61 if (r & FUNC_CALL_TARGET) {
67 if (r & FUNC_EH_FRAME) {
86 char abbr[32], full[64];
87 int width = snprintf(abbr,
sizeof abbr,
"%u", FUNC_MISCMASK);
88 snprintf(abbr,
sizeof abbr,
"M%0*u", width, (r & FUNC_MISCMASK));
89 abbr[
sizeof(abbr)-1] =
'\0';
92 if (miscname.empty() || miscname[0]==
'(') {
93 snprintf(full,
sizeof full,
"misc-%u", (r & FUNC_MISCMASK));
95 for (
size_t i=0; i<miscname.size(); ++i)
96 miscname[i] = tolower(miscname[i]);
97 strncpy(full, miscname.c_str(),
sizeof full);
99 full[
sizeof(full)-1] =
'\0';
156 : extents(extents), lo_addr(lo_addr), hi_addr(hi_addr), selector(selector), nnodes(0) {
162 void visit(
SgNode *node) {
163 if (selector && !(*selector)(node))
185 *lo_addr = std::min(*lo_addr, lo);
189 if (extents && hi>lo)
192 } t1(extents, lo_addr, hi_addr, selector);
200 #ifdef ROSE_HAVE_GCRYPT_H
205 gcry_error_t error = gcry_md_open(&md, GCRY_MD_SHA1, 0);
206 assert(GPG_ERR_NO_ERROR==error);
211 void visit(
SgNode *node) {
212 if (selector && !(*selector)(node))
218 gcry_md_write(md, &buf[0], buf.size());
221 gcry_md_write(md, &buf[0], buf.size());
224 void read(uint8_t digest[20]) {
225 assert(gcry_md_get_algo_dlen(GCRY_MD_SHA1)==20);
227 unsigned char *d = gcry_md_read(md, GCRY_MD_SHA1);
229 memcpy(digest, d, 20);
236 memset(digest, 0, 20);
245 for (SgAsmStatementPtrList::const_iterator si=p_statementList.begin(); si!=p_statementList.end(); ++si) {