From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13481 invoked by alias); 15 Jul 2014 14:59:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13469 invoked by uid 89); 15 Jul 2014 14:59:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 15 Jul 2014 14:59:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3B21C11626C; Tue, 15 Jul 2014 10:59:04 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id S3bbTDBlM9k7; Tue, 15 Jul 2014 10:59:04 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2D708116260; Tue, 15 Jul 2014 10:59:02 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 34CA240EBF; Tue, 15 Jul 2014 07:59:04 -0700 (PDT) Date: Tue, 15 Jul 2014 15:01:00 -0000 From: Joel Brobecker To: Pierre Langlois Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2] Add support for the __flash qualifier on AVR Message-ID: <20140715145904.GF4888@adacore.com> References: <1404816844-1639-1-git-send-email-pierre.langlois@embecosm.com> <1405435683-10535-1-git-send-email-pierre.langlois@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1405435683-10535-1-git-send-email-pierre.langlois@embecosm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-07/txt/msg00383.txt.bz2 On Tue, Jul 15, 2014 at 03:48:03PM +0100, Pierre Langlois wrote: > The __flash qualifier is part of the named address spaces for AVR [1]. It allows > putting read-only data in the flash memory, normally reserved for code. > > When used together with a pointer, the DW_AT_address_class attribute is set to 1 > and allows GDB to detect that when it will be dereferenced, the data will be > loaded from the flash memory (with the LPM instruction). > > We can now properly debug the following code: [...] > 2014-07-08 Pierre Langlois > > gdb/ > * avr-tdep.c (AVR_TYPE_ADDRESS_CLASS_FLASH): New macro. > (AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH): Likewise. > (avr_address_to_pointer): Check for AVR_TYPE_ADDRESS_CLASS_FLASH. > (avr_pointer_to_address): Likewise. > (avr_address_class_type_flags): New function. > (avr_address_class_type_flags_to_name): Likewise. > (avr_address_class_name_to_type_flags): Likewise. > (avr_gdbarch_init): Set address_class_type_flags, > address_class_type_flags_to_name and > address_class_name_to_type_flags. > > gdb/testsuite/ > * gdb.arch/avr-flash-qualifer.c: New. > * gdb.arch/avr-flash-qualifer.exp: New. Thank you. This is now OK to commit with a couple of minor modifications. First, would you mind reformatting the revision log so as to stay withing 76 characters instead of 80? This is because "git show" will indent that revision log by 4 characters, thus causing formatting issues for those of us who still use an 80 columns terminal. Also: > +static int > +avr_address_class_type_flags (int byte_size, int dwarf2_addr_class) > +{ > + /* The value 1 of the DW_AT_address_class attribute corresponds to the __flash This line is too long (81 chars?) > +int > +main (void) > +{ > + const __flash char *pointer_to_flash = &data_in_flash; > + /* break here. */ Something I missed here. The project decided to try to follow the same coding standards for our test programs as in the GDB code. So can you skip a line after the variable declaration, and before the comment? -- Joel