This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC - Python Scripting] Extend Value.dereference to dereference C++ reference values


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]