From: Joel Brobecker <brobecker@adacore.com>
To: Pierre Langlois <pierre.langlois@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add support for the __flash qualifier on AVR
Date: Tue, 15 Jul 2014 14:00:00 -0000 [thread overview]
Message-ID: <20140715133316.GE4888@adacore.com> (raw)
In-Reply-To: <1404816844-1639-1-git-send-email-pierre.langlois@embecosm.com>
Hello,
> 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.
Sorry about the delay in reviewing this. Some comments below.
> +/* Map DW_AT_address_class attributes to a type_instance_flag_value. Note that
> + this attribute is only valid with pointer types and therefore the flag is set
> + to the pointer type and not its target type. */
Can you start the comment by saying that this function implements the
address_class_name_to_type_flags gdbarch method? You can then add
the comment above as a second paragraph, or perhaps as an implementation
comment inside the function body itself.
> +static int
> +avr_address_class_type_flags (int byte_size, int dwarf2_addr_class)
> +{
Please add a comment saying that this function implements the
address_class_type_flags gdbarch method. Generally speaking, all
new functions without exception should have an introductory comment.
> + // __flash qualifier
Please do not use C++-style comments for the moment.
> + if (dwarf2_addr_class == 1 && byte_size == 2)
> + return AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH;
> + return 0;
> +}
> +
> +/* Convert a type_instance_flag_value to an address space qualifier and
> + vice-versa. */
> +
> +static const char*
> +avr_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
Same as above regarding the function's introductory comment. And also,
I'd prefer it if we avoided two functions being documented with
the same comment, as this opens the door for a function becoming
undocumented if the two functions somehow get separated.
> +{
> + if (type_flags & AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH)
> + return "flash";
> + else
> + return NULL;
> +}
> +
> +static int
> +avr_address_class_name_to_type_flags (struct gdbarch *gdbarch,
> + const char* name,
> + int *type_flags_ptr)
Missing introductory comment ("Implements the ...").
--
Joel
next prev parent reply other threads:[~2014-07-15 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 10:54 Pierre Langlois
2014-07-15 10:36 ` [PING][PATCH] " Pierre Langlois
2014-07-15 14:00 ` Joel Brobecker [this message]
2014-07-15 14:46 ` [PATCH] " Pierre Langlois
2014-07-15 14:59 ` [PATCH v2] " Pierre Langlois
2014-07-15 15:01 ` Joel Brobecker
2014-07-15 15:56 ` Pierre Langlois
2014-07-15 16:42 ` [PUSHED] " Pierre Langlois
2014-07-21 16:02 ` [PATCH] " Pedro Alves
2014-07-23 17:42 ` Pierre Langlois
2014-07-24 1:35 ` Pedro Alves
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=20140715133316.GE4888@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=pierre.langlois@embecosm.com \
/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).