diff --git a/proc/disasm_amd64.go b/proc/disasm_amd64.go index 3339f27f..b2278a34 100644 --- a/proc/disasm_amd64.go +++ b/proc/disasm_amd64.go @@ -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 diff --git a/proc/eval.go b/proc/eval.go index d7393f37..24245ac3 100644 --- a/proc/eval.go +++ b/proc/eval.go @@ -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. diff --git a/proc/proc.go b/proc/proc.go index 081ac921..fc3a11c4 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -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 diff --git a/proc/proc_linux.go b/proc/proc_linux.go index 9ead16e2..53098434 100644 --- a/proc/proc_linux.go +++ b/proc/proc_linux.go @@ -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 diff --git a/proc/proc_test.go b/proc/proc_test.go index 755e3f03..fb40494c 100644 --- a/proc/proc_test.go +++ b/proc/proc_test.go @@ -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") + } + }) +} diff --git a/proc/variables.go b/proc/variables.go index 37647276..5fe0ab69 100644 --- a/proc/variables.go +++ b/proc/variables.go @@ -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 (