about summary refs log tree commit diff
path: root/frida_mode/include/util.h
blob: 77491ea83985d2281faf47b6b379538543b35f76 (plain) (blame)
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
#ifndef _UTIL_H
#define _UTIL_H

#include "frida-gumjs.h"

#include "debug.h"

#define UNUSED_PARAMETER(x) (void)(x)
#define IGNORED_RETURN(x) (void)!(x)

guint64 util_read_address(char *key);

guint64  util_read_num(char *key);
gboolean util_output_enabled(void);
gsize    util_rotate(gsize val, gsize shift, gsize size);
gsize    util_log2(gsize val);

#define FOKF(x...)                         \
  do {                                     \
                                           \
    if (!util_output_enabled()) { break; } \
                                           \
    OKF(x);                                \
                                           \
  } while (0)

#define FWARNF(x...) \
  do {               \
                     \
    WARNF(x);        \
                     \
  } while (0)

#define FFATAL(x...) \
  do {               \
                     \
    FATAL(x);        \
                     \
  } while (0)

#endif