Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Symbolizing with GNU addr2line 2.40 records `??:?` as the filename of a location with no line info

Chiusa Adatta ai principianti
#1,044 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #1045 di @TomerAberbach — integrata
  • #1046 di @skyfireitdiy — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
tooling

Direzione di ricerca

L'analisi si trova in readFrame in internal/binutils/addr2liner.go, intorno alle righe 150-165, che attualmente svuota il nome del file solo per ??:0. Leggi la funzione e i test esistenti di addr2liner, quindi verifica come la suddivisione su : gestisce una riga non numerica. È completato quando ??:? produce un nome file vuoto, come ??:0, e un test copre entrambe le forme.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When pprof symbolizes through GNU addr2line from binutils 2.40, it records ??:? as the filename of a location with no file and line info. addr2line 2.40 prints ??:? for an unknown location, but pprof recognizes only ??:0.

Reproduction

In golang:1.26-bookworm (GNU addr2line 2.40), with a heap profile from gperftools:

apt-get update -qq && apt-get install -y -qq google-perftools libgoogle-perftools-dev
go install github.com/google/pprof@latest

cat > t.c <<'C'
#include <stdlib.h>
#include <string.h>
__attribute__((noinline)) char *grow(int n) { char *p = malloc(n); memset(p, 1, n); return p; }
int main(void) { char *k[64] = {0}; for (int i = 0; i < 100000; i++) { free(k[i % 64]); k[i % 64] = grow(64 + i % 512); } return 0; }
C
gcc -O2 -o t t.c   # no -g
HEAPPROFILE=h LD_PRELOAD=$(find / -name libtcmalloc.so -print -quit) ./t
heap=$(ls h.*.heap | sort | tail -1)

addr2line -f -C -i -e ./t 0x$(nm ./t | awk '$3=="grow"{print $1}')
"$(go env GOPATH)/bin/pprof" -raw ./t "$heap" | sed -n '/^Locations/,/^Mappings/p'
Actual

addr2line reports the location as unknown:

grow
??:?

pprof records ??:? as the filename:

     1: 0xaaaae88f08f7 M=1 grow ??:?:0:0 s=0
     2: 0xaaaae88f0757 M=1 main ??:?:0:0 s=0
     4: 0xffff85df7817 M=6 __libc_start_main ??:?:0:0 s=0

A profile written with -proto contains ??:? as each function's filename, and tools reading it show ??:? as the source location.

Expected

An empty filename, as pprof produces for addr2line's ??:0. With llvm-symbolizer installed in the same image, pprof writes these locations with an empty filename (:0:0).

Environment
  • pprof v0.0.0-20261008003335-7bae8d8c4c9e (@latest)
  • GNU addr2line (GNU Binutils for Debian) 2.40
  • Debian bookworm, linux/arm64
Cause

readFrame empties the filename only for ??:0. For ??:?, the text after the last : is not a number, so the whole string stays as the filename:

https://github.com/google/pprof/blob/7bae8d8c4c9ebc3886a79f796fbde65b7e1316f8/internal/binutils/addr2liner.go#L150-L165

Lingua principale
Go
Stelle
9.3k
Fork
682
Merge medio
2g 4h
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/pprof

Tutte le issue di google/pprof

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.