From 509d6e5505d9238bdd6da1ff5f0f4e42d9052a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 16 Jan 2020 10:50:06 +0100 Subject: [PATCH] synchronize concurrent access to map in test --- GetRuntimeAddresses/symbolyze/gdb_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GetRuntimeAddresses/symbolyze/gdb_test.go b/GetRuntimeAddresses/symbolyze/gdb_test.go index 0f2a1cf..720403f 100644 --- a/GetRuntimeAddresses/symbolyze/gdb_test.go +++ b/GetRuntimeAddresses/symbolyze/gdb_test.go @@ -7,6 +7,7 @@ import ( "os/exec" "regexp" "strconv" + "sync" "testing" ) @@ -35,9 +36,12 @@ func TestSimpleGDB(t *testing.T) { } scanner := NewScanner("_PyRuntime", "*python3*") + var m sync.Mutex scanner.OnFound(func(pid int, offset uint64) error { t.Logf("scanner setting pid %d to offset %x", pid, offset) + m.Lock() ourResults[pid] = offset + m.Unlock() return nil })