[PATCH 00/16] clean up remote.c state

Tom Tromey
2013-06-21T17:25:20Z

I was toying with David Taylor's idea of multi-target support, and I
came up with this preliminary series to do some cleanups of remote.c.

Most of this cleanup amounts to moving various global variables into
struct remote_state. I did each variable (or in some cases, a few
clearly related variables) as a separate patch, to make the series
maximally understandable. Each patch can essentially be read (though
not applied) in isolation.

I found the globals using nm. Then I went through them by hand to
find ones that clearly must be global.

This patch does not fix all the globals in remote.c. It is just a
start. For example:

* I suspect the remote_g_packet_data stuff must be per-remote
* remote_protocol_packets has some per-remote state
* I think the client-stop notification code needs some update
* Maybe signal handling needs some fixing up, but what else is new

After this series goes in, I propose that all future remote.c changes
be reviewed to ensure that remote state is in remote_state and not a
new global variable.

This series also does a couple of other minor cleanups to remote.c.
It removes the gdb-specific CRC code in favor of libiberty's; and it
fixes an oddity I noticed with sizeof_pkg.

I built and regression tested this series on x86-64 Fedora 18 using
the native-gdbserver target board.

Tom