fix StepInstruction on 1 byte instruction with a software breackpoint (#3084)
This commit is contained in:
parent
5c5fca4849
commit
ae55d84279
5
_fixtures/break/break_amd64.s
Normal file
5
_fixtures/break/break_amd64.s
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT ·asmBrk(SB),0,$0-0
|
||||||
|
BYTE $0xcc
|
||||||
|
RET
|
7
_fixtures/break/main.go
Normal file
7
_fixtures/break/main.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func asmBrk()
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
asmBrk()
|
||||||
|
}
|
@ -2691,6 +2691,26 @@ func TestStepOutDeferReturnAndDirectCall(t *testing.T) {
|
|||||||
{contStepout, 28}})
|
{contStepout, 28}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStepInstructionOnBreakpoint(t *testing.T) {
|
||||||
|
if runtime.GOARCH != "amd64" {
|
||||||
|
t.Skipf("skipping since not amd64")
|
||||||
|
}
|
||||||
|
// StepInstruction should step one instruction forward when
|
||||||
|
// PC is on a 1 byte instruction with a software breakpoint.
|
||||||
|
protest.AllowRecording(t)
|
||||||
|
withTestProcess("break/", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||||
|
setFileBreakpoint(p, t, filepath.ToSlash(filepath.Join(fixture.BuildDir, "break_amd64.s")), 4)
|
||||||
|
|
||||||
|
assertNoError(p.Continue(), t, "Continue()")
|
||||||
|
|
||||||
|
pc := getRegisters(p, t).PC()
|
||||||
|
assertNoError(p.StepInstruction(), t, "StepInstruction()")
|
||||||
|
if pc == getRegisters(p, t).PC() {
|
||||||
|
t.Fatal("Could not step a single instruction")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestStepOnCallPtrInstr(t *testing.T) {
|
func TestStepOnCallPtrInstr(t *testing.T) {
|
||||||
protest.AllowRecording(t)
|
protest.AllowRecording(t)
|
||||||
withTestProcess("teststepprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
withTestProcess("teststepprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||||
|
@ -433,7 +433,7 @@ func (grp *TargetGroup) StepInstruction() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
thread.Breakpoint().Clear()
|
thread.Breakpoint().Clear()
|
||||||
err = thread.SetCurrentBreakpoint(true)
|
err = thread.SetCurrentBreakpoint(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user