mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 21:40:22 +08:00
Use single byte to store INT3
This commit is contained in:
@ -96,9 +96,9 @@ func (dbp *DebuggedProcess) Registers() (*syscall.PtraceRegs, error) {
|
|||||||
// Sets a breakpoint in the running process.
|
// Sets a breakpoint in the running process.
|
||||||
func (dbp *DebuggedProcess) Break(addr uintptr) (*BreakPoint, error) {
|
func (dbp *DebuggedProcess) Break(addr uintptr) (*BreakPoint, error) {
|
||||||
var (
|
var (
|
||||||
int3 = []byte{'0', 'x', 'C', 'C'}
|
int3 = []byte{0xCC}
|
||||||
f, l, fn = dbp.GoSymTable.PCToLine(uint64(addr))
|
f, l, fn = dbp.GoSymTable.PCToLine(uint64(addr))
|
||||||
orginalData = make([]byte, 4)
|
orginalData = make([]byte, 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
_, err := syscall.PtracePeekData(dbp.Pid, addr, orginalData)
|
_, err := syscall.PtracePeekData(dbp.Pid, addr, orginalData)
|
||||||
|
|||||||
@ -140,7 +140,7 @@ func TestBreakPoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pc := regs.PC()
|
pc := regs.PC()
|
||||||
if pc != sleepyaddr {
|
if pc != sleepyaddr+1 {
|
||||||
t.Fatalf("Break not respected:\nPC:%d\nFN:%d\n", pc, sleepyaddr)
|
t.Fatalf("Break not respected:\nPC:%d\nFN:%d\n", pc, sleepyaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user