]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: move more completion setup into completer.c
authorAndrew Burgess <aburgess@redhat.com>
Mon, 19 Feb 2024 10:53:54 +0000 (10:53 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 25 Mar 2024 17:47:44 +0000 (17:47 +0000)
commitec483c2344f967708cfa71c84ef349b6951c1374
tree8cb4e06eb3351118b83c618ee2430e5969fa6f0e
parent10c58fd8df4b3cbdadd536fbccb39ed111c594c2
gdb: move more completion setup into completer.c

Move more setup of the readline global state relating to tab
completion into completer.c out of top.c.

Lots of the readline setup is done in init_main (top.c).  This commit
moves those bits of initialisation that relate to completion, and
which are only set the one time, into completer.c.  This does mean
that readline initialisation is now done in multiple locations, some
in init_main (top.c) and some in completer.c, but I think this is OK.
The work done in init_main is the general readline setup.

I think making static what can be made static, and having it all in
one file, makes things easier to reason about.  So I'm OK with having
this split initialisation.

The only completion related thing which is still setup in top.c is
rl_completion_display_matches_hook.  I've left this where it is for
now as rl_completion_display_matches_hook is also updated in the tui
code, and the display hook functions are not in completer.c anyway, so
moving this initialisation to completer.c would not allow anything
else to be made static.

There should be no user visible changes after this commit.
gdb/completer.c
gdb/completer.h
gdb/top.c