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: "Abid\, Hafiz" <Hafiz_Abid at mentor dot com>, "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 14 Sep 2012 10:30:36 -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>
>>>>> "Giuseppe" == Giuseppe MONTALTO <giuseppe.montalto@st.com> writes:
Giuseppe> New version of the patch.
I'm sorry about the delay on this.
I know it feels uncomfortable, but it really is good to ping patches --
say every week or so. Otherwise they tend to slide off the radar.
Giuseppe> + int len, r, i, steps, reminder;
Giuseppe> + long int count, j;
I think now size_t is preferred. (This changed since your patch
submission.)
Typo: should be "remainder", not "reminder".
Giuseppe> + count = strtol (argv[2], NULL, 10);
I think strtoul instead.
Giuseppe> + if (len < count)
Giuseppe> + {
Giuseppe> + /* pattern is made of less bytes than count:
Giuseppe> + repeat pattern to fill memory. */
Comments should start with an uppercase letter.
Giuseppe> + else
Giuseppe> + {
Giuseppe> + /* pattern is longer than (or equal to) count:
Giuseppe> + just copy len bytes. */
Likewise.
Giuseppe> + xfree (databuf);
It seems like you could do less work for the usual case where len==count.
That is, avoid the extra malloc and memcpy.
Giuseppe> +set testfile "mi-read-memory"
Giuseppe> +set srcfile ${testfile}.c
Giuseppe> +set binfile ${objdir}/${subdir}/${testfile}
Use standard_testfile now.
Giuseppe> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
Giuseppe> + untested mi-read-memory.exp
Use build_executable instead and don't call untested.
Giuseppe> +return 0
No need for a return at the end of a .exp file.
Tom