Re: [RFC] problem with read_memory_string (reads 8 bytes at a time)

Joel Brobecker
2009-04-08T21:26:24Z

> I suggest using target_read_string. If I understand its code correctly,
> it handles the corner case you hit.

Thanks for the tip!

It looks like it does, indeed - although a little ineffectively:
Once it failed to read a 4byte block, it tries reading 1 byte.
If that works, then it tries 3bytes, which won't work again,
and thus try 1 byte one more time. If that works, then it'll read
2 bytes, etc. I don't think this is a big deal, though.

That being said, I am wondering why we have more than 1 routine
to read strings... Is there something we should do?

(I will change my code to use target_read_string for now - this won't
help testing the case were we cross a boundary because the \0 is
byte 0 of the last 4 bytes of my section, and that section is 4bytes-
aligned).

--
Joel