This is the mail archive of the archer@sourceware.org mailing list for the Archer 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: [python] Implement gdb.search_memory.


Jan Kratochvil wrote:
> On Fri, 20 Feb 2009 23:03:31 +0100, Thiago Jung Bauermann wrote:
>   
>> Hi,
>>
>> This patch implents gdb.search_memory, exposing the functionality of the
>> 'find' CLI command. Just pushed it to the branch.
>>     
> [...]
>   
>> +      if (PyObject_AsReadBuffer (obj, &buffer, &val_bytes) == -1)
>>     
>
> .././gdb/python/python.c:393: error: passing argument 3 of ‘PyObject_AsReadBuffer’ from incompatible pointer type
>   

I needed to merge some code over to the archer-tromey-python branch
today and wanted a clean compile before I did so. I checked in these
fixes to the above warning, and one other. Please check the latter case,
I'm not sure if setting the buffer to NULL will lead to correct results
in a failure condition.

I think these warnings happen on this (my) system as the version of
Python is different. For reference:

[pmuldoon@localhost archer]$ rpm -q python
python-2.5.2-1.fc10.x86_64


Regards

Phil

ChangeLog

2009-02-24 Phil Muldoon <pmuldoon@redhat.com>

* python/python-membuf.c (get_char_buffer): Initialize buffer to NULL.
* python/python.c (add_pattern_element): Use Py_ssize_t.


diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index d8a8183..04bf3b4 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -165,7 +165,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
 Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
-  void *ptr;
+  void *ptr = NULL;
   Py_ssize_t ret;
 
   ret = get_read_buffer (self, segment, &ptr);
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5836a15..83e6c32 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -387,7 +387,7 @@ add_pattern_element (PyObject *obj, int size, char **pattern_buf,
          object implementing the buffer protocol.  The SIZE parameter is
 	 ignored in this case.  */
 
-      int val_bytes;
+      Py_ssize_t val_bytes;
       const void *buffer;
 
       if (PyObject_AsReadBuffer (obj, &buffer, &val_bytes) == -1)

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