MCPcopy Create free account
hub / github.com/google/pprof / readCodeFrames

Method readCodeFrames

internal/binutils/addr2liner_llvm.go:145–169  ·  view source on GitHub ↗

readCodeFrames parses the llvm-symbolizer CODE output for a single address. It returns a populated plugin.Frame array.

()

Source from the content-addressed store, hash-verified

143// readCodeFrames parses the llvm-symbolizer CODE output for a single address. It
144// returns a populated plugin.Frame array.
145func (d *llvmSymbolizer) readCodeFrames() ([]plugin.Frame, error) {
146 line, err := d.rw.readLine()
147 if err != nil {
148 return nil, err
149 }
150 var frame struct {
151 Address string `json:"Address"`
152 ModuleName string `json:"ModuleName"`
153 Symbol []struct {
154 Line int `json:"Line"`
155 Column int `json:"Column"`
156 FunctionName string `json:"FunctionName"`
157 FileName string `json:"FileName"`
158 StartLine int `json:"StartLine"`
159 } `json:"Symbol"`
160 }
161 if err := json.Unmarshal([]byte(line), &frame); err != nil {
162 return nil, err
163 }
164 var stack []plugin.Frame
165 for _, s := range frame.Symbol {
166 stack = append(stack, plugin.Frame{Func: s.FunctionName, File: s.FileName, Line: s.Line, Column: s.Column, StartLine: s.StartLine})
167 }
168 return stack, nil
169}
170
171// addrInfo returns the stack frame information for a specific program
172// address. It returns nil if the address could not be identified.

Callers 1

addrInfoMethod · 0.95

Calls 1

readLineMethod · 0.65

Tested by

no test coverage detected