From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20566 invoked by alias); 31 May 2011 18:05:07 -0000 Received: (qmail 20557 invoked by uid 22791); 31 May 2011 18:05:06 -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, 31 May 2011 18:04:52 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4VI4p8q007061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 May 2011 14:04:51 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4VI4oOZ005208; Tue, 31 May 2011 14:04:51 -0400 Received: from opsy.redhat.com (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 p4VI4n14018078; Tue, 31 May 2011 14:04:50 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 9804B3780FB; Tue, 31 May 2011 12:04:49 -0600 (MDT) 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> Date: Tue, 31 May 2011 18:05:00 -0000 In-Reply-To: <998639.46560.qm@web112516.mail.gq1.yahoo.com> (paawan oza's message of "Sun, 29 May 2011 08:37:44 -0700 (PDT)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-05/txt/msg00700.txt.bz2 >>>>> "Oza" == paawan oza writes: Oza> Fixed some minor issues with Patch. Thanks. Overall I think the basic structure is probably ok. I'd appreciate it if an actual ARM person took a look. Oza> +#define GET_REG_VAL(REGCACHE,NO,VAL) \ Oza> + regcache_raw_read_unsigned (REGCACHE, NO, VAL); Oza> + Oza> +#define GET_REG_VAL_SIGNED(REGCACHE,NO,VAL) \ Oza> + regcache_raw_read_unsigned (REGCACHE, NO, VAL); I think it is better not to have these macros. They don't add anything, but just obscure the underlying implementation. I don't understand why the "SIGNED" macro is defined as calling a function named ..._unsigned. Oza> +#define REG_ALLOC(REGS,LENGTH,RECORD_BUF) \ Oza> +do \ Oza> + { \ Oza> + unsigned int reg_len = 0; \ Oza> + reg_len = LENGTH; \ You might as well coalesce these two lines. Oza> + if (reg_len) \ Oza> + { \ Oza> + REGS = (uint32_t*) xmalloc (sizeof(uint32_t) * (reg_len)); \ Oza> + while (reg_len) \ Oza> + { \ Oza> + REGS[reg_len - 1] = RECORD_BUF[reg_len - 1]; \ Oza> + reg_len--; \ I think this could be replaced with memcpy. Oza> +struct arm_mem_r Oza> +{ Oza> + uint32_t len; /* record length. */ Wrong indentation. Oza> +/* ARM instruction record. Oza> +contains opcode of current insn and execution state (before entry to Oza> +decode_insn() ), Oza> +contains list of to-be-modified registers and memory blocks (on return from Oza> +decode_insn() ). */ Wrong formatting. Oza> +/* checks ARM SBZ and SBO mendatory fields. */ Capitalize. This problem appears more than once. Oza> + memset(&u_buf, 0, sizeof(u_buf)); Wrong formatting. This appears a few times too. Oza> + printf_unfiltered (_("Process record does not support instruction " Oza> + "0x%0x at address %s.\n"), Oza> + arm_insn_r->arm_insn, Oza> + paddress (arm_insn_r->gdbarch, It seems odd that a failure is reported just with a printf. What is the reason for not throwing an exception? Oza> + gdb_assert_not_reached ("no decoding pattern found"); This text makes it sound like this assertion could possibly be reached somehow. I didn't track through all the insn decoding logic; but if this can be triggered by some value (perhaps an invalid instruction) then it is extremely unfriendly to assert. Oza> + struct Oza> + { Oza> + ULONGEST signed_word; It is weird that a "signed" word has an unsigned type. Why is this? Oza> + /* Oza: FIX ME ? what if user hit breakpoint and type reverse, in Oza> + that case, we need to go back with previous CPSR and Oza> + Program Counter.. */ No names in comments. Tom