From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 843 invoked by alias); 2 Nov 2009 09:17:09 -0000 Received: (qmail 826 invoked by uid 22791); 2 Nov 2009 09:17:08 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Nov 2009 09:17:03 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6B2A629004A for ; Mon, 2 Nov 2009 10:17:01 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QZ3U+tPu6FW6 for ; Mon, 2 Nov 2009 10:17:00 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id C2BEA290036 for ; Mon, 2 Nov 2009 10:17:00 +0100 (CET) From: Tristan Gingold Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Subject: Help: address vs pointer Date: Mon, 02 Nov 2009 09:17:00 -0000 Message-Id: <26EF10E2-E2F3-4822-9CD6-4B90CF7B2CE3@adacore.com> To: gdb@sourceware.org Mime-Version: 1.0 (Apple Message framework v1076) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00005.txt.bz2 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.