ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericFormat.C
Go to the documentation of this file.
1 /* Classes describing basic features of a binary file that are in common to all file formats. (SgAsmGenericFormat class) */
2 
3 #include "sage3basic.h"
4 #include "stringify.h"
5 
6 using namespace rose;
7 
8 /* Print some debugging info */
9 void
10 SgAsmGenericFormat::dump(FILE *f, const char *prefix, ssize_t idx) const
11 {
12  char p[4096];
13  if (idx>=0) {
14  snprintf(p, sizeof(p),"%sFormat[%zd].", prefix, idx);
15  } else {
16  snprintf(p, sizeof(p),"%sFormat.", prefix);
17  }
18  const int w = std::max(1, DUMP_FIELD_WIDTH-(int)strlen(p));
19 
20  fprintf(f, "%s%-*s = %s\n", p, w, "family", to_string(get_family()).c_str());
21  fprintf(f, "%s%-*s = %s\n", p, w, "purpose", to_string(get_purpose()).c_str());
22  fprintf(f, "%s%-*s = %s\n", p, w, "sex", stringifyByteOrderEndianness(get_sex()).c_str());
23 
24  fprintf(f, "%s%-*s = %u (%scurrent)\n", p, w, "version", get_version(), get_is_current_version() ? "" : "not-" );
25 
26  fprintf(f, "%s%-*s = %s\n", p, w, "ABI", to_string(get_abi()).c_str());
27  fprintf(f, "%s%-*s = %u\n", p, w, "ABIvers", get_abi_version());
28  fprintf(f, "%s%-*s = %zu\n", p, w, "wordsize", get_word_size());
29 }