From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18534 invoked by alias); 3 Dec 2011 20:30:57 -0000 Received: (qmail 18525 invoked by uid 22791); 3 Dec 2011 20:30:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Dec 2011 20:30:38 +0000 Received: by wgbds11 with SMTP id ds11so3289801wgb.12 for ; Sat, 03 Dec 2011 12:30:37 -0800 (PST) Received: by 10.180.92.41 with SMTP id cj9mr4884656wib.21.1322944237244; Sat, 03 Dec 2011 12:30:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.97.14 with HTTP; Sat, 3 Dec 2011 12:30:16 -0800 (PST) In-Reply-To: References: <998639.46560.qm@web112516.mail.gq1.yahoo.com> <321260.58442.qm@web112504.mail.gq1.yahoo.com> <1316327455.23344.YahooMailNeo@web112509.mail.gq1.yahoo.com> <1316404058.27177.YahooMailNeo@web112502.mail.gq1.yahoo.com> <1318650316.91503.YahooMailNeo@web112508.mail.gq1.yahoo.com> From: =?UTF-8?B?UGV0ciBIbHV6w61u?= Date: Sat, 03 Dec 2011 20:30:00 -0000 Message-ID: Subject: Re: [PATCH] arm reversible : To: oza Pawandeep Cc: Tom Tromey , paawan oza , "gdb-patches@sourceware.org" , chandra krishnappa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00086.txt.bz2 On 3 December 2011 20:01, oza Pawandeep wrote: > Hi Tom and Petr, > > This patch includes both of your comments; I have worked both on > formatting and comments, and try to make the patch look ok. > the patch is derived from gdb-7.3.50.20111203 current snapshot. > In function decode_insn: > + > + =C2=A0struct > + =C2=A0 =C2=A0{ > + =C2=A0 =C2=A0 =C2=A0gdb_byte buf[insn_size]; > + =C2=A0 =C2=A0} u_buf; > + > + =C2=A0uint32_t ret=3D0, insn_id =3D 0; > + > + =C2=A0memset (&u_buf, 0, sizeof(u_buf)); > + =C2=A0if (target_read_memory (arm_record->this_addr, &u_buf.buf[0], ins= n_size)) I wonder why is there a `struct u_buf'. Having local variable `buf[insn_size];' would be sufficient and obvious. I am sorry to not discover that earlier. The same thing applies to arm_process_record(). In arm_process_record () > + > + =C2=A0struct > + =C2=A0 =C2=A0 =C2=A0{ > + =C2=A0 =C2=A0 =C2=A0 =C2=A0gdb_byte buf[2]; > + =C2=A0 =C2=A0 =C2=A0} u_buf; > + > + =C2=A0... > + > + =C2=A0arm_record.arm_insn =3D (uint32_t) extract_unsigned_integer (&u_b= uf.buf[0], > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 THUMB_INSN_SIZE_BYTES , > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gdbarch_byte_order (arm_re= cord.gdbarch)); Well, when I said that you probably forgot to copy extract_unsigned_integer() I should have also said that you should have also copied the line target_read_memory (arm_record->this_addr, &u_buf.buf[0], insn_size) Right now extract_unsigned_integer() reads an uninitialized buffer. :-T --=20 Petr Hluzin