[v2,0/4] Define gdb.Value(val, type) constructor

Message ID 20190219143356.1576e67f@f29-4.lan
Headers show
Series
  • Define gdb.Value(val, type) constructor
Related show

Message

Kevin Buettner Feb. 19, 2019, 9:33 p.m.
This four part patch series defines a two argument constructor for
gdb.Value.

gdb.Value currently has a one argument constructor.  It takes a python
value, figures out some potentially suitable gdb type and then
constructs a gdb value of that type.

The two argument version that I'm introducing is useful for
constructing a gdb value of a specified type from a buffer of bytes. 
It takes the form gdb.Value (val, type).  VAL is a python buffer object,
i.e. an object from which bytes may be read using python's buffer
protocol.  TYPE is a gdb type perhaps obtained by calling
gdb.lookup_type().

Changes between the original series and this v2 series are as follows:

Patch #1: No changes.

Patch #2:

  Fix wording of comment noted by Simon.
  
  Change PyExc_RuntimeError to PyExc_TypeError for "type argument must
  be a gdb.Type" error.  I found this while adding the additional test
  that Simon suggested.

Patch #3:

  Add test which invokes gdb.Value where second argument is not
  a gdb.Type.  (Suggested by Simon.)

Patch #4:

  Add NEWS entry.  (Requested by Eli.)

  Made other python.texi changes requested by Eli.  

  Added missing "@end defun".

Comments

Kevin Buettner Feb. 26, 2019, 5:35 p.m. | #1
I've pushed this series.

Kevin

On Tue, 19 Feb 2019 14:33:56 -0700
Kevin Buettner <kevinb@redhat.com> wrote:

> This four part patch series defines a two argument constructor for

> gdb.Value.

> 

> gdb.Value currently has a one argument constructor.  It takes a python

> value, figures out some potentially suitable gdb type and then

> constructs a gdb value of that type.

> 

> The two argument version that I'm introducing is useful for

> constructing a gdb value of a specified type from a buffer of bytes. 

> It takes the form gdb.Value (val, type).  VAL is a python buffer object,

> i.e. an object from which bytes may be read using python's buffer

> protocol.  TYPE is a gdb type perhaps obtained by calling

> gdb.lookup_type().

> 

> Changes between the original series and this v2 series are as follows:

> 

> Patch #1: No changes.

> 

> Patch #2:

> 

>   Fix wording of comment noted by Simon.

>   

>   Change PyExc_RuntimeError to PyExc_TypeError for "type argument must

>   be a gdb.Type" error.  I found this while adding the additional test

>   that Simon suggested.

> 

> Patch #3:

> 

>   Add test which invokes gdb.Value where second argument is not

>   a gdb.Type.  (Suggested by Simon.)

> 

> Patch #4:

> 

>   Add NEWS entry.  (Requested by Eli.)

> 

>   Made other python.texi changes requested by Eli.  

> 

>   Added missing "@end defun".