Bug 22647 - Tab completion hangs with a gcc7 LTO elf
Summary: Tab completion hangs with a gcc7 LTO elf
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 8.0
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-28 21:09 UTC by Dan Halbert
Modified: 2024-01-04 12:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
gdb-hang-gcc721.elf and gdb-ok-gcc631.elf (1.36 MB, application/zip)
2017-12-28 21:09 UTC, Dan Halbert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Halbert 2017-12-28 21:09:35 UTC
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.
Comment 1 Hannes Domani 2024-01-04 12:05:43 UTC
I can reproduce this with gdb up to version 13.2, but no longer with gdb-14.1.