ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IntelPinSupport.C
Go to the documentation of this file.
1 // This file includes support for handling Intel Pin data types and and
2 // other required code to support Intel Pin within ROSE.
3 
4 #include "rose.h"
5 // #include "IntelPinSupport.h"
6 
7 // Later we can sue ROSE_ASSERT if appropriate.
8 #include <assert.h>
9 
10 using namespace std;
11 
12 // Use the namespace defined in Pin (required fix to pin.H)
13 using namespace LEVEL_PINCLIENT;
14 
15 
16 string output (IMG_TYPE image_type)
17  {
18  // Outputs a string with the image enum type (for display)
19 
20  string s;
21  switch (image_type)
22  {
23  case IMG_TYPE_STATIC: s = "IMG_TYPE_STATIC"; break;
24  case IMG_TYPE_SHARED: s = "IMG_TYPE_SHARED"; break;
25  case IMG_TYPE_SHAREDLIB: s = "IMG_TYPE_SHAREDLIB"; break;
26  case IMG_TYPE_RELOCATABLE: s = "IMG_TYPE_RELOCATABLE"; break;
27 
28  default:
29  {
30  printf ("Error: default reached in switch image_type = %u \n",image_type);
31  assert(false);
32  }
33  }
34 
35  return s;
36  }
37 
38 
39 string output (SEC_TYPE section_type)
40  {
41  // Outputs a string with the section enum type (for display)
42 
43  string s;
44  switch (section_type)
45  {
46  case SEC_TYPE_INVALID: s = "SEC_TYPE_INVALID"; break;
47  case SEC_TYPE_UNUSED: s = "SEC_TYPE_UNUSED"; break;
48  case LEVEL_CORE::SEC_TYPE_REGREL: s = "SEC_TYPE_REGREL"; break;
49  case LEVEL_CORE::SEC_TYPE_DYNREL: s = "SEC_TYPE_DYNREL"; break;
50  case LEVEL_CORE::SEC_TYPE_EXEC: s = "SEC_TYPE_EXEC"; break;
51  case LEVEL_CORE::SEC_TYPE_DATA: s = "SEC_TYPE_DATA"; break;
52  case SEC_TYPE_DYNAMIC: s = "SEC_TYPE_DYNAMIC"; break;
53  case SEC_TYPE_OPD: s = "SEC_TYPE_OPD"; break;
54  case SEC_TYPE_GOT: s = "SEC_TYPE_GOT"; break;
55  case SEC_TYPE_STACK: s = "SEC_TYPE_STACK"; break;
56  case SEC_TYPE_PLTOFF: s = "SEC_TYPE_PLTOFF"; break;
57  case SEC_TYPE_HASH: s = "SEC_TYPE_HASH"; break;
58  case LEVEL_CORE::SEC_TYPE_LSDA: s = "SEC_TYPE_LSDA"; break;
59  case SEC_TYPE_UNWIND: s = "SEC_TYPE_UNWIND"; break;
60  case SEC_TYPE_UNWINDINFO: s = "SEC_TYPE_UNWINDINFO"; break;
61  case SEC_TYPE_REGSYM: s = "SEC_TYPE_REGSYM"; break;
62  case SEC_TYPE_DYNSYM: s = "SEC_TYPE_DYNSYM"; break;
63  case SEC_TYPE_DEBUG: s = "SEC_TYPE_DEBUG"; break;
64  case LEVEL_CORE::SEC_TYPE_BSS: s = "SEC_TYPE_BSS"; break;
65  case SEC_TYPE_SYMSTR: s = "SEC_TYPE_SYMSTR"; break;
66  case SEC_TYPE_DYNSTR: s = "SEC_TYPE_DYNSTR"; break;
67  case SEC_TYPE_SECSTR: s = "SEC_TYPE_SECSTR"; break;
68  case SEC_TYPE_COMMENT: s = "SEC_TYPE_COMMENT"; break;
69  case LEVEL_CORE::SEC_TYPE_LOOS: s = "SEC_TYPE_LOOS"; break;
70  case SEC_TYPE_LAST: s = "SEC_TYPE_LAST"; break;
71 
72  default:
73  {
74  printf ("Error: default reached in switch section_type = %u \n",section_type);
75  assert(false);
76  }
77  }
78 
79  return s;
80  }
81 
82 
83 
84