Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Keith Seitz <keiths@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] More wrappers in varobj
Date: Mon, 15 Oct 2001 13:31:00 -0000	[thread overview]
Message-ID: <3BCB4792.7020502@cygnus.com> (raw)
In-Reply-To: <Pine.GSO.4.33.0110151245240.11434-100000@makita.cygnus.com>

> Hi,
> 
> I've been trying to update varobj in light of what appears to be either
> bitrot or a bunch of v3 abi issues. We are seeing an extraordinary number
> of problems with C++.

Keith,

have a look at breakpoint.c:gdb_breakpoint for a more robust / current 
way of implementing these wrappers.

In particular:

- it uses catch_exceptions() which has better defined return values.

- the wrapped function has the correct function signature (not char *) 
meaning that the (illegal) function cast is not needed.

- it uses a dedicated struct to pass in the parameter list instead of 
relying on casts and a union.

enjoy,
Andrew


> Index: wrapper.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/wrapper.h,v
> retrieving revision 1.10
> diff -u -p -r1.10 wrapper.h
> --- wrapper.h	2001/03/06 08:21:18	1.10
> +++ wrapper.h	2001/10/15 19:45:21
> @@ -37,6 +37,8 @@ extern int gdb_value_subscript (value_pt
> 
>  extern int gdb_value_ind (value_ptr val, value_ptr * rval);
> 
> +extern int gdb_value_struct_elt (value_ptr *argp, value_ptr *args, char *name, int *static_memfuncp, char *err, value_ptr * rval);
> +
>  extern int gdb_parse_and_eval_type (char *, int, struct type **);
> 
>  #endif /* WRAPPER_H */
> Index: wrapper.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/wrapper.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 wrapper.c
> --- wrapper.c	2001/03/27 20:36:24	1.12
> +++ wrapper.c	2001/10/15 19:45:21
> @@ -55,6 +55,8 @@ static int wrap_value_subscript (char *)
> 
>  static int wrap_value_ind (char *opaque_arg);
> 
> +static int wrap_value_struct_elt (char *opaque_arg);
> +
>  static int wrap_parse_and_eval_type (char *);
> 
>  int
> @@ -257,6 +259,47 @@ wrap_value_ind (char *opaque_arg)
> 
>    val = (value_ptr) (args)->args[0].pointer;
>    (args)->result.pointer = value_ind (val);
> +  return 1;
> +}
> +
> +int
> +gdb_value_struct_elt (value_ptr *argp, value_ptr *args, char *name,
> +		      int *static_memfuncp, char *err, value_ptr * rval)
> +{
> +  struct gdb_wrapper_arguments argss;
> +
> +  argss.args[0].pointer = argp;
> +  argss.args[1].pointer = args;
> +  argss.args[2].pointer = name;
> +  argss.args[3].pointer = static_memfuncp;
> +  argss.args[4].pointer = err;
> +
> +  if (!catch_errors ((catch_errors_ftype *) wrap_value_struct_elt, &argss,
> +		     "", RETURN_MASK_ERROR))
> +    {
> +      /* An error occurred */
> +      return 0;
> +    }
> +
> +  *rval = (value_ptr) argss.result.pointer;
> +  return 1;
> +}
> +
> +static int
> +wrap_value_struct_elt (char *opaque_arg)
> +{
> +  char *err, *name;
> +  value_ptr *argp, *args;
> +  int *static_memfuncp;
> +  struct gdb_wrapper_arguments *argss = (struct gdb_wrapper_arguments *) opaque_arg;
> +
> +  argp = (value_ptr *) argss->args[0].pointer;
> +  args = (value_ptr *) argss->args[1].pointer;
> +  name = (char *) argss->args[2].pointer; 
> +  static_memfuncp = argss->args[3].pointer;
> +  err  = (char *) argss->args[4].pointer;
> +
> +  (argss)->result.pointer = value_struct_elt (argp, args, name, static_memfuncp, err);
>    return 1;
>  }
> 
> 
> 
> 



       reply	other threads:[~2001-10-15 13:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.GSO.4.33.0110151245240.11434-100000@makita.cygnus.com>
2001-10-15 13:31 ` Andrew Cagney [this message]
2001-10-15 13:36   ` Keith Seitz
2001-10-15 15:42     ` Andrew Cagney
2001-10-19 11:41   ` Keith Seitz

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=3BCB4792.7020502@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=keiths@cygnus.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