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: Eli Zaretskii <eliz at gnu dot org>
- To: Giuseppe MONTALTO <giuseppe dot montalto at st dot com>
- Cc: palves at redhat dot com, tromey at redhat dot com, gdb-patches at sourceware dot org, Hafiz_Abid at mentor dot com
- Date: Thu, 18 Oct 2012 19:30:41 +0200
- 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> <50802300.6040304@redhat.com> <76FE3225DF13124EA2D05B290B624C95E66B370299@SAFEX1MAIL1.st.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Giuseppe MONTALTO <giuseppe.montalto@st.com>
> Cc: Tom Tromey <tromey@redhat.com>, "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>, "Abid, Hafiz" <Hafiz_Abid@mentor.com>
> Date: Thu, 18 Oct 2012 18:16:34 +0200
>
> Please, find attached a new patch with all the requested changes (also includes
> The additons to NEWS and gdb.texinfo that I previously posted in a separate patch).
Thanks.
> + ** New optional parameter added to the "-data-write-memory-bytes" command,
> + to allow pattern filling of memory areas.
Please name the new parameter. Otherwise, this part is OK.
> +@item @var{count}
> +Optional argument indicating the number of bytes to be written. If @var{count} is bigger than @var{contents}' length, pattern filling occurs.
What exactly does "pattern filling" mean? This should be explained.
Looking at the code, I think you mean
If @var{count} is greater than @var{contents}' length, @value{GDBN}
will repeatedly write @var{contents} until it fills @var{count}
bytes.
The patch for the manual is OK with these changes.
> for (i = 0; i < len; ++i)
> {
> int x;
> sscanf (cdata + i * 2, "%02x", &x);
> - data[i] = (gdb_byte) x;
> + databuf[i] = (gdb_byte) x;
> + }
Sorry for chiming in late wrt the code parts, but:
. you don't test the return value of sscanf, is that a good idea?
. won't it be better to use strtoul here? that would avoid the need
to cast to gdb_byte, AFAIU