From: Yao Qi <qiyaoltc@gmail.com>
To: Luis Machado <lgustavo@codesourcery.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 12:59:00 -0000 [thread overview]
Message-ID: <20170110125905.GF9518@E107787-LIN> (raw)
In-Reply-To: <29912fac-24a9-afb3-d65e-6d1796fedd14@codesourcery.com>
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.
class cached_reg
{
public:
cached_reg (struct gdbarch *gdbarch, int num_)
: num (num_)
{
this->data = (gdb_byte *) xmalloc (register_size (gdbarch, num_));
}
~cached_reg ()
{
xfree (this->data);
}
private:
int num;
gdb_byte *data;
};
--
Yao (é½å°§)
next prev parent reply other threads:[~2017-01-10 12:59 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 [this message]
2017-01-10 17:42 ` Luis Machado
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=20170110125905.GF9518@E107787-LIN \
--to=qiyaoltc@gmail.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.com \
--cc=nd@arm.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