-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathexec.go
146 lines (111 loc) · 3.27 KB
/
exec.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Copyright 2013 Chris McGee <[email protected]>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gdblib
import ()
type ExecRunParms struct {
ThreadGroup string
AllInferiors bool
}
func (gdb *GDB) ExecRun(parms ExecRunParms) error {
descriptor := cmdDescr{forceInterrupt: true}
descriptor.cmd = "-exec-run"
if parms.AllInferiors {
descriptor.cmd = descriptor.cmd + " --all"
} else if parms.ThreadGroup != "" {
descriptor.cmd = descriptor.cmd + " --thread-group " + parms.ThreadGroup
}
descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
result := <-descriptor.response
err := parseResult(result, nil)
return err
}
type ExecArgsParms struct {
Args string
}
func (gdb *GDB) ExecArgs(parms ExecArgsParms) error {
descriptor := cmdDescr{}
descriptor.cmd = "-exec-arguments"
descriptor.cmd = descriptor.cmd + " " + parms.Args
descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
result := <-descriptor.response
err := parseResult(result, nil)
return err
}
type ExecInterruptParms struct {
// ThreadGroup string
// AllInferiors bool
}
func (gdb *GDB) ExecInterrupt(parms ExecInterruptParms) /*error*/ {
descriptor := cmdDescr{forceInterrupt: true}
// An interrupt is handled in a special way with an empty
// command that forces interrupt. This will interrupt all
// threads and make the gdb interpreter responsive to
// commands.
descriptor.cmd = ""
// descriptor.cmd = "-exec-interrupt"
// if parms.AllInferiors {
// descriptor.cmd = descriptor.cmd + " --all"
// } else if parms.ThreadGroup != "" {
// descriptor.cmd = descriptor.cmd + " --thread-group " + parms.ThreadGroup
// }
// descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
// result := <-descriptor.response
// err := parseResult(result, nil)
// return err
}
type ExecNextParms struct {
Reverse bool
}
func (gdb *GDB) ExecNext(parms ExecNextParms) error {
descriptor := cmdDescr{}
descriptor.cmd = "-exec-next"
if parms.Reverse {
descriptor.cmd = descriptor.cmd + " --reverse"
}
descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
result := <-descriptor.response
err := parseResult(result, nil)
return err
}
type ExecStepParms struct {
Reverse bool
}
func (gdb *GDB) ExecStep(parms ExecStepParms) error {
descriptor := cmdDescr{}
descriptor.cmd = "-exec-step"
if parms.Reverse {
descriptor.cmd = descriptor.cmd + " --reverse"
}
descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
result := <-descriptor.response
err := parseResult(result, nil)
return err
}
type ExecContinueParms struct {
Reverse bool
ThreadGroup string
AllInferiors bool
}
func (gdb *GDB) ExecContinue(parms ExecContinueParms) error {
descriptor := cmdDescr{}
descriptor.cmd = "-exec-continue"
if parms.Reverse {
descriptor.cmd = descriptor.cmd + " --reverse"
}
if parms.AllInferiors {
descriptor.cmd = descriptor.cmd + " --all"
} else if parms.ThreadGroup != "" {
descriptor.cmd = descriptor.cmd + " --thread-group " + parms.ThreadGroup
}
descriptor.response = make(chan cmdResultRecord)
gdb.input <- descriptor
result := <-descriptor.response
err := parseResult(result, nil)
return err
}