This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Add support for the __flash qualifier on AVR
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pierre Langlois <pierre dot langlois at embecosm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 15 Jul 2014 07:59:04 -0700
- Subject: Re: [PATCH v2] Add support for the __flash qualifier on AVR
- Authentication-results: sourceware.org; auth=none
- References: <1404816844-1639-1-git-send-email-pierre dot langlois at embecosm dot com> <1405435683-10535-1-git-send-email-pierre dot langlois at embecosm dot com>
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 <pierre.langlois@embecosm.com>
>
> 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