-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Description
I'm investigating gdb asserts/warnings (gdb 12 asserts, gdb 14 spams warnings) when poking BOLT-ed binaries containing .gdb_index
.
gdb-12 asserts here https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/dwarf2/read.c;h=10550336063f51545063885281dd587a8e1774f0;hb=e53a8e8685685c97588f8319d993ea6cd5635e47#l4502
, and warnings in gdb 14 look like these:
warning: (Internal error: pc 0x231439a0 in read in CU, but not in symtab.)
warning: (Error: pc 0x231439a0 in address map, but not in symtab.)
, coming from here https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/dwarf2/read.c;h=5bbc8e24cf96d4d7dda40b8486b6fd3d88301543;hb=02c10eaecb63e5dbb99cbfdd1c5385e53ed031ff#l3209
So far, what I'm seeing is that BOLT sometimes generates address ranges like this in .gdb_index
:
Low/High address = [0x0, 0x0) (Size: 0x0), CU id = 326
and I think such ranges break this gdb logic https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/dwarf2/read-gdb-index.c;h=9bfc5302b0e87bcf83782b351d25da243e09406d;hb=02c10eaecb63e5dbb99cbfdd1c5385e53ed031ff#l754, as the hi
suddenly becomes max ulong value. Omitting such ranges either in BOLT or in gdb fixes this for some of the binaries I have, and for other gdb still asserts/spams warnings in the same way, but that I'm yet to pin-point.
What makes me think this is BOLT misbehaving (other than obviously odd ranges), is that if I strip the index from BOLT-ed binary and regenerate it by gdb itself -- all seems to be working fine.
I didn't manage to find an open-source reproducer yet, but I can provide a binary together with the BOLT-profile for it, so one wouldn't need to run the binary to BOLT it