Re: [rfa] gdbserver signal handling

Daniel Jacobowitz
2002-02-28T17:43:57Z

On Thu, Feb 28, 2002 at 12:25:10PM -0500, Andrew Cagney wrote:
> >Er, why did you create src/gdb/signals.c?
> >
> >
> >The reason to create src/gdb/signals.c has nothing to do with
> >gdbserver; it has to do with:
> > - the cleanup I never got to of removing <signal.h> from target.c,
> > since <signal.h> is a host header but used for target information.
> >
> > - the eventual moving of signals.c to be in NATDEPFILES.
> >
> >I don't want to move it to gdbserver, because I've finally reached no
> >code sharing. And because of something you said once, which is now
> >true:
> >
> >>I think, in terms of better splitting up gdbserver and gdb it is pretty
> >>much a requirement. I can but dream of the day when GDBSERVER stops
> >>including defs.h :-)
> >
> >
> >
> >That's why I wanted to do it the above way.
>
> I suspect there is a difference between not including defs.h and
> unnecessarily duplicating common code. My memory was that the signal
> enums were to be moved to their own header file (so things like
> gdbserver could include them).
>
> This gdb/gdbserver/signals.c looks largely like a copy of big chunks of
> gdb/signals.c and other similar code. I don't know that gdb developers
> want to take on responsability for maintaining such duplication.
>
> Again, I think this can be cleaned up properly, but after the 5.2 branch
> goes through.

What do you consider "properly", then? For one minor thing, GDB wants
the conversion functions to return an `enum target_signal' whereas
gdbserver has no need to include "signals.h" in every file and only
wants an `int' back to send to the remote client.

For another, the important reason in that paragraph was not the include
of "defs.h" but the no code sharing. I've gone to great lengths now
to see that changes to GDB will not break gdbserver. And these
functions have been updated only perhaps once a year for new signals,
so the duplication does not convern me overmuch.

Since you seem to strongly prefer sharing it, though, I suppose I could
do this instead:
- create a new directory (``common''?) for files with well-defined
interfaces.
- Move signals.c in there. Create signals.h in there.
- Add that directory to the search paths for both GDB and gdbserver.

This would probably mean picking up the big signal to name conversion
table in gdbserver, which I wanted to avoid but no one else seemed
concerned about.

Meanwhile? Just leave signal handling in gdbserver crippled for the
upcoming branch? OK, I guess.