Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantxie committed Sep 9, 2024
1 parent fb308b5 commit b7f87b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 7 additions & 9 deletions pkg/proc/heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,14 @@ func (s *HeapScope) parseSegment(name string, md *region) *segment {
gcmask := md.Field("gc" + name + "mask").Field("bytedata").Address()
ptrNum := int64((maxAddr - minAddr) / 8)
ptrMask := make([]uint64, CeilDivide(ptrNum, 64))
mem := cacheMemory(s.mem, uint64(gcmask), int(ptrNum/8))
for i := int64(0); i < ptrNum/8; i++ {
// for every gc mask byte
mask, err := readUintRaw(mem, uint64(gcmask.Add(i*8)), 1)
if err != nil {
logflags.DebuggerLogger().Errorf("read gc data mask error: %v", err)
break
}
data := make([]byte, int(ptrNum/8))
_, err := s.mem.ReadMemory(data, uint64(gcmask))
if err != nil {
logflags.DebuggerLogger().Errorf("read gc data mask error: %v", err)
}
for i, mask := range data {
// convert to 64-bit mask
ptrMask[i/8] |= mask << (8 * (7 - (i % 8)))
ptrMask[i/8] |= uint64(mask) << (8 * (i % 8))
}
seg.init(minAddr, maxAddr, ptrMask)
return &seg
Expand Down
7 changes: 5 additions & 2 deletions pkg/proc/pcfunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ func (s *HeapScope) readFuncTab(md *region, _funcTyp godwarf.Type) {
// funcoff changed type, but had the same meaning.
funcoff = int64(ft.Field("funcoff").Uintptr())
}
fun := s.bi.PCToFunc(uint64(entry))
if fun == nil {
continue
}
f := pcln.SliceIndex(funcoff).Cast(_funcTyp) // runtime._func
funcdata, stackMap, err := s.readFunc(md, f, pctab)
if err != nil {
logflags.DebuggerLogger().Errorf("readFuncTab readFunc err: %v", err)
return
}
fun := s.bi.PCToFunc(uint64(entry))
fe := s.funcExtraMap[fun]
fe.funcdata = funcdata
fe.stackMap = stackMap
Expand Down Expand Up @@ -291,7 +294,7 @@ func (s *HeapScope) stackPtrMask(frames []proc.Stackframe) []framePointerMask {
}
for i, mask := range data {
// convert to 64-bit mask
ptrMask[i/8] |= uint64(mask) << (8 * (7 - (i % 8)))
ptrMask[i/8] |= uint64(mask) << (8 * (i % 8))
}
frPtrMasks = append(frPtrMasks, framePointerMask{
funcName: fn.Name,
Expand Down

0 comments on commit b7f87b3

Please sign in to comment.