mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 21:40:22 +08:00
Fix prologue detection on testvariables2.go's main.main (#625)
This commit is contained in:
committed by
Derek Parker
parent
f2c1789c64
commit
e4c7df1469
@ -119,9 +119,11 @@ type instrseq []x86asm.Op
|
||||
|
||||
var windowsPrologue = instrseq{x86asm.MOV, x86asm.MOV, x86asm.LEA, x86asm.CMP, x86asm.JBE}
|
||||
var windowsPrologue2 = instrseq{x86asm.MOV, x86asm.MOV, x86asm.CMP, x86asm.JBE}
|
||||
var windowsPrologue3 = instrseq{x86asm.MOV, x86asm.MOV, x86asm.MOV, x86asm.CMP, x86asm.JE}
|
||||
var unixPrologue = instrseq{x86asm.MOV, x86asm.LEA, x86asm.CMP, x86asm.JBE}
|
||||
var unixPrologue2 = instrseq{x86asm.MOV, x86asm.CMP, x86asm.JBE}
|
||||
var prologues = []instrseq{windowsPrologue, windowsPrologue2, unixPrologue, unixPrologue2}
|
||||
var unixPrologue3 = instrseq{x86asm.MOV, x86asm.MOV, x86asm.CMP, x86asm.JE}
|
||||
var prologues = []instrseq{windowsPrologue, windowsPrologue2, unixPrologue, unixPrologue2, unixPrologue3}
|
||||
|
||||
// FirstPCAfterPrologue returns the address of the first instruction after the prologue for function fn
|
||||
// If sameline is set FirstPCAfterPrologue will always return an address associated with the same line as fn.Entry
|
||||
|
||||
@ -11,8 +11,8 @@ import (
|
||||
"go/token"
|
||||
"reflect"
|
||||
|
||||
"golang.org/x/debug/dwarf"
|
||||
"github.com/derekparker/delve/dwarf/reader"
|
||||
"golang.org/x/debug/dwarf"
|
||||
)
|
||||
|
||||
// EvalExpression returns the value of the given expression.
|
||||
|
||||
@ -14,10 +14,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/debug/dwarf"
|
||||
"github.com/derekparker/delve/dwarf/frame"
|
||||
"github.com/derekparker/delve/dwarf/line"
|
||||
"github.com/derekparker/delve/dwarf/reader"
|
||||
"golang.org/x/debug/dwarf"
|
||||
)
|
||||
|
||||
// Process represents all of the information the debugger
|
||||
|
||||
@ -18,9 +18,9 @@ import (
|
||||
|
||||
sys "golang.org/x/sys/unix"
|
||||
|
||||
"golang.org/x/debug/elf"
|
||||
"github.com/derekparker/delve/dwarf/frame"
|
||||
"github.com/derekparker/delve/dwarf/line"
|
||||
"golang.org/x/debug/elf"
|
||||
)
|
||||
|
||||
// Process statuses
|
||||
|
||||
@ -1882,7 +1882,7 @@ func TestUnsupportedArch(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test1Issue573(t *testing.T) {
|
||||
func TestIssue573(t *testing.T) {
|
||||
// calls to runtime.duffzero and runtime.duffcopy jump directly into the middle
|
||||
// of the function and the temp breakpoint set by StepInto may be missed.
|
||||
withTestProcess("issue573", t, func(p *Process, fixture protest.Fixture) {
|
||||
@ -1895,3 +1895,15 @@ func Test1Issue573(t *testing.T) {
|
||||
assertNoError(p.Step(), t, "Step() #3") // Third step ought to be possible; program ought not have exited.
|
||||
})
|
||||
}
|
||||
|
||||
func TestTestvariables2Prologue(t *testing.T) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
addrEntry, err := p.FindFunctionLocation("main.main", false, 0)
|
||||
assertNoError(err, t, "FindFunctionLocation - entrypoint")
|
||||
addrPrologue, err := p.FindFunctionLocation("main.main", true, 0)
|
||||
assertNoError(err, t, "FindFunctionLocation - postprologue")
|
||||
if addrEntry == addrPrologue {
|
||||
t.Fatalf("Prologue detection failed on testvariables2.go/main.main")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/debug/dwarf"
|
||||
"github.com/derekparker/delve/dwarf/op"
|
||||
"github.com/derekparker/delve/dwarf/reader"
|
||||
"golang.org/x/debug/dwarf"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user