Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>, gdb@sources.redhat.com
Subject: Re: [RFC] Changes to *_*regset functions
Date: Fri, 13 Jul 2001 12:21:00 -0000	[thread overview]
Message-ID: <1010713192049.ZM20362@ocotillo.lan> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2001-07-13 12:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-13 10:26 Daniel Jacobowitz
2001-07-13 11:47 ` Andrew Cagney
2001-07-13 12:35   ` Kevin Buettner
2001-07-13 12:43     ` Daniel Jacobowitz
2001-07-13 12:55     ` Andrew Cagney
2001-07-13 12:21 ` Kevin Buettner [this message]
     [not found]   ` <3B4F4CC1.1A9076AB@home.com>
     [not found]     ` <1010713195425.ZM20451@ocotillo.lan>
2001-07-13 13:07       ` Can you point me in the right direction Stephen Smith
2001-07-13 13:29         ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010713192049.ZM20362@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=dmj+@andrew.cmu.edu \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox