proc: refactoring: merge target into proc

- moved target.Interface into proc as proc.Process
- rename proc.IThread to proc.Thread
- replaced interfaces DisassembleInfo, Continuable and
  EvalScopeConvertible with Process.
- removed superfluous Gdbserver prefix from types in the gdbserial
  backend.
- removed superfluous Core prefix from types in the core backend.
This commit is contained in:
aarzilli
2017-04-21 09:50:38 +02:00
committed by Derek Parker
parent 15bac71979
commit b6fe5aebaf
20 changed files with 286 additions and 333 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/derekparker/delve/pkg/proc"
"github.com/derekparker/delve/pkg/proc/gdbserial"
"github.com/derekparker/delve/pkg/proc/native"
"github.com/derekparker/delve/pkg/target"
"github.com/derekparker/delve/service/api"
protest "github.com/derekparker/delve/pkg/proc/test"
@ -56,7 +55,7 @@ func assertVariable(t *testing.T, variable *proc.Variable, expected varTest) {
}
}
func evalVariable(p target.Interface, symbol string, cfg proc.LoadConfig) (*proc.Variable, error) {
func evalVariable(p proc.Process, symbol string, cfg proc.LoadConfig) (*proc.Variable, error) {
scope, err := proc.GoroutineScope(p.CurrentThread())
if err != nil {
return nil, err
@ -70,7 +69,7 @@ func (tc *varTest) alternateVarTest() varTest {
return r
}
func setVariable(p target.Interface, symbol, value string) error {
func setVariable(p proc.Process, symbol, value string) error {
scope, err := proc.GoroutineScope(p.CurrentThread())
if err != nil {
return err
@ -80,9 +79,9 @@ func setVariable(p target.Interface, symbol, value string) error {
const varTestBreakpointLineNumber = 59
func withTestProcess(name string, t *testing.T, fn func(p target.Interface, fixture protest.Fixture)) {
func withTestProcess(name string, t *testing.T, fn func(p proc.Process, fixture protest.Fixture)) {
fixture := protest.BuildFixture(name)
var p target.Interface
var p proc.Process
var err error
switch testBackend {
case "native":
@ -149,7 +148,7 @@ func TestVariableEvaluation(t *testing.T) {
{"NonExistent", true, "", "", "", fmt.Errorf("could not find symbol value for NonExistent")},
}
withTestProcess("testvariables", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Continue(p)
assertNoError(err, t, "Continue() returned an error")
@ -227,7 +226,7 @@ func TestVariableEvaluationShort(t *testing.T) {
{"NonExistent", true, "", "", "", fmt.Errorf("could not find symbol value for NonExistent")},
}
withTestProcess("testvariables", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Continue(p)
assertNoError(err, t, "Continue() returned an error")
@ -282,7 +281,7 @@ func TestMultilineVariableEvaluation(t *testing.T) {
Nest: *(*main.Nest)(…`, "", "main.Nest", nil},
}
withTestProcess("testvariables", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Continue(p)
assertNoError(err, t, "Continue() returned an error")
@ -355,7 +354,7 @@ func TestLocalVariables(t *testing.T) {
{"baz", true, "\"bazburzum\"", "", "string", nil}}},
}
withTestProcess("testvariables", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Continue(p)
assertNoError(err, t, "Continue() returned an error")
@ -379,7 +378,7 @@ func TestLocalVariables(t *testing.T) {
}
func TestEmbeddedStruct(t *testing.T) {
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
testcases := []varTest{
{"b.val", true, "-314", "-314", "int", nil},
{"b.A.val", true, "-314", "-314", "int", nil},
@ -409,7 +408,7 @@ func TestEmbeddedStruct(t *testing.T) {
}
func TestComplexSetting(t *testing.T) {
withTestProcess("testvariables", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Continue(p)
assertNoError(err, t, "Continue() returned an error")
@ -655,7 +654,7 @@ func TestEvalExpression(t *testing.T) {
}
}
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
for _, tc := range testcases {
variable, err := evalVariable(p, tc.name, pnormalLoadConfig)
@ -679,7 +678,7 @@ func TestEvalExpression(t *testing.T) {
}
func TestEvalAddrAndCast(t *testing.T) {
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
c1addr, err := evalVariable(p, "&c1", pnormalLoadConfig)
assertNoError(err, t, "EvalExpression(&c1)")
@ -705,7 +704,7 @@ func TestEvalAddrAndCast(t *testing.T) {
}
func TestMapEvaluation(t *testing.T) {
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
m1v, err := evalVariable(p, "m1", pnormalLoadConfig)
assertNoError(err, t, "EvalVariable()")
@ -739,7 +738,7 @@ func TestMapEvaluation(t *testing.T) {
}
func TestUnsafePointer(t *testing.T) {
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
up1v, err := evalVariable(p, "up1", pnormalLoadConfig)
assertNoError(err, t, "EvalVariable(up1)")
@ -776,7 +775,7 @@ func TestIssue426(t *testing.T) {
// Serialization of type expressions (go/ast.Expr) containing anonymous structs or interfaces
// differs from the serialization used by the linker to produce DWARF type information
withTestProcess("testvariables2", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("testvariables2", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
for _, testcase := range testcases {
v, err := evalVariable(p, testcase.name, pnormalLoadConfig)
@ -827,7 +826,7 @@ func TestPackageRenames(t *testing.T) {
return
}
withTestProcess("pkgrenames", t, func(p target.Interface, fixture protest.Fixture) {
withTestProcess("pkgrenames", t, func(p proc.Process, fixture protest.Fixture) {
assertNoError(proc.Continue(p), t, "Continue() returned an error")
for _, tc := range testcases {
variable, err := evalVariable(p, tc.name, pnormalLoadConfig)