Very often I see gdb takes a long time to load large debug binary and I understand that if I put gdb-index section into binary, it should help reduce initial load time when binary is loaded into gdb. I did same and added gdb_index information in my binary using gdb-add-index command

$ gdb-add-index <binary>

and I checked it to see that gdb_index section actually gets added

$ readelf -S <binary>

 [42] .gdb_index        PROGBITS         0000000000000000  4151d2d4
   0000000005981e8a  0000000000000000           0     0     1

But, when I run my binary in gdb, I'm not sure if there is any impact and when I check index-cache stats, it always shows 'Cache misses'. Am I missing something here? How do I make sure that gdb is actually caching debug symbol information and gdb load time is not much even for large binaries.

(gdb) show index-cache 
directory:  The directory of the index cache is "/<dir>/.cache/gdb".

Cache hits (this session): 0
Cache misses (this session): 2

The index cache is currently enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.