Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: freindlyuser@hushmail.com
To: "Jan Kratochvil" <jan.kratochvil@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: 64bit pointer
Date: Thu, 03 Sep 2009 13:27:00 -0000	[thread overview]
Message-ID: <20090903132719.06D63B0048@smtp.hushmail.com> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 03 Sep 2009 12:33:25 +0000 Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
>On Thu, 03 Sep 2009 14:21:41 +0200, freindlyuser@hushmail.com
>wrote:
>> (gdb) x/s *($rdi+0x8)
>> 0x4210a9b7:      <Address 0x4210a9b7 out of bounds>
>
>This syntax is not much recommended, it means the same as:
>
>(gdb) x/s *(int *) ($rdi+0x8)
>0x4210a9b7:      <Address 0x4210a9b7 out of bounds>
>
>On 64bit arch sizeof (int) == 4 but sizeof (void *) == 8 so you
>will not fetch
>the whole address.
>
>
>> (gdb) x/x $rdi+0x8
>> 0x3a9b4210b7a4: 0x00003a9b4210a9b7
>> (gdb) x/s 0x00003a9b4210a9b7
>> 0x3a9b4210a9b7:  "The string it points to"
>
>Therefore you want one indirection there.
>
>> Should this be happening?
>
>Yes.  Until GDB forbids dereferencing numeric arguments as `int *'
>which IMHO
>is more confusing than convenient.  [Would a patch be approved?]
>
>
>> Is there a work around where I can read the data in
>> 0x00003a9b4210a9b7 without having to manually copy and paste
>(ie:
>> in the commands that are executed on a breakpoint).
>
>This way it should work:
>
>(gdb) x/s *(void **) ($rdi+0x8)
>OR
>(gdb) p *(char **) ($rdi+0x8)
>
>
>Regards,
>Jan

The work around works perfectly.

Thank you.
-----BEGIN PGP SIGNATURE-----
Charset: UTF8
Version: Hush 3.0
Note: This signature can be verified at https://www.hushtools.com/verify

wpwEAQMCAAYFAkqfxDYACgkQWX1/rrecYT2g+gP+J6na4+MXovA7SJRD1oYPKqbZ9Pu1
Ik4vBR5BFt6RLV0zrYXsAnEq1xOXnac1q3r9XNUA0R1jmKtEFYvJjH44KpdzwIwBBRSS
7M7qeaHZZhDEgfJOFUgWS5KUJgjwRo4Rm2lGLNgmaftQVBrgE5HUQxVicwtdwIO9qyhU
i/n0Oas=
=+lL9
-----END PGP SIGNATURE-----


             reply	other threads:[~2009-09-03 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 13:27 freindlyuser [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-03 12:21 freindlyuser
2009-09-03 12:33 ` Jan Kratochvil
2009-09-04 15:47   ` Tom Tromey
2009-09-03 13:01 ` Andreas Schwab

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=20090903132719.06D63B0048@smtp.hushmail.com \
    --to=freindlyuser@hushmail.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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