Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] problem with read_memory_string (reads 8 bytes at a time)
Date: Wed, 08 Apr 2009 21:26:00 -0000	[thread overview]
Message-ID: <20090408212609.GG7535@adacore.com> (raw)
In-Reply-To: <1239217285.8871.90.camel@localhost.localdomain>

> 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


  reply	other threads:[~2009-04-08 21:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 18:27 Joel Brobecker
2009-04-08 19:01 ` Thiago Jung Bauermann
2009-04-08 21:26   ` Joel Brobecker [this message]
2009-04-08 22:18     ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090408212609.GG7535@adacore.com \
    --to=brobecker@adacore.com \
    --cc=bauerman@br.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox