public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: "Theodore A. Roth" <troth@openavr.org>
Cc: gdb@sources.redhat.com
Subject: Re: avr and frame unwinding
Date: Sun, 08 Jun 2003 19:15:00 -0000	[thread overview]
Message-ID: <3EE38B4B.3020100@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0306081041190.32526-100000@bozoland.mynet>


> :):)Is this arrithmetic correct - I understand the ``* 2'' but not the ``>>8''.
> :):)
> :):)>               pc = (extract_unsigned_integer (buf, 2) * 2) >> 8;
> :)
> :)That's the ugly part I don't understand. It seems to give the correct
> :)result, but now that I think about it more, it could mean that my memory
> :)address is off by 1. I will have to re-examine that.
> :)
> :):)
> :):)this memcpy will need to be a
> :):)
> :):)	store_unsigned_integer (bufferp, pc, SIZEOF_AVR_PC);
> :):)
> :)
> :)I tried that, but it performed a endian byte swap and the PC came out wrong.
> :)I dug around and saw what looked to be too many byte swaps. 
> :)
> :):)>               memcpy (bufferp, &pc, sizeof(pc));
> :):)>             }
> :):)>           else
> :):)>             {
> :):)>               read_memory (this_saved_regs[regnum], bufferp,
> :):)>                            register_size (current_gdbarch, regnum));
> :):)>             }
> 
> I think found the root of the ugliness. When the avr performs a call 
> instruction the PC is pushed onto the stack, but it turns out that it is 
> pushed in big endian order. For the most part though, the avr is little 
> endian.

That would explain it.  I guess it needs an explicit big endian extract 
followed by a little endian store (via store_unsigned_integer).

Andrew


      reply	other threads:[~2003-06-08 19:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-06  0:35 Theodore A. Roth
2003-06-06  2:01 ` Andrew Cagney
2003-06-07 20:23   ` Theodore A. Roth
2003-06-07 22:37     ` Andrew Cagney
2003-06-08  0:26       ` Theodore A. Roth
2003-06-08 17:51         ` Theodore A. Roth
2003-06-08 19:15           ` Andrew Cagney [this message]

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=3EE38B4B.3020100@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=troth@openavr.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).