Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC - Python Scripting] Extend Value.dereference to dereference C++ reference values
Date: Mon, 12 Mar 2012 19:41:00 -0000	[thread overview]
Message-ID: <8762e9ppxq.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAGyQ6gzZYpJkoAAMGEcZkNkw+EEOiOa_AE-A3GQRRbn2fN6MeQ@mail.gmail.com>	(Siva Chandra's message of "Mon, 12 Mar 2012 11:02:59 +0530")

>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

Siva> Unless I am missing something, I couldn't find anything which can do
Siva> this in the Python API. Attached is a patch which extends the Python
Siva> API method Value.dereference to 'dereference' C++ reference values as
Siva> well. I am probably overloading the term 'dereference' as used in the
Siva> normal (pointer dereferencing) sense.

I think that is fine.
The patch generally looks good to me.

It needs a doc review.

Siva> +For example, if @code{int_ref} is a reference to value of type
Siva> + @code{int}, declared in your C++ program as

I think that leading space on the second line could go away.

Siva> +      self_val = ((value_object *) self)->value;
Siva> +      switch (TYPE_CODE (value_type (self_val)))

Here I think you need TYPE_CODE (check_typedef (...))

Siva> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
Siva> +	  {debug c++}] != "" } {
Siva> +    untested "Couldn't compile ${srcfile}"
Siva> +    return -1
Siva> +}
Siva> +
Siva> +# Start with a fresh gdb.
Siva> +
Siva> +gdb_exit
Siva> +gdb_start
Siva> +gdb_reinitialize_dir $srcdir/$subdir
Siva> +# Skip all tests if Python scripting is not enabled.
Siva> +if { [skip_python_tests] } { continue }
Siva> +
Siva> +gdb_load ${binfile}

I think all of this can be replaced with prepare_for_testing.


The code bits are ok with those changes.

thanks,
Tom


  reply	other threads:[~2012-03-12 19:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12  5:33 Siva Chandra
2012-03-12 19:41 ` Tom Tromey [this message]
2012-03-12 21:04   ` Tom Tromey

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=8762e9ppxq.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.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