Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pierre Langlois <pierre.langlois@embecosm.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Add support for the __flash qualifier on AVR
Date: Wed, 23 Jul 2014 17:42:00 -0000	[thread overview]
Message-ID: <53CFE83F.7030002@embecosm.com> (raw)
In-Reply-To: <53CD357E.50708@redhat.com>

Hi Pedro,

On 21/07/14 16:45, Pedro Alves wrote:
> Hi Pierre,
> 
> On 07/08/2014 11:54 AM, 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).
>>
> 
> Thanks.  This looks good to me, with a couple nits pointed out
> below addressed.
> 

Thanks for looking at this.  I have committed a better version of this patch
last week after review.  So I just submitted another patch improving the
comments as suggested.

>> +/* Address space flags */
>> +
>> +/* We are assigning the TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 to the flash address
>> +   space.  */
>>    /* Is it a code address?  */
>> -  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
>> -      || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
>> +  else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
>> +	   || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
>>      {
>> +      /* A code address, either a function pointer or the program counter, is
>> +	 word (16 bits) addressed.  */
> 
> FYI, the "or the program counter" reference here looks a bit
> confusion-inducing to me.
> 
>   TYPE_CODE_FUNC -> function.
>   TYPE_CODE_METHOD -> C++ class member functions (methods).
> 
> I think you've added that, because the $pc register is of function
> pointer type?  I'd suggest just not bringing that up, as it was before.
> 

Yes you're right, I mentioned the $pc register because of its type.  I
understand it's confusing now.

> 
>>    /* Is it a code address?  */
>> -  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
>> -      || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
>> -      || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
>> +  else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
>> +	   || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
>> +	   || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
> 
> Particularly since this bit didn't get that comment?
>
> BTW, interesting/curious that TYPE_CODE_SPACE is handled
> here but not in avr_address_to_pointer.  Offhand, looks like a
> bug, though off topic for this patch.
> 

I am bit puzzled here but I suspect this was done on purpose.  I'll submit a
patch so we can discuss it.

Thanks,

Pierre


  reply	other threads:[~2014-07-23 16:52 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 ` [PATCH] " Joel Brobecker
2014-07-15 14:46   ` 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 [this message]
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=53CFE83F.7030002@embecosm.com \
    --to=pierre.langlois@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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