Skip to content

Commit

Permalink
fix: moduledata bugs (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantxie authored Sep 9, 2024
1 parent 3086709 commit 98cc600
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pkg/proc/heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,11 @@ func (s *HeapScope) readHeap() error {
spans, spanInfos := s.readAllSpans(mheap.Field("allspans").Array(), spanInUse, kindSpecialFinalizer)

// start read arenas
if s.readArenas(mheap) {
return nil
if !s.readArenas(mheap) {
// read typed pointers when enabled alloc header
s.readTypePointers(spans, spanInfos)
}

// read typed pointers when enabled alloc header
s.readTypePointers(spans, spanInfos)

// read firstmoduledata
return s.readModuleData()
}
Expand Down Expand Up @@ -560,8 +558,8 @@ func (s *HeapScope) readModuleData() error {
firstmoduledata := toRegion(tmp, s.bi)
for md := firstmoduledata; md.a != 0; md = md.Field("next").Deref() {
var data, bss segment
data.init(Address(firstmoduledata.Field("data").Uintptr()), Address(firstmoduledata.Field("edata").Uintptr()))
bss.init(Address(firstmoduledata.Field("bss").Uintptr()), Address(firstmoduledata.Field("ebss").Uintptr()))
data.init(Address(md.Field("data").Uintptr()), Address(md.Field("edata").Uintptr()))
bss.init(Address(md.Field("bss").Uintptr()), Address(md.Field("ebss").Uintptr()))
s.data = append(s.data, &data)
s.bss = append(s.bss, &bss)
}
Expand Down

0 comments on commit 98cc600

Please sign in to comment.