/
config.h
76 lines (54 loc) · 1.79 KB
/
config.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
#ifndef CONFIG_H_SEEN
#define CONFIG_H_SEEN
#include <stdbool.h>
typedef struct NameAndSignature {
// The name of the method
char *name;
// The signature of the method in JVM format
char *signature;
} NameAndSignature;
// Configuration for a method breakpoint
typedef struct MethodConfig {
NameAndSignature *method;
// The position of the parameter to write out.
int parameterPosition;
// The method to call on the parameter to display.
NameAndSignature *displayMethod;
// The class on which to call a static display method.
char *staticDisplayClass;
// If true, show a stack trace when logging this method.
bool showTrace;
// The name of a field to display.
NameAndSignature *displayField;
// If true, show all parameters for this method.
bool showAllParams;
struct MethodConfig *next;
// Used at runtime.
void *runtimeData;
} MethodConfig;
// Configuration for a class
typedef struct ClassConfig {
char *name;
// A linked list of methods to put breakpoints on.
MethodConfig *method_list;
struct ClassConfig *next;
bool runtime_attached;
} ClassConfig;
typedef struct Config {
// A linked list of classes to put breapoints in.
ClassConfig *class_list;
bool runtime_all_attached;
char *defaultDisplayMethodName;
char *defaultDisplayMethodSig;
} Config;
// Loads configuration from the given file.
// Returns NULL if an error occurred parsing the file.
// The caller is responsible for calling free() on the returned config object.
Config *LoadConfig(const char *filename);
void ReleaseConfig(Config *config);
#endif /* !CONFIG_H_SEEN */
// struct timeval time;
// struct timezone tz;
// gettimeofday(&time, &tz);
// structtime_t t = localtime(time.tv_sec);
// fprintf(out, "%d:%d:%d.%d", t.tm_hour, time.tv_sec->tm_min, time.tv_sec->tm_sec);