/
types.go
126 lines (113 loc) · 3.77 KB
/
types.go
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
* Structure declarations that correspond to DBGp XML messages.
*
* These structures are used for decoding the XML messages into usable values.
*/
package message
import "encoding/xml"
type Message struct {
MessageType string
State string
Properties Properties
Context Context
Content string
Breakpoints map[int]Breakpoint
Stacktrace []StackLevel
}
type Properties struct {
Command string
ErrorCode int
ErrorMessage string
Filename string
LineNumber int
BreakpointId int
TxId int
}
type Context struct {
Local []Variable
Global []Variable
Constant []string
}
type Variable struct {
Fullname string
DisplayName string // Short name is useful for display purposes.
VarType string
Value string // Only for basic types such as int, float, string, etc.
AccessModifier string // private, protected, public, etc.
IsCompositeType bool // Is it an array, object, structure, etc.?
Children []Variable
ChildCount int
HasLoadedChildren bool // DBGp servers return children up to a certain depth.
IsBase64 bool
}
type Init struct {
XMLName xml.Name `xml:"init"`
FileURI string `xml:"fileuri,attr"`
Language string `xml:"language,attr"`
Protocol string `xml:"protocol_version,attr"`
AppID string `xml:"appid,attr"`
Engine string `xml:"engine"`
Author string `xml:"author"`
URL string `xml:"url"`
Copyright string `xml:"copyright"`
}
type Response struct {
XMLName xml.Name `xml:"response"`
Command string `xml:"command,attr"`
ContextId int `xml:"context,attr"`
TransactionId int `xml:"transaction_id,attr"`
Status string `xml:"status,attr"`
Reason string `xml:"reason,attr"`
Id int `xml:"id,attr"`
Message ResponseMessage
Breakpoints []Breakpoint `xml:"breakpoint"`
Error Error `xml:"error"`
Variables []VariableDetails `xml:"property"`
Stacktrace []StackLevel `xml:"stack"`
Content string `xml:",chardata"`
}
type ResponseMessage struct {
XMLName xml.Name `xml:"https://xdebug.org/dbgp/xdebug message"`
Filename string `xml:"filename,attr"`
LineNo int `xml:"lineno,attr"`
}
type Breakpoint struct {
Filename string `xml:"filename,attr"`
LineNo int `xml:"lineno,attr"`
Type string `xml:"type,attr"`
State string `xml:"state,attr"` // enabled
HitCount int `xml:"hit_count,attr"`
HitValue int `xml:"hit_value,attr"`
Id int `xml:"id,attr"`
}
type Error struct {
Code int `xml:"code,attr"`
Message string `xml:"message"`
}
type VariableDetails struct {
Name string `xml:"name,attr"`
Fullname string `xml:"fullname,attr"`
VarType string `xml:"type,attr"`
Facet string `xml:"facet,attr"` // public, private, etc.
Classname string `xml:"classname,attr"`
Constant int `xml:"constant,attr"`
HasChildren bool `xml:"children,attr"`
Size int `xml:"size,attr"`
Page int `xml:"page,attr"`
Pagesize int `xml:"pagesize,attr"`
Address int `xml:"address,attr"`
Key string `xml:"key,attr"`
Encoding string `xml:"encoding,attr"`
NumChildren int `xml:"numchildren,attr"`
Value string `xml:",chardata"`
Variables []VariableDetails `xml:"property"`
}
type StackLevel struct {
Level int `xml:"level,attr"`
Type string `xml:"type,attr"`
Filename string `xml:"filename,attr"`
LineNo int `xml:"lineno,attr"`
Where string `xml:"where,attr"`
CmdBegin string `xml:"cmdbegin,attr"`
CmdEnd string `xml:"cmdend,attr"`
}