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
This commit is contained in:
chainhelen
2020-03-10 11:34:40 -05:00
committed by GitHub
parent e9b2da17cb
commit f3a191cd73
50 changed files with 1585 additions and 334 deletions

View File

@ -12,8 +12,8 @@ import (
func TestParseCIE(t *testing.T) {
ctx := &parseContext{
buf : bytes.NewBuffer([]byte{3,0,1,124,16,12,7,8,5,16,2,0,36,0,0,0,0,0,0,0,0,16,64,0,0,0,0,0}),
common: &CommonInformationEntry{Length:12},
buf: bytes.NewBuffer([]byte{3, 0, 1, 124, 16, 12, 7, 8, 5, 16, 2, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 16, 64, 0, 0, 0, 0, 0}),
common: &CommonInformationEntry{Length: 12},
length: 12,
}
_ = parseCIE(ctx)
@ -35,8 +35,8 @@ func TestParseCIE(t *testing.T) {
if common.ReturnAddressRegister != 16 {
t.Fatalf("Expected ReturnAddressRegister 16, but get %d", common.ReturnAddressRegister)
}
initialInstructions := []byte{12,7,8,5,16,2,0}
if !bytes.Equal(common.InitialInstructions, initialInstructions){
initialInstructions := []byte{12, 7, 8, 5, 16, 2, 0}
if !bytes.Equal(common.InitialInstructions, initialInstructions) {
t.Fatalf("Expected InitialInstructions %v, but get %v", initialInstructions, common.InitialInstructions)
}
}
@ -56,6 +56,6 @@ func BenchmarkParse(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Parse(data, binary.BigEndian, 0)
Parse(data, binary.BigEndian, 0, ptrSizeByRuntimeArch())
}
}