From: Tristan Gingold <gingold@adacore.com>
To: gdb@sourceware.org
Subject: Help: address vs pointer
Date: Mon, 02 Nov 2009 09:17:00 -0000 [thread overview]
Message-ID: <26EF10E2-E2F3-4822-9CD6-4B90CF7B2CE3@adacore.com> (raw)
Hi,
I have a problem with the address vs pointer circuitry in gdb for the
AVR.
The AVR is a pure harvard architecture and furthermore the pc is an
index to words (2 bytes). Instruction
pointers are also index to words.
In the ELF world, addresses are bytes indexes (and data addresses have
a 0x80000 offset).
So far so good.
In gdb world, instruction addresses should be in bytes and thus so are
arch_unwind_pc and arch_read_pc.
But arch_pointer_to_adress will multiply by 2 pointers to instructions
and will add an offset for pointer
to data.
So what should be the type of the pc register ?
If it is a pointer to instructions, 'print $pc' would be wrong as it
would be multiplied by 4 (once by
read_pc and once during evaluation).
If it is not a pointer to instructions, 'disass $pc $pc+4' would be
wrong because an offset would be added
like for any non-instruction pointer value.
What did I miss ?
Tristan.
next reply other threads:[~2009-11-02 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 9:17 Tristan Gingold [this message]
2009-11-02 15:48 ` Joel Brobecker
2009-11-02 16:04 ` Tristan Gingold
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=26EF10E2-E2F3-4822-9CD6-4B90CF7B2CE3@adacore.com \
--to=gingold@adacore.com \
--cc=gdb@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