This is the mail archive of the 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.

El jue, 26-02-2009 a las 11:59 -0700, Tom Tromey escribiÃ:
> A few functions in python-membuf.c are not static but probably should
> be.  E.g., get_read_buffer.  (Or, if you intend to export that, give
> it a less generic name.)

Ah, I forgot about that. Will look into it.

> Also, mbpy_str still casts a CORE_ADDR to a void*, which is bad.
> Daniel suggested using paddr or paddr_nz here.

I just committed the following patch to fix the issue. I just discovered
about paddr and friends. I used paddress instead of paddr. The
difference between paddr and paddress is that the former padds the
number on the left with 0s, while the latter doesn't. GDB seems to not
pad addresses more often than it pads when printing adresses to the
Thiago Jung Bauermann
IBM Linux Technology Center

commit 7d013430def2b170f8e8ab1d24312dfecaccc13d
Author: Thiago Jung Bauermann <>
Date:   Wed Mar 4 09:14:23 2009 -0800

    Fix issue of casting CORE_ADDR to void * in mbpy_str.

	* python/python-membuf.c (mbpy_str): Use paddress and pulongest to print
	CORE_ADDR values instead of casting to void * and unsigned int.

diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 04bf3b4..c330652 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -125,9 +125,9 @@ mbpy_str (PyObject *self)
   membuf_object *membuf_obj = (membuf_object *) self;
-  return PyString_FromFormat ("memory buffer for address %p, %u bytes long",
-			      (void *) membuf_obj->addr,
-			      (unsigned int) membuf_obj->length);
+  return PyString_FromFormat ("memory buffer for address %s, %s bytes long",
+			      paddress (membuf_obj->addr),
+			      pulongest (membuf_obj->length));

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