(event *Mmap2Event)
| 324 | } |
| 325 | |
| 326 | func (this *MapsHelper) UpdateMaps(event *Mmap2Event) { |
| 327 | maps_lock.Lock() |
| 328 | defer maps_lock.Unlock() |
| 329 | if !slices.Contains(pid_list, event.Pid) { |
| 330 | return |
| 331 | } |
| 332 | // 遇到 mmap2 事件的时候都去尝试读取maps信息 |
| 333 | this.ParseMaps(event.Pid, false) |
| 334 | pid_maps, ok := this.pid_maps[event.Pid] |
| 335 | if !ok { |
| 336 | this.pid_maps[event.Pid] = &ProcMaps{} |
| 337 | } |
| 338 | pid_maps = this.pid_maps[event.Pid] |
| 339 | |
| 340 | if event.Filename == "" { |
| 341 | event.Filename = fmt.Sprintf("UNNAMED_0x%x", event.Addr) |
| 342 | } |
| 343 | info := LibInfo{ |
| 344 | BaseAddr: event.Addr, |
| 345 | Off: event.Pgoff, |
| 346 | EndAddr: event.Addr + event.Len, |
| 347 | LibPath: event.Filename, |
| 348 | } |
| 349 | info.ParseLib() |
| 350 | base_list, ok := (*pid_maps)[event.Filename] |
| 351 | if ok { |
| 352 | // 注意基址列表去重 做成列表的原因是... |
| 353 | has_find := false |
| 354 | for _, info := range base_list { |
| 355 | if info.BaseAddr == info.BaseAddr { |
| 356 | has_find = true |
| 357 | break |
| 358 | } |
| 359 | } |
| 360 | if !has_find { |
| 361 | base_list = append(base_list, info) |
| 362 | (*pid_maps)[event.Filename] = base_list |
| 363 | } |
| 364 | } else { |
| 365 | (*pid_maps)[event.Filename] = []LibInfo{info} |
| 366 | } |
| 367 | // 这一句应该不用了? |
| 368 | this.pid_maps[event.Pid] = pid_maps |
| 369 | } |
| 370 | |
| 371 | func (this *MapsHelper) GetOffset(pid uint32, addr uint64) (info string) { |
| 372 | maps_lock.Lock() |
no test coverage detected