MCPcopy Create free account
hub / github.com/SeeFlowerX/stackplz / Parse_FileConfig

Method Parse_FileConfig

user/config/config_module.go:281–328  ·  view source on GitHub ↗
(config *UprobeFileConfig)

Source from the content-addressed store, hash-verified

279}
280
281func (this *StackUprobeConfig) Parse_FileConfig(config *UprobeFileConfig) (err error) {
282 for index, point_config := range config.Points {
283 hook_point := &UprobeArgs{}
284 hook_point.BindSyscall = false
285 hook_point.ExitRead = false
286 hook_point.Index = uint32(index)
287 hook_point.LibPath = this.LibPath
288 hook_point.RealFilePath = this.RealFilePath
289 hook_point.NonElfOffset = this.NonElfOffset
290 hook_point.Name = point_config.Name
291 if point_config.Signal != "" {
292 hook_point.KillSignal = util.ParseSignal(point_config.Signal)
293 }
294
295 // strstr / strstr+0x4 / 0xA94E8
296 items := strings.Split(point_config.Name, "+")
297 if len(items) == 1 {
298 sym_or_off := items[0]
299 if strings.HasPrefix(sym_or_off, "0x") {
300 offset, err := strconv.ParseUint(sym_or_off, 0, 64)
301 if err != nil {
302 return errors.New(fmt.Sprintf("parse for %s failed, err:%v", point_config.Name, err))
303 }
304 hook_point.Offset = offset
305 hook_point.Symbol = ""
306 } else {
307 hook_point.Symbol = sym_or_off
308 }
309 } else if len(items) == 2 {
310 hook_point.Symbol = items[0]
311 sym_or_off := items[1]
312 offset, err := strconv.ParseUint(sym_or_off, 0, 64)
313 if err != nil {
314 return errors.New(fmt.Sprintf("parse for %s failed, err:%v", point_config.Name, err))
315 }
316 hook_point.Offset = offset
317 } else {
318 return errors.New(fmt.Sprintf("parse for %s failed, err:%v", point_config.Name, err))
319 }
320
321 for arg_index, param := range point_config.Params {
322 point_arg := param.GetPointArg(uint32(arg_index), EBPF_UPROBE_ENTER)
323 hook_point.PointArgs = append(hook_point.PointArgs, point_arg)
324 }
325 this.Points = append(this.Points, hook_point)
326 }
327 return nil
328}
329
330func (this *StackUprobeConfig) Parse_HookPoint(configs []string) (err error) {
331 if this.LibPath == "" {

Callers

nothing calls this directly

Calls 2

ParseSignalFunction · 0.92
GetPointArgMethod · 0.80

Tested by

no test coverage detected