| 1 | // Copyright 2014 Google Inc. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // Package driver provides an external entry point to the pprof driver. |
| 16 | package driverscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ |
| 17 | |
| 18 | import ( |
| 19 | "ioscip-go gomod github.com/golang/go/src go1.24.0 io/" |
| 20 | "mapsscip-go gomod github.com/golang/go/src go1.24.0 maps/" |
| 21 | "net/httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/" |
| 22 | "regexpscip-go gomod github.com/golang/go/src go1.24.0 regexp/" |
| 23 | "timescip-go gomod github.com/golang/go/src go1.24.0 time/" |
| 24 | |
| 25 | internaldriverscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/driver`/ "github.com/google/pprof/internal/driverscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/driver`/" |
| 26 | "github.com/google/pprof/internal/pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/" |
| 27 | "github.com/google/pprof/profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/" |
| 28 | ) |
| 29 | |
| 30 | // PProf acquires a profile, and symbolizes it using a profile |
| 31 | // manager. Then it generates a report formatted according to the |
| 32 | // options selected through the flags package. |
| 33 | func PProfscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/PProf().(o *Optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#) error { |
| 34 | return internaldriverscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/driver`/.PProfscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/driver`/PProf().(o.internalOptionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#internalOptions().()) |
| 35 | } |
| 36 | |
| 37 | func (o *Optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#) internalOptionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#internalOptions().() *pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options# { |
| 38 | var obj pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/ObjTool# |
| 39 | if o.Objscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Obj. != nil { |
| 40 | obj = &internalObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#{o.Objscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Obj.} |
| 41 | } |
| 42 | var sym pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Symbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Symbolizer# |
| 43 | if o.Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Sym. != nil { |
| 44 | sym = &internalSymbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer#{o.Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Sym.} |
| 45 | } |
| 46 | var httpServer func(args *pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/HTTPServerArgs#) error |
| 47 | if o.HTTPServerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#HTTPServer. != nil { |
| 48 | httpServer = func(args *pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/HTTPServerArgs#) error { |
| 49 | return o.HTTPServerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#HTTPServer.(((*HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/HTTPServerArgs#)(args))) |
| 50 | } |
| 51 | } |
| 52 | return &pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#{ |
| 53 | Writerscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#Writer.: o.Writerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Writer., |
| 54 | Flagsetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#Flagset.: o.Flagsetscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Flagset., |
| 55 | Fetchscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#Fetch.: o.Fetchscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Fetch., |
| 56 | Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#Sym.: sym, |
| 57 | Objscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#Obj.: obj, |
| 58 | UIscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#UI.: o.UIscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#UI., |
| 59 | HTTPServerscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#HTTPServer.: httpServer, |
| 60 | HTTPTransportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Options#HTTPTransport.: o.HTTPTransportscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#HTTPTransport., |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // HTTPServerArgs contains arguments needed by an HTTP server that |
| 65 | // is exporting a pprof web interface. |
| 66 | type HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/HTTPServerArgs# pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/HTTPServerArgs# |
| 67 | |
| 68 | // Options groups all the optional plugins into pprof. |
| 69 | type Optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options# struct { |
| 70 | Writerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Writer. Writerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Writer# |
| 71 | Flagsetscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Flagset. FlagSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet# |
| 72 | Fetchscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Fetch. Fetcherscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Fetcher# |
| 73 | Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Sym. Symbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Symbolizer# |
| 74 | Objscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#Obj. ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool# |
| 75 | UIscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#UI. UIscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI# |
| 76 | HTTPServerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#HTTPServer. func(*HTTPServerArgsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/HTTPServerArgs#) error |
| 77 | HTTPTransportscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Options#HTTPTransport. httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/.RoundTripperscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/RoundTripper# |
| 78 | } |
| 79 | |
| 80 | // Writer provides a mechanism to write data under a certain name, |
| 81 | // typically a filename. |
| 82 | type Writerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Writer# interface { |
| 83 | Openscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Writer#Open.(name string) (ioscip-go gomod github.com/golang/go/src go1.24.0 io/.WriteCloserscip-go gomod github.com/golang/go/src go1.24.0 io/WriteCloser#, error) |
| 84 | } |
| 85 | |
| 86 | // A FlagSet creates and parses command-line flags. |
| 87 | // It is similar to the standard flag.FlagSet. |
| 88 | type FlagSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet# interface { |
| 89 | // Bool, Int, Float64, and String define new flags, |
| 90 | // like the functions of the same name in package flag. |
| 91 | Boolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#Bool.(name string, def bool, usage string) *bool |
| 92 | Intscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#Int.(name string, def int, usage string) *int |
| 93 | Float64scip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#Float64.(name string, def float64, usage string) *float64 |
| 94 | Stringscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#String.(name string, def string, usage string) *string |
| 95 | |
| 96 | // StringList is similar to String but allows multiple values for a |
| 97 | // single flag |
| 98 | StringListscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#StringList.(name string, def string, usage string) *[]*string |
| 99 | |
| 100 | // ExtraUsage returns any additional text that should be printed after the |
| 101 | // standard usage message. The extra usage message returned includes all text |
| 102 | // added with AddExtraUsage(). |
| 103 | // The typical use of ExtraUsage is to show any custom flags defined by the |
| 104 | // specific pprof plugins being used. |
| 105 | ExtraUsagescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#ExtraUsage.() string |
| 106 | |
| 107 | // AddExtraUsage appends additional text to the end of the extra usage message. |
| 108 | AddExtraUsagescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#AddExtraUsage.(eu string) |
| 109 | |
| 110 | // Parse initializes the flags with their values for this run |
| 111 | // and returns the non-flag command line arguments. |
| 112 | // If an unknown flag is encountered or there are no arguments, |
| 113 | // Parse should call usage and return nil. |
| 114 | Parsescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/FlagSet#Parse.(usage func()) []string |
| 115 | } |
| 116 | |
| 117 | // A Fetcher reads and returns the profile named by src, using |
| 118 | // the specified duration and timeout. It returns the fetched |
| 119 | // profile and a string indicating a URL from where the profile |
| 120 | // was fetched, which may be different than src. |
| 121 | type Fetcherscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Fetcher# interface { |
| 122 | Fetchscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Fetcher#Fetch.(src string, duration, timeout timescip-go gomod github.com/golang/go/src go1.24.0 time/.Durationscip-go gomod github.com/golang/go/src go1.24.0 time/Duration#) (*profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Profile#, string, error) |
| 123 | } |
| 124 | |
| 125 | // A Symbolizer introduces symbol information into a profile. |
| 126 | type Symbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Symbolizer# interface { |
| 127 | Symbolizescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Symbolizer#Symbolize.(mode string, srcs MappingSourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/MappingSources#, prof *profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Profile#) error |
| 128 | } |
| 129 | |
| 130 | // MappingSources map each profile.Mapping to the source of the profile. |
| 131 | // The key is either Mapping.File or Mapping.BuildId. |
| 132 | type MappingSourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/MappingSources# map[string][]struct { |
| 133 | Source string // URL of the source the mapping was collected from |
| 134 | Start uint64 // delta applied to addresses from this source (to represent Merge adjustments) |
| 135 | } |
| 136 | |
| 137 | // An ObjTool inspects shared libraries and executable files. |
| 138 | type ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool# interface { |
| 139 | // Open opens the named object file. If the object is a shared |
| 140 | // library, start/limit/offset are the addresses where it is mapped |
| 141 | // into memory in the address space being inspected. If the object |
| 142 | // is a linux kernel, relocationSymbol is the name of the symbol |
| 143 | // corresponding to the start address. |
| 144 | Openscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool#Open.(file string, start, limit, offset uint64, relocationSymbol string) (ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#, error) |
| 145 | |
| 146 | // Disasm disassembles the named object file, starting at |
| 147 | // the start address and stopping at (before) the end address. |
| 148 | Disasmscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool#Disasm.(file string, start, end uint64, intelSyntax bool) ([]Instscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#, error) |
| 149 | } |
| 150 | |
| 151 | // An Inst is a single instruction in an assembly listing. |
| 152 | type Instscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst# struct { |
| 153 | Addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#Addr. uint64 // virtual address of instruction |
| 154 | Textscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#Text. string // instruction text |
| 155 | Functionscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#Function. string // function name |
| 156 | Filescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#File. string // source file |
| 157 | Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Inst#Line. int // source line |
| 158 | } |
| 159 | |
| 160 | // An ObjFile is a single object file: a shared library or executable. |
| 161 | type ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile# interface { |
| 162 | // Name returns the underlying file name, if available. |
| 163 | Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#Name.() string |
| 164 | |
| 165 | // ObjAddr returns the objdump address corresponding to a runtime address. |
| 166 | ObjAddrscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#ObjAddr.(addr uint64) (uint64, error) |
| 167 | |
| 168 | // BuildID returns the GNU build ID of the file, or an empty string. |
| 169 | BuildIDscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#BuildID.() string |
| 170 | |
| 171 | // SourceLine reports the source line information for a given |
| 172 | // address in the file. Due to inlining, the source line information |
| 173 | // is in general a list of positions representing a call stack, |
| 174 | // with the leaf function first. |
| 175 | SourceLinescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#SourceLine.(addr uint64) ([]Framescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#, error) |
| 176 | |
| 177 | // Symbols returns a list of symbols in the object file. |
| 178 | // If r is not nil, Symbols restricts the list to symbols |
| 179 | // with names matching the regular expression. |
| 180 | // If addr is not zero, Symbols restricts the list to symbols |
| 181 | // containing that address. |
| 182 | Symbolsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#Symbols.(r *regexpscip-go gomod github.com/golang/go/src go1.24.0 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.24.0 regexp/Regexp#, addr uint64) ([]*Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym#, error) |
| 183 | |
| 184 | // Close closes the file, releasing associated resources. |
| 185 | Closescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#Close.() error |
| 186 | } |
| 187 | |
| 188 | // A Frame describes a single line in a source file. |
| 189 | type Framescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame# struct { |
| 190 | Funcscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#Func. string // name of function |
| 191 | Filescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#File. string // source file name |
| 192 | Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#Line. int // line in file |
| 193 | Columnscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#Column. int // column in file |
| 194 | StartLinescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Frame#StartLine. int // start line of function (if available) |
| 195 | } |
| 196 | |
| 197 | // A Sym describes a single symbol in an object file. |
| 198 | type Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym# struct { |
| 199 | Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym#Name. []string // names of symbol (many if symbol was dedup'ed) |
| 200 | Filescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym#File. string // object file containing symbol |
| 201 | Startscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym#Start. uint64 // start virtual address |
| 202 | Endscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Sym#End. uint64 // virtual address of last byte in sym (Start+size-1) |
| 203 | } |
| 204 | |
| 205 | // A UI manages user interactions. |
| 206 | type UIscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI# interface { |
| 207 | // ReadLine returns a line of text (a command) read from the user. |
| 208 | // prompt is printed before reading the command. |
| 209 | ReadLinescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#ReadLine.(prompt string) (string, error) |
| 210 | |
| 211 | // Print shows a message to the user. |
| 212 | // It formats the text as fmt.Print would and adds a final \n if not already present. |
| 213 | // For line-based UI, Print writes to standard error. |
| 214 | // (Standard output is reserved for report data.) |
| 215 | Printscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#Print.(...interface{}) |
| 216 | |
| 217 | // PrintErr shows an error message to the user. |
| 218 | // It formats the text as fmt.Print would and adds a final \n if not already present. |
| 219 | // For line-based UI, PrintErr writes to standard error. |
| 220 | PrintErrscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#PrintErr.(...interface{}) |
| 221 | |
| 222 | // IsTerminal returns whether the UI is known to be tied to an |
| 223 | // interactive terminal (as opposed to being redirected to a file). |
| 224 | IsTerminalscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#IsTerminal.() bool |
| 225 | |
| 226 | // WantBrowser indicates whether browser should be opened with the -http option. |
| 227 | WantBrowserscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#WantBrowser.() bool |
| 228 | |
| 229 | // SetAutoComplete instructs the UI to call complete(cmd) to obtain |
| 230 | // the auto-completion of cmd, if the UI supports auto-completion at all. |
| 231 | SetAutoCompletescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/UI#SetAutoComplete.(complete func(string) string) |
| 232 | } |
| 233 | |
| 234 | // internalObjTool is a wrapper to map from the pprof external |
| 235 | // interface to the internal interface. |
| 236 | type internalObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool# struct { |
| 237 | ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#ObjTool. |
| 238 | } |
| 239 | |
| 240 | func (o *internalObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#) Openscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#Open().(file string, start, limit, offset uint64, relocationSymbol string) (pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/ObjFile#, error) { |
| 241 | f, err := o.ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#ObjTool..Openscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool#Open.(file, start, limit, offset, relocationSymbol) |
| 242 | if err != nil { |
| 243 | return nil, err |
| 244 | } |
| 245 | return &internalObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#{f}, err |
| 246 | } |
| 247 | |
| 248 | type internalObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile# struct { |
| 249 | ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#ObjFile. |
| 250 | } |
| 251 | |
| 252 | func (f *internalObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#) SourceLinescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#SourceLine().(frame uint64) ([]pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Framescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Frame#, error) { |
| 253 | frames, err := f.ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#ObjFile..SourceLinescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#SourceLine.(frame) |
| 254 | if err != nil { |
| 255 | return nil, err |
| 256 | } |
| 257 | var pluginFrames []pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Framescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Frame# |
| 258 | for _, f := range frames { |
| 259 | pluginFrames = append(pluginFrames, pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Framescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Frame#(f)) |
| 260 | } |
| 261 | return pluginFrames, nil |
| 262 | } |
| 263 | |
| 264 | func (f *internalObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#) Symbolsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#Symbols().(r *regexpscip-go gomod github.com/golang/go/src go1.24.0 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.24.0 regexp/Regexp#, addr uint64) ([]*pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Sym#, error) { |
| 265 | syms, err := f.ObjFilescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjFile#ObjFile..Symbolsscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjFile#Symbols.(r, addr) |
| 266 | if err != nil { |
| 267 | return nil, err |
| 268 | } |
| 269 | var pluginSyms []*pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Sym# |
| 270 | for _, s := range syms { |
| 271 | ps := pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Symscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Sym#(*s) |
| 272 | pluginSyms = append(pluginSyms, &ps) |
| 273 | } |
| 274 | return pluginSyms, nil |
| 275 | } |
| 276 | |
| 277 | func (o *internalObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#) Disasmscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#Disasm().(file string, start, end uint64, intelSyntax bool) ([]pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Instscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Inst#, error) { |
| 278 | insts, err := o.ObjToolscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalObjTool#ObjTool..Disasmscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/ObjTool#Disasm.(file, start, end, intelSyntax) |
| 279 | if err != nil { |
| 280 | return nil, err |
| 281 | } |
| 282 | var pluginInst []pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Instscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Inst# |
| 283 | for _, inst := range insts { |
| 284 | pluginInst = append(pluginInst, pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.Instscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/Inst#(inst)) |
| 285 | } |
| 286 | return pluginInst, nil |
| 287 | } |
| 288 | |
| 289 | // internalSymbolizer is a wrapper to map from the pprof external |
| 290 | // interface to the internal interface. |
| 291 | type internalSymbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer# struct { |
| 292 | Symbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer#Symbolizer. |
| 293 | } |
| 294 | |
| 295 | func (s *internalSymbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer#) Symbolizescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer#Symbolize().(mode string, srcs pluginscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/.MappingSourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/plugin`/MappingSources#, prof *profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Profile#) error { |
| 296 | isrcs := MappingSourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/MappingSources#{} |
| 297 | mapsscip-go gomod github.com/golang/go/src go1.24.0 maps/.Copyscip-go gomod github.com/golang/go/src go1.24.0 maps/Copy().(isrcs, srcs) |
| 298 | return s.Symbolizerscip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/internalSymbolizer#Symbolizer..Symbolizescip-go gomod github.com/google/pprof . `github.com/google/pprof/driver`/Symbolizer#Symbolize.(mode, isrcs, prof) |
| 299 | } |