From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20495 invoked by alias); 17 Jan 2013 08:59:39 -0000 Received: (qmail 20479 invoked by uid 22791); 17 Jan 2013 08:59:38 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_PV X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Jan 2013 08:59:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B201E2E624; Thu, 17 Jan 2013 03:59:31 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id L+otokuN3OkP; Thu, 17 Jan 2013 03:59:31 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2648C2E1CD; Thu, 17 Jan 2013 03:59:31 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E2E89C08CD; Thu, 17 Jan 2013 12:59:19 +0400 (RET) Date: Thu, 17 Jan 2013 08:59:00 -0000 From: Joel Brobecker To: Kaushik Phatak Cc: "gdb-patches@sourceware.org" , "binutils@sourceware.org" , Pedro Alves , Yao Qi , nick clifton , Tom Tromey Subject: Re: [RFA 3/5] New port: CR16: gdb port Message-ID: <20130117085919.GA3564@adacore.com> References: <507279C7.8080401@codesourcery.com> <20121022224107.GB3713@adacore.com> <20121023135502.GA3555@adacore.com> <20121115174313.GC3790@adacore.com> <20121122175010.GG9964@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2013-01/txt/msg00355.txt.bz2 > I have extracted a cvs diff below. A read only CVS did not allow me to add > new files, so I had to add them to CVS/Entries. The diff appears to be > against /dev/null. Please let me know if this is OK. Yes, this is fine. Or you could have simply attached the new file, instead of making a diff version /dev/null. Either way works for me. > +/* Target-dependent code for GNU/Linux on the Sitel CR16 processors. > + > + Copyright (C) 2013 Free Software Foundation, Inc. The copyright years should cover the years that the work was committed to a medium (hard drive). IIRC, you submitted this work in 2012, so it should contain at least 2012: Copyright (C) 2012-2013 Free Softward Foundation, Inc. > +static struct type * > +cr16_register_type (struct gdbarch *gdbarch, int reg_nr) > +{ > + switch (reg_nr) > + { > + case CR16_PC_REGNUM: /* Note: PC in CR16 is of 24 bits. */ > + return builtin_type (gdbarch)->builtin_func_ptr; > + > + case CR16_RA_REGNUM: /* Return address reg. */ > + return builtin_type (gdbarch)->builtin_data_ptr; > + break; Pedro remarked on one of my patches that the "break" statement after a return is useless, and he's right. Let's remove all of them (more of those in the same function). > +static void > +check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value) > +{ > + struct cr16_prologue *result = (struct cr16_prologue *) result_untyped; > + > + if (value.kind == pvk_register > + && value.k == 0 > + && pv_is_register (addr, CR16_SP_REGNUM) > + && size == register_size (target_gdbarch(), value.reg)) Missing space after "target_gdbarch". > + stack = make_pv_area (CR16_SP_REGNUM, gdbarch_addr_bit (target_gdbarch())); Same here. > + /* Read 6 bytes, max 48 bit opcode. */ > + target_read_memory (pc, buf, 6); > + cr16_words[0] = buf[1] << 8 | buf[0]; > + cr16_words[1] = buf[3] << 8 | buf[2]; > + cr16_words[2] = buf[5] << 8 | buf[4]; > + cr16_allWords = (((ULONGLONG) cr16_words[0] << 32) > + + ((ULONGLONG) cr16_words[1] << 16) > + + cr16_words[2]); > + > + /* Find a matching opcode in table. > + Nonzero means instruction has a match. */ > + is_decoded = cr16_match_opcode (); > + cr16_make_instruction (); > + length = cr16_currInsn.size; It hurts every time I read this code... Nothing you can do short of improving opcode, but this is really awful :-(. > + /* Functions with a variable number of arguments have all of their > + variable arguments and the last non-variable argument passed > + on the stack. > + > + Otherwise, we can pass up to four arguments on the stack. Up to 4 arguments on the stack? Or by register? > +static const gdb_byte * > +cr16_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, > + int *lenptr) > +{ > + /* We use different breakpoint instructions for ELF and uClinux. > + See cr16-linux-tdep.c for more details. */ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + *lenptr = 2; > + if (tdep == NULL || tdep->breakpoint == NULL) > + return breakpoint_elf; The above does not look right. tdep should never be NULL, and I suggest that tdep->breakpoint always be initialized (by cr16_gdbarch_init). > + return tdep->breakpoint; So the contents of the function should be limited to this last line. The rest still looks pretty good to me :) -- Joel