Re: PATCH: Further gdbserver cleanups

Daniel Jacobowitz
2002-04-09T21:17:27Z

On Sat, Apr 06, 2002 at 01:33:35PM -0500, Daniel Jacobowitz wrote:
> This patch adds -Wall to gdbserver's build options, cleans up everything
> that it turned up, and adds the beginnings of a target stack. It also adds
> a simplistic mechanism to track child processes opaquely; for instance, for
> per-child regcaches. No real new functionality here, but it should be
> pretty obvious where I'm going. The next batch of changes are likely to be
> more interesting.
>
> I'll check this in in a day or two if no one objects (well, and when Andrew
> thinks it's been long enough and checks in the relevant MAINTAINERS patch).

Committed in two parts, as Andrew wisely advised. First:

2002-04-09 Daniel Jacobowitz <drow@mvista.com>

* gdbserver/Makefile.in: Add WARN_CFLAGS. Update configury
dependencies.
* gdbserver/configure.in: Check for <string.h>
* gdbserver/configure: Regenerate.
* gdbserver/config.in: Regenerate.
* gdbserver/gdbreplay.c: Include needed system headers.
(remote_open): Remove strchr prototype.
* gdbserver/linux-low.h: Correct #ifdef to HAVE_LINUX_USRREGS.
* gdbserver/regcache.c (supply_register): Change buf argument to const void *.
(supply_register_by_name): Likewise.
(collect_register): Change buf argument to void *.
(collect_register_by_name): Likewise.
* gdbserver/regcache.h: Add missing prototypes.
* gdbserver/remote-utils.c: Include <arpa/inet.h> for inet_ntoa.
* gdbserver/server.c (handle_query): New function.
(attached): New static variable, moved out of main.
(main): Quiet longjmp clobber warnings.
* gdbserver/server.h: Add ATTR_NORETURN and ATTR_FORMAT. Update prototypes.
* gdbserver/utils.c (error): Remove NORETURN.
(fatal): Likewise.

Then the rest:

2002-04-09 Daniel Jacobowitz <drow@mvista.com>

* gdbserver/inferiors.c: New file.
* gdbserver/target.c: New file.
* gdbserver/target.h: New file.
* gdbserver/Makefile.in: Add target.o and inferiors.o. Update
dependencies.
* gdbserver/linux-low.c (inferior_pid): New static variable,
moved from server.c.
(linux_create_inferior): Renamed from create_inferior.
Call add_inferior. Return 0 on success instead of a PID.
(linux_attach): Renamed from myattach.
(linux_kill): Renamed from kill_inferior. Call clear_inferiors ().
(linux_thread_alive): Renamed from mythread_alive.
(linux_wait): Renamed from mywait. Call clear_inferiors () if the
child dies.
(linux_resume): Renamed from myresume. Add missing ``return 0''.
(regsets_store_inferior_registers): Correct error message.
Add missing ``return 0''.
(linux_fetch_registers): Renamed from fetch_inferior_registers.
(linux_store_registers): Renamed from store_inferior_registers.
(linux_read_memory): Renamed from read_inferior_memory.
(linux_write_memory): Renamed from write_inferior_memory.
(linux_target_ops): New structure.
(initialize_low): Call set_target_ops ().
* gdbserver/remote-utils.c (unhexify): New function.
(hexify): New function.
(input_interrupt): Send signals to ``signal_pid''.
* gdbserver/server.c (inferior_pid): Remove.
(start_inferior): Update create_inferior call.
(attach_inferior): Call add_inferior.
(handle_query): New function.
(main): Call handle_query for `q' packets.
* gdbserver/server.h: Include "target.h". Remove obsolete prototypes.
Add prototypes for "inferiors.c", "target.c", hexify, and unhexify.