This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 00/42] Remove globals from buildsym
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 22 May 2018 22:58:09 -0600
- Subject: [RFA 00/42] Remove globals from buildsym
I've long wanted to remove the globals from buildsym and generally
clean it up. I've finally tackled this project, and this series is
the result.
I'm afraid it is a bit on the long side. However, I tried to make
each patch relativey small. Most of them should be easy to review --
and a few are trivial.
Also, I simultaneously wrote this series and learned about some the
workings of buildsym. So, there are some cases where something is
done -- say, an assertion added or a variable made static -- only to
be un-done later in the series. Reordering seemed generally painful
so I have left it as is.
The general idea behind the patches is to move each global variable
(or related set of global variables) into the existing
buildsym_compunit structure. Along the way, some minor cleanups are
done, for example moving stabs-specific things to stabsread.
Once all of the state is in buildsym_compunit, it is put into
buildsym.h for use by symbol readers. Here, I've converted the DWARF
reader to use the new-style API, leaving the other readers alone.
(The other readers continue to rely on a global, but now only one.)
I haven't tried much to clean up buildsym itself. The API is just as
unwieldy as ever -- it just no longer has global state. I have,
however, replaced some data structures with self-managing ones.
There are some holes with the series that you may wish to consider.
* Perhaps some more comments could be added.
* There are still some stabs-specific hacks in buildsym.c that I have
not attempted to remove.
* There are some remaining calls to set_last_source_file (NULL) that
could perhaps be removed as unnecessary. I did not check.
Regression tested by the buildbot. I also did a reasonable, but not
exhaustive, amount of testing here. I've at least smoke-tested the
stabs reader by running some tests with --target_board=stabs.
Tom