proc: fix next when disassembly fails
Next should work even if one or more instructions in the current function can not be disassembled.
This commit is contained in:
parent
63c880780f
commit
cab09a4bbb
7
_fixtures/nodisasm/main.go
Normal file
7
_fixtures/nodisasm/main.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func asmFunc()
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
asmFunc()
|
||||||
|
}
|
16
_fixtures/nodisasm/nodisasm_amd64.s
Normal file
16
_fixtures/nodisasm/nodisasm_amd64.s
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT ·asmFunc(SB),0,$0-0
|
||||||
|
MOVQ AX, AX
|
||||||
|
MOVQ AX, AX
|
||||||
|
MOVQ AX, AX
|
||||||
|
MOVSS (AX), X2
|
||||||
|
VBROADCASTSS X2, X2
|
||||||
|
VMOVDQU (AX), X3
|
||||||
|
MOVSS (AX), X1
|
||||||
|
PUNPCKLBW X0, X1
|
||||||
|
VPUNPCKLWD X0, X1, X1
|
||||||
|
MOVQ AX, AX
|
||||||
|
MOVQ AX, AX
|
||||||
|
MOVQ AX, AX
|
||||||
|
RET
|
@ -56,6 +56,9 @@ func (inst *AsmInstruction) Text(flavour AssemblyFlavour, bi *BinaryInfo) string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (inst *AsmInstruction) IsCall() bool {
|
func (inst *AsmInstruction) IsCall() bool {
|
||||||
|
if inst.Inst == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return inst.Inst.Op == x86asm.CALL || inst.Inst.Op == x86asm.LCALL
|
return inst.Inst.Op == x86asm.CALL || inst.Inst.Op == x86asm.LCALL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3996,3 +3996,15 @@ func TestReadDefer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNextUnknownInstr(t *testing.T) {
|
||||||
|
if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 10) {
|
||||||
|
t.Skip("versions of Go before 1.10 can't assemble the instruction VPUNPCKLWD")
|
||||||
|
}
|
||||||
|
withTestProcess("nodisasm/", t, func(p proc.Process, fixture protest.Fixture) {
|
||||||
|
_, err := setFunctionBreakpoint(p, "main.asmFunc")
|
||||||
|
assertNoError(err, t, "setFunctionBreakpoint()")
|
||||||
|
assertNoError(proc.Continue(p), t, "Continue()")
|
||||||
|
assertNoError(proc.Next(p), t, "Next()")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user