This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] Changes to *_*regset functions
- To: Daniel Jacobowitz <dmj+ at andrew dot cmu dot edu>, gdb at sources dot redhat dot com
- Subject: Re: [RFC] Changes to *_*regset functions
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Fri, 13 Jul 2001 12:20:50 -0700
- References: <20010713102605.A32410@nevyn.them.org>
On Jul 13, 10:26am, Daniel Jacobowitz wrote:
> Given that almost every call to or definition of these functions starts by
> casting its arguments anyway, I'd like to change the prototypes to the
> somewhat vaguer:
>
> extern void supply_gregset (char *gregs);
> extern void supply_fpregset (char *fpregs);
> extern void fill_gregset (char *gregs, int regno);
> extern void fill_fpregset (char *fpregs, int regno);
>
> It'll add a couple of casts, and remove a couple, and end up with functions
> that can be safely defined in a cross debugger.
>
> Any objection to this?
For this type of thing, I'd prefer to see void * rather than char *.
Of course, the problem with using void * is that we can now pass any
pointer type at all and the compiler won't bat an eye. One of the
things that I learned while doing the ptid_t conversions was that
passing structs (and not pointers to structs) was incredibly useful
for catching type errors. (Pointers to structs work okay too if your
code compiles cleanly with -Werror.) Of course, your struct could be
defined something like this:
struct gdb_gregset
{
void *gregset_ptr; /* pointer to a chunk of memory with the
registers. */
};
Then one of your prototypes could be:
extern void supply_gregset (struct gdb_gregset gregs);
Kevin