Created attachment 10701 [details] gdb-hang-gcc721.elf and gdb-ok-gcc631.elf I have a an arm-none-eabi-gcc 7.2.1 .elf that causes gdb to hang when doing tab completion. Problem appears with various gdb's I tried: 1. arm-none-eabi-gdb 8.0.50-8.0.50.20171128-git. This gdb came with the GNU Tools for Arm Embedded Processors 7-2017-q4-major release. 2. arm-none-eabi-gdb 7.2.1 20170904 (previous 2017 q2 ARM tools release) 3. gdb 7.11.1 (non-ARM) Ubuntu 7.11.1-0ubuntu1~16.5 A good and a bad .elf are attached in a .zip. To reproduce, do: $ gdb gdb-hang-gcc721.elf (gdb) break mp_cal<tab> When you press <tab>, gdb will start consuming 100% CPU. I waited for several minutes with no effect. The process must be `kill -9`d to get rid of it. ^C does not work. I tried `set max-completions 5`, which works, and `50`, which still hangs. The good .elf looks like this: $ gdb gdb-ok-gcc631.elf (gdb) break mp_cal<tab>l_ which completes with `l_` immediately (the symbol is still incomplete). You can test this ARM .elf with x64 gdb; you don't need to use an ARM-specific gdb. Both .elf's are from the same large source tree. One was compiled with -flto with arm-none-eabi-gcc 6.3.1, the other with -flto on7.2.1. If I turn off -flto, the problem does not occur, so it's some issue with what -flto is causing to be generated in the elf. Nevertheless, gdb shouldn't hang even if the .elf is bad.
I can reproduce this with gdb up to version 13.2, but no longer with gdb-14.1.