From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28027 invoked by alias); 8 Jun 2003 19:15:26 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27991 invoked from network); 8 Jun 2003 19:15:24 -0000 Received: from unknown (HELO localhost.redhat.com) (24.157.166.107) by sources.redhat.com with SMTP; 8 Jun 2003 19:15:24 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id DF59D2B63; Sun, 8 Jun 2003 15:15:23 -0400 (EDT) Message-ID: <3EE38B4B.3020100@redhat.com> Date: Sun, 08 Jun 2003 19:15:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Theodore A. Roth" Cc: gdb@sources.redhat.com Subject: Re: avr and frame unwinding References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-06/txt/msg00094.txt.bz2 > :):)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