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: [RFC] problem with read_memory_string (reads 8 bytes at a time)


El miÃ, 08-04-2009 a las 14:26 -0700, Joel Brobecker escribiÃ:
> > 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.

Well, it's not efficient for your case, but it's efficient for the case
where three bytes out of a 4 byte "bite" were good. The next try will
read those 3 bytes and off you go...

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

Yes, I wondered the same when I was implementing LA_GET_STRING. I
believe we can consolidate those routines. I just added a new item to
the ProjectIdeas wiki page, under the "Internals" section.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


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