Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Alan Hayward <Alan.Hayward@arm.com>,
	"gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PATCH 2/3] Allocate data in cached_reg_t
Date: Tue, 10 Jan 2017 17:42:00 -0000	[thread overview]
Message-ID: <4553e987-6404-8123-eae7-48f85bf62388@codesourcery.com> (raw)
In-Reply-To: <20170110125905.GF9518@E107787-LIN>

On 01/10/2017 06:59 AM, Yao Qi wrote:
> On 17-01-09 14:11:13, Luis Machado wrote:
>>> @@ -6306,7 +6306,7 @@ remote_console_output (char *msg)
>>> typedef struct cached_reg
>>> {
>>>   int num;
>>> -  gdb_byte data[MAX_REGISTER_SIZE];
>>> +  gdb_byte *data;
>>
>> Would it make sense to go C++ and use a data structure that can take
>> care of variable sizes? Just thinking if that would be easier than
>> handling allocation/deallocation of the data.
>>
>
> Do you suggest std::vector?  We still need to allocate/deallocate it
> if we change "gdb_byte *data" to "std::vector<gdb_byte> *data", or we
> have to convert cached_reg to class, and do RAII.
>

Something like std::vector, yes. But it is true we will still need to 
allocate the vector itself.

I was pondering about the benefits of not being limited to a specific 
register size. Then we wouldn't need to worry about adjusting things as 
we have to do now.

As i see it, data[register_size(register_size (gdbarch, num)] wouldn't 
be much different than data[MAX_REGISTER_SIZE]. The only thing is that 
we're setting the max register size dynamically.

We may or may not need this flexibility right now, but who knows what 
weird architectures we may have in the future.


  reply	other threads:[~2017-01-10 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 10:57 Alan Hayward
2017-01-09 20:11 ` Luis Machado
2017-01-10 12:59   ` Yao Qi
2017-01-10 17:42     ` Luis Machado [this message]
2017-01-11 10:54       ` Alan Hayward
2017-01-18  9:03 ` Yao Qi

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=4553e987-6404-8123-eae7-48f85bf62388@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=Alan.Hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=qiyaoltc@gmail.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