-
Notifications
You must be signed in to change notification settings - Fork 13
/
util.h
92 lines (76 loc) · 2.13 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef __UTIL__
#define __UTIL__
/*--------------------------------------------------------------------------
GraphSlick (c) Elias Bachaalany
-------------------------------------
Util module
This module implements various utility functions
--------------------------------------------------------------------------*/
#include <map>
#include <pro.h>
#include <funcs.hpp>
#include <gdl.hpp>
#include <graph.hpp>
#include "types.hpp"
//--------------------------------------------------------------------------
/**
* @brief Utility map class to store gnode_t types
*/
class gnodemap_t: public std::map<int, gnode_t>
{
public:
/**
* @brief Add a node to the map
*/
gnode_t *add(int nid)
{
gnode_t *node = &(insert(std::make_pair(nid, gnode_t())).first->second);
return node;
}
/**
* @brief Return node data
*/
gnode_t *get(int nid)
{
gnodemap_t::iterator it = find(nid);
if ( it == end() )
return NULL;
else
return &it->second;
}
};
//--------------------------------------------------------------------------
void get_disasm_text(
ea_t start,
ea_t end,
qstring *out);
bool get_func_flowchart(
ea_t ea,
qflow_chart_t &qf);
//--------------------------------------------------------------------------
/**
* @brief Focuses and jumps to the given node id in the graph viewer
*/
void jump_to_node(graph_viewer_t *gv, int nid);
//--------------------------------------------------------------------------
/**
* @brief Utility function to convert a string to the 'asize_t' type
It works based on the EA64 define
*/
asize_t str2asizet(const char *str);
//--------------------------------------------------------------------------
/**
* @brief Skips white spaces
*/
char *skip_spaces(char *p);
//--------------------------------------------------------------------------
/**
* @brief Returns whether a graphical version of IDA is being used
*/
bool is_ida_gui();
//--------------------------------------------------------------------------
/**
* @brief Returns a file name containing the idbpath and function start EA
*/
const char *get_screen_function_fn(const char *ext = ".bin");
#endif