delve/pkg/proc/proc_general_test.go
chainhelen f3a191cd73
pkg/proc,service: support linux/386 (#1884)
Implement debugging function for 386 on linux with reference to AMD64.
There are a few remaining problems that need to be solved in another time.

1. The stacktrace of cgo are not exactly as expected.
2. Not implement `core` for now.
3. Not implement `call` for now. Can't not find `runtime·debugCallV1` or
   similar function in $GOROOT/src/runtime/asm_386.s.

Update #20
2020-03-10 09:34:40 -07:00

27 lines
533 B
Go

package proc
import (
"testing"
"unsafe"
)
func ptrSizeByRuntimeArch() int {
return int(unsafe.Sizeof(uintptr(0)))
}
func TestIssue554(t *testing.T) {
// unsigned integer overflow in proc.(*memCache).contains was
// causing it to always return true for address 0xffffffffffffffff
mem := memCache{true, 0x20, make([]byte, 100), nil}
var addr uint64
switch ptrSizeByRuntimeArch() {
case 4:
addr = 0xffffffff
case 8:
addr = 0xffffffffffffffff
}
if mem.contains(uintptr(addr), 40) {
t.Fatalf("should be false")
}
}