Re: [PATCH 05/15] Introduce and use debug_printf and debug_vprintf

Gary Benson
2014-07-15T15:21:18Z

Doug Evans wrote:
> Gary Benson writes:
> > 2014-07-09 Tom Tromey <tromey@redhat.com>
> > Gary Benson <gbenson@redhat.com>
> >
> > * common/common-debug.h: New file.
> > * utils.h: Include common-debug.h.
> > * utils.c (debug_vprintf): New function.
> > (debug_printf): Likewise.
> > * common/agent.c (debug_agent_print): New function.
> > (DEBUG_AGENT): Redefine.
> > * nat/i386-dregs.c (debug_printf): Undefine.
> >
> > gdb/gdbserver/
> > 2014-07-09 Tom Tromey <tromey@redhat.com>
> > Gary Benson <gbenson@redhat.com>
> >
> > * utils.h: Include common-debug.h.
> > * debug.h (debug_printf): Don't declare.
> > * debug.c (debug_vprintf): New function.
> > (debug_printf): Use the above.
>
> IWBN if there was more file naming consistency.
> As a general rule, how objectionable is it to have gdb/foo.c
> and gdbserver/foo.c for every shared foo.h header?

I like it.

> [Or common-foo.h header in the case of, e.g., common/common-debug.h.]
> An alternative would be to move common-debug.h to a new directory,
> e.g., shared, and call it shared/debug.h. I'm only mentioning this
> for discussion sake, it's not a requisite for this patch.

I have a script to automate the changes required so we can remove
"-I/path/to/gdb/common" from $CFLAGS. This would allow GDB and/or
gdbserver to have their own "foo.h" that could include "common/foo.h".
The script also removes all the "common-" and "gdb_" prefixes from
header files in common. I plan to submit a patch after this series
is in. This means this series is creating files that will almost
immediately be moved, but the alternative is I end up having to
extensively fix this series (and I already did that once already!)

> In this case, any objection to putting the gdb implementation
> in gdb/debug.c instead of utils.c?

No objection from me, I'll do it.

Thanks,
Gary

--