[PATCH 00/61] More TUI refactorings

Tom Tromey tom@tromey.com
Thu Jul 4 17:03:00 GMT 2019


Here is another series of TUI cleanups.  It covers several things.

I made an attempt to remove most of the uses of the TUI_*_WIN globals,
and to remove explicit checks of window types.  I think this is
important if we want to be able to easily add new types of windows:
the core code should be able to manipulate windows without regard to
their exact contents.

This transformation isn't complete, but this series takes it pretty
far, with many of the remaining uses being in the layout code (mainly
tui-layout.c, but also other files) -- which, if we're going to add
new windows types, is going to need to be rewritten anyhow.  (Also,
even once this is all done, I suspect the command window will always
be a singleton with special code here and there in the TUI anyhow.)

This series also simplifies window creation and management.  By the
end of the series, init_and_make_win is completely gone, replaced with
ordinary uses of "new" at the appropriate spots.  These transforms
make this code much simpler to understand, IMO.

The TUI source code is also rearranged somewhat.  In particular, by
the end of the series, the declaration for a window class is in the
appropriate .h file (that is, most are moved out of tui-data.h), and
all the methods for a given class are grouped into a single .c file.

A couple of small bugs have been fixed in this series.  See the patch
"Fix flushing bug in tui_puts_internal" and also "Remove deleted
breakpoint from TUI display".

Finally, the series contains a fair amount of trivia, just random
little things I noticed while working on the code.

In some cases this series introduces functions, only to remove them
some patches later.  This is a side effect of how I wrote the patches,
but TBH I think it makes each individual patch more clear -- bundling
the two patches together would make the result less obviously correct.

I've tested this as well as I could.  You may want to give it a try,
though.  It is on the "t/tui-rewrite" branch in my github.

Tom




More information about the Gdb-patches mailing list