This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH c++] Change some void* to gdb_byte*
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Fri, 09 Oct 2015 10:53:16 +0100
- Subject: Re: [PATCH c++] Change some void* to gdb_byte*
- Authentication-results: sourceware.org; auth=none
- References: <1444341261-5714-1-git-send-email-simon dot marchi at ericsson dot com>
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