Skip to content

Commit dc5d63d

Browse files
committed
fix(symbolizer): Include module address in cached symbol information
1 parent 8c917ad commit dc5d63d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pkg/symbolize/symbolizer.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ package symbolize
2121
import (
2222
"expvar"
2323
"fmt"
24+
"path/filepath"
25+
"slices"
26+
"strings"
27+
"sync"
28+
"time"
29+
2430
"github.com/rabbitstack/fibratus/pkg/callstack"
2531
"github.com/rabbitstack/fibratus/pkg/config"
2632
"github.com/rabbitstack/fibratus/pkg/event"
@@ -34,11 +40,6 @@ import (
3440
"github.com/rabbitstack/fibratus/pkg/util/va"
3541
log "github.com/sirupsen/logrus"
3642
"golang.org/x/sys/windows"
37-
"path/filepath"
38-
"slices"
39-
"strings"
40-
"sync"
41-
"time"
4243
)
4344

4445
// ErrSymInitialize is thrown if the process symbol handler fails to initialize
@@ -108,8 +109,9 @@ type module struct {
108109
}
109110

110111
type syminfo struct {
111-
module string
112-
symbol string
112+
module string
113+
symbol string
114+
moduleAddress va.Address // base module address
113115
}
114116

115117
func (m *module) keepalive() {
@@ -453,7 +455,7 @@ func (s *Symbolizer) produceFrame(addr va.Address, e *event.Event) callstack.Fra
453455
if sym, ok := s.symbols[e.PID]; ok {
454456
if symbol, ok := sym[addr]; ok {
455457
symCacheHits.Add(1)
456-
frame.Module, frame.Symbol = symbol.module, symbol.symbol
458+
frame.Module, frame.Symbol, frame.ModuleAddress = symbol.module, symbol.symbol, symbol.moduleAddress
457459
return frame
458460
}
459461
}
@@ -571,11 +573,11 @@ func (s *Symbolizer) cacheSymbol(pid uint32, addr va.Address, frame *callstack.F
571573
if sym, ok := s.symbols[pid]; ok {
572574
if _, ok := sym[addr]; !ok {
573575
symCachedSymbols.Add(1)
574-
s.symbols[pid][addr] = syminfo{module: frame.Module, symbol: frame.Symbol}
576+
s.symbols[pid][addr] = syminfo{module: frame.Module, symbol: frame.Symbol, moduleAddress: frame.ModuleAddress}
575577
}
576578
} else {
577579
symCachedSymbols.Add(1)
578-
s.symbols[pid] = map[va.Address]syminfo{addr: {module: frame.Module, symbol: frame.Symbol}}
580+
s.symbols[pid] = map[va.Address]syminfo{addr: {module: frame.Module, symbol: frame.Symbol, moduleAddress: frame.ModuleAddress}}
579581
}
580582
}
581583

0 commit comments

Comments
 (0)