Symbolizing with GNU addr2line 2.40 records `??:?` as the filename of a location with no line info
Maintainers usually reply within 1 day
A pull request for this has already been merged.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
The parsing lives in readFrame in internal/binutils/addr2liner.go, around lines 150-165, which currently clears the filename only for ??:0. Read that function and the existing addr2liner tests, then check how the : split handles a non-numeric line. Done when ??:? yields an empty filename like ??:0 and a test covers both forms.
Written by the indexing model from the issue text.
Description
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:
- Dominant language
- Go
- Stars
- 9.3k
- Forks
- 678
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/pprof
-
proftest: Diff fails tests on identical inputs when diff tool is not in PATHPossibly taken @kyyril claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Make comments more discoverable in the web UIPossibly taken @jabrailkhalil claimed this 15 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
google/pprof#1029 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
google/pprof#1020 · 1 comment ·
Maintainers usually reply within 1 day
-
pprof cannot locate source code for the list command in common Go setupsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
google/pprof#1009 · 1 comment ·
Maintainers usually reply within 1 day
-
Label with zero int64 value and no unit get dropped during decodingPossibly taken @ms-hujia claimed this 120 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
google/pprof#1002 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
area: watch bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
mariadb-operator/mariadb-operator#1962 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eugenioenko/ttt#919 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
QuantumNous/new-api#7839 ·
Maintainers usually reply within 1 day
-
bug needs-triage service/costoptimizationhub
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hashicorp/terraform-provider-aws#50507 · 1 comment ·
Maintainers usually reply within 1 day