This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] enhancement of mi_cmd_data_write_memory_bytes for filling memory regions (was [PATCH] new MI command for pattern filling of memory regions)
- From: Tom Tromey <tromey at redhat dot com>
- To: Giuseppe MONTALTO <giuseppe dot montalto at st dot com>
- Cc: "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>, "Abid\, Hafiz" <Hafiz_Abid at mentor dot com>
- Date: Fri, 28 Sep 2012 14:07:23 -0600
- Subject: Re: [PATCH] enhancement of mi_cmd_data_write_memory_bytes for filling memory regions (was [PATCH] new MI command for pattern filling of memory regions)
- References: <76FE3225DF13124EA2D05B290B624C95E65F2D466E@SAFEX1MAIL1.st.com> <87sjf9rzr0.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE356@SAFEX1MAIL1.st.com> <871umsqgu8.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE48F@SAFEX1MAIL1.st.com> <87397624b9.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E662A6921F@SAFEX1MAIL1.st.com> <EB3B29AD43CA924DA27099BC851923762992F7@EU-MBX-03.mgc.mentorg.com> <76FE3225DF13124EA2D05B290B624C95E6632A4256@SAFEX1MAIL1.st.com> <878vcc1s9f.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E66B003EA8@SAFEX1MAIL1.st.com> <87wqzgwm4k.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E66B004AC6@SAFEX1MAIL1.st.com>
>>>>> "Giuseppe" == Giuseppe MONTALTO <giuseppe.montalto@st.com> writes:
Giuseppe> the attached patch should fix all the issues.
Thanks. Unfortunately I thought of one more little thing.
Giuseppe> + remainder = count % len; /* there may be some spare bytes. */
Comment should start with a capital letter.
Though TBH you could also just remove this comment since I think the
code is already clear.
Giuseppe> + if (remainder > 0) /* copy spare bytes too. */
Likewise on both counts.
Giuseppe> + else if (len > count)
Giuseppe> + {
Giuseppe> + /* Pattern is longer than count:
Giuseppe> + just copy len bytes. */
Giuseppe> + data = xmalloc (len);
Giuseppe> + make_cleanup (xfree, data);
Giuseppe> + memcpy (data, databuf, len);
There's no need to copy the data here.
Just set data=databuf.
Tom