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: [PATCH c++] Change some void* to gdb_byte*


Hi Simon,

On 10/08/2015 10:54 PM, Simon Marchi wrote:
> There are a bunch of places where a void* is implicitely casted into a
> gdb_byte*.  The auto-insert-casts script added explicit casts at those
> places.  However, in many cases, it makes more sense to just change the
> void* to a gdb_byte*.
> 

Most look fine except this one:

> @@ -717,7 +717,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
>    static char *keywords[] = { "address", "length", "pattern", NULL };
>    PyObject *start_addr_obj, *length_obj;
>    Py_ssize_t pattern_size;
> -  const void *buffer;
> +  const gdb_byte *buffer;
>    CORE_ADDR found_addr;
>    int found = 0;
>  #ifdef IS_PY3K
> @@ -728,7 +728,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
>  				     &pybuf))
>      return NULL;
>  
> -  buffer = pybuf.buf;
> +  buffer = (gdb_byte *) pybuf.buf;
>    pattern_size = pybuf.len;
>  #else
>    PyObject *pattern;
> @@ -746,7 +746,8 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
>        return NULL;
>      }
>  
> -  if (PyObject_AsReadBuffer (pattern, &buffer, &pattern_size) == -1)
> +  if (PyObject_AsReadBuffer (pattern, (const void **) &buffer,
> +			     &pattern_size) == -1)
>      return NULL;
>  #endif
>  

This will need a fix similar to 39086a0e13:
  https://sourceware.org/ml/gdb-patches/2013-03/msg00449.html

Thanks,
Pedro Alves


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