From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9098 invoked by alias); 12 Jul 2011 20:59:54 -0000 Received: (qmail 9088 invoked by uid 22791); 12 Jul 2011 20:59:53 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jul 2011 20:59:40 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6CKxcFC008335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Jul 2011 16:59:38 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6CKxbBK004742; Tue, 12 Jul 2011 16:59:37 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p6CKxaW7011948; Tue, 12 Jul 2011 16:59:36 -0400 From: Tom Tromey To: paawan oza Cc: gdb-patches@sourceware.org, Petr =?utf-8?Q?Hluz=C3=ADn?= Subject: Re: [PATCH] arm reversible : References: <998639.46560.qm@web112516.mail.gq1.yahoo.com> <321260.58442.qm@web112504.mail.gq1.yahoo.com> Date: Tue, 12 Jul 2011 21:10:00 -0000 In-Reply-To: <321260.58442.qm@web112504.mail.gq1.yahoo.com> (paawan oza's message of "Fri, 3 Jun 2011 00:51:01 -0700 (PDT)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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-07/txt/msg00325.txt.bz2 >>>>> "Oza" == paawan oza writes: Oza> any more comments are welcome make this patch ok, if ARM person can Oza> have a look at it it would be great. You have submitted this patch many times now and nobody has commented on the details of the ARM decoding. I think we should proceed on the theory that this is simply not going to happen. Also, I am not as concerned about the correctness of every detail as I am about the general maintainability and style of the code. I expect there will be bugs; those can be fixed. You need a ChangeLog entry. A patch of this magnitude should also have a NEWS entry. Some kind of testing would be good. Do the existing tests in gdb.reverse work with your port? If so then I think that is sufficient Oza> + unsigned int reg_len = 0; reg_len = LENGTH; \ Just write unsigned int reg_len = LENGTH; Oza> + REGS = (uint32_t*) xmalloc (sizeof(uint32_t) * (reg_len)); \ Mind the spaces and parens. Better, use XNEWVEC: REGS = XNEWVEC (uint32_t, reg_len); Oza> + while (reg_len) \ Oza> + { \ Oza> + REGS[reg_len - 1] = RECORD_BUF[reg_len - 1]; \ Oza> + reg_len--; \ Oza> + } \ Just use memcpy. Oza> +#define MEM_ALLOC(MEMS,LENGTH,RECORD_BUF) \ The same comments apply for this macro. Oza> +/* ARM instruction record contains opcode of current insn and execution state Oza> (before entry to Oza> +decode_insn() ), contains list of to-be-modified registers and memory blocks Oza> (on return from Your email got corrupted. Usually this is some bad MUA setting. Oza> + uint32_t mem_rec_count; /* No of mem recors */ Typo, "recors" Oza> +/* Checks ARM SBZ and SBO mendatory fields. */ Typo, should be "mandatory". Oza> + if(!sbo) Spacing. Oza> + if ((3 == opcode1) && (bit (arm_insn_r->arm_insn, 4))) Over-parenthesizing makes the code harder to read. Please fix this. I noticed it in many places. This specific case should read: if (3 == opcode1 && bit (arm_insn_r->arm_insn, 4)) Oza> + memset(&u_buf, 0, sizeof (u_buf)); Spacing. Just go through the entire patch and fix all the spacing issues. I feel like I have mentioned this before. Oza> + regcache_raw_read_unsigned (reg_cache, reg_src1 Oza> + , &u_buf[0].unsigned_regval); What if this does not return REG_VALID? There are multiple instances of this. Oza> + gdb_assert_not_reached ("no decoding pattern found"); It seems wrong to use an assert in this code. At least, it is not obvious to me that this represents a logic error in gdb as opposed to a merely unrecognized instruction. An unrecognized instruction can occur for many reasons, e.g., a bad jump. Oza> + if ((8 == arm_insn_r->opcode) || (10 == arm_insn_r->opcode) Oza> + || (12 == arm_insn_r->opcode) || (14 == arm_insn_r->opcode) Oza> + || (9 == arm_insn_r->opcode) || (11 == arm_insn_r->opcode) Oza> + || (13 == arm_insn_r->opcode) || (15 == arm_insn_r->opcode) Oza> + || (0 == arm_insn_r->opcode) || (2 == arm_insn_r->opcode) Oza> + || (4 == arm_insn_r->opcode) || (6 == arm_insn_r->opcode) Oza> + || (1 == arm_insn_r->opcode) || (3 == arm_insn_r->opcode) Oza> + || (5 == arm_insn_r->opcode) || (7 == arm_insn_r->opcode)) This reads very oddly. Is there a particular reason behind the ordering (if so -- document). If not, isn't this: if (arm_insn_r->opcode >= 0 && arm_insn_r->opcode <= 15) There are other odd-looking conditions like this. Oza> + default: Oza> + gdb_assert_not_reached ("Invalid addressing mode for insn"); Again, assert seems wrong. I'm afraid I ran out of steam here. Please fix all the issues already noted and look at the rest of the patch with a critical eye to see what else should be cleaned up. I want this patch to go in, but first it must comply to the usual gdb standards. Tom