github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/mmap/manager_test.go (about) 1 package mmap 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestMmapVmData(t *testing.T) { 9 mappings, err := getCurrentProcMaps() 10 if err != nil { 11 t.Fatal(err) 12 } 13 for _, mapping := range mappings { 14 fmt.Printf("%016x - %016x\n", mapping.StartAddr, mapping.EndAddr) 15 } 16 } 17 18 func TestMmapManager(t *testing.T) { 19 data, err := Mmap(215123) 20 if err != nil { 21 t.Fatal(err) 22 } 23 fmt.Printf("%p\n", &data[0]) 24 25 data2, err := Mmap(215123) 26 if err != nil { 27 t.Fatal(err) 28 } 29 fmt.Printf("%p\n", &data2[0]) 30 31 err = Munmap(data) 32 if err != nil { 33 t.Fatal(err) 34 } 35 err = Munmap(data2) 36 if err != nil { 37 t.Fatal(err) 38 } 39 }