From: Anthony Green <green@redhat.com>
To: gdb-patches@sources.redhat.com
Cc: davej@redhat.com
Subject: Patch: memset fixes
Date: Fri, 25 Mar 2005 20:28:00 -0000 [thread overview]
Message-ID: <1111782272.5243.14.camel@localhost.localdomain> (raw)
Dave Jones recently pointed out some memset usage errors in gdb and the
ppc simulator. Here are some patches for the HEAD of the tree.
For gdb...
2005-03-25 Anthony Green <green@redhat.com>
* remote.c (remote_store_registers): Fix memset usage.
* std-regs.c (value_of_builtin_frame_reg): Ditto.
(value_of_builtin_frame_fp_reg): Ditto.
(value_of_builtin_frame_reg): Ditto.
For sim/ppc...
2005-03-25 Anthony Green <green@redhat.com>
* tree.c (parse_reg_property): Fix memset usage.
Index: gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.178
diff -u -p -r1.178 remote.c
--- gdb/remote.c 13 Mar 2005 22:06:10 -0000 1.178
+++ gdb/remote.c 25 Mar 2005 20:24:03 -0000
@@ -3501,7 +3501,7 @@ remote_store_registers (int regnum)
{
int i;
regs = alloca (rs->sizeof_g_packet);
- memset (regs, rs->sizeof_g_packet, 0);
+ memset (regs, 0, rs->sizeof_g_packet);
for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
{
struct packet_reg *r = &rs->regs[i];
Index: gdb/std-regs.c
===================================================================
RCS file: /cvs/src/src/gdb/std-regs.c,v
retrieving revision 1.13
diff -u -p -r1.13 std-regs.c
--- gdb/std-regs.c 11 Feb 2005 04:06:05 -0000 1.13
+++ gdb/std-regs.c 25 Mar 2005 20:24:03 -0000
@@ -61,7 +61,7 @@ value_of_builtin_frame_reg (struct frame
val = allocate_value (builtin_type_frame_reg);
VALUE_LVAL (val) = not_lval;
buf = value_contents_raw (val);
- memset (buf, TYPE_LENGTH (value_type (val)), 0);
+ memset (buf, 0, TYPE_LENGTH (value_type (val)));
/* frame.base. */
if (frame != NULL)
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
@@ -87,7 +87,7 @@ value_of_builtin_frame_fp_reg (struct fr
struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = value_contents_raw (val);
if (frame == NULL)
- memset (buf, TYPE_LENGTH (value_type (val)), 0);
+ memset (buf, 0, TYPE_LENGTH (value_type (val)));
else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
get_frame_base_address (frame));
@@ -105,7 +105,7 @@ value_of_builtin_frame_pc_reg (struct fr
struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = value_contents_raw (val);
if (frame == NULL)
- memset (buf, TYPE_LENGTH (value_type (val)), 0);
+ memset (buf, 0, TYPE_LENGTH (value_type (val)));
else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
get_frame_pc (frame));
Index: sim/ppc/tree.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/tree.c,v
retrieving revision 1.3
diff -u -p -r1.3 tree.c
--- sim/ppc/tree.c 11 Jul 2004 23:42:07 -0000 1.3
+++ sim/ppc/tree.c 25 Mar 2005 20:24:05 -0000
@@ -539,7 +539,7 @@ parse_reg_property(device *current,
if (device_nr_size_cells(bus) > 0)
chp = parse_size(current, bus, chp, ®s[reg_nr].size);
else
- memset(®s[reg_nr].size, sizeof (®s[reg_nr].size), 0);
+ memset(®s[reg_nr].size, 0, sizeof (®s[reg_nr].size));
}
/* create it */
next reply other threads:[~2005-03-25 20:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-25 20:28 Anthony Green [this message]
2005-03-25 20:31 ` Daniel Jacobowitz
2005-03-25 20:40 ` Anthony Green
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=1111782272.5243.14.camel@localhost.localdomain \
--to=green@redhat.com \
--cc=davej@redhat.com \
--cc=gdb-patches@sources.redhat.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