This is the mail archive of the
mailing list for the GDB project.
Re: [RFC] problem with read_memory_string (reads 8 bytes at a time)
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 08 Apr 2009 16:01:25 -0300
- Subject: Re: [RFC] problem with read_memory_string (reads 8 bytes at a time)
- References: <20090408182650.GE7535@adacore.com>
El miÃ, 08-04-2009 a las 11:26 -0700, Joel Brobecker escribiÃ:
> b. Read 8 bytes from 0x1002e0 + 8 = 0x1002e8:
> i. The section ends at 0x001102ec, so bfd returns only 4 bytes read.
> ii. We find out that only 4 bytes were read, so we still need to
> read another 4 bytes for the 8byte read to be complete
> iii. the next 4byte read doesn't find a section from which to
> read the 4bytes, and so returns 0 signifying an error.
> I don't really know how to fix this issue except by reading the string
> one byte at a time :-(. Any suggestion?
I suggest using target_read_string. If I understand its code correctly,
it handles the corner case you hit.
I thought that valprint.c:read_string also handled that, but now that I
read the code again, it looks like it would fail too. :-(
Thiago Jung Bauermann
IBM Linux Technology Center