From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13408 invoked by alias); 19 Jul 2009 21:03:59 -0000 Received: (qmail 13400 invoked by uid 22791); 19 Jul 2009 21:03:58 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Jul 2009 21:03:48 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 0E8293E005; Sun, 19 Jul 2009 14:03:46 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id EEB36CD90D; Sun, 19 Jul 2009 14:03:45 -0700 (PDT) Message-ID: <4A6388DD.3050503@vmware.com> Date: Mon, 20 Jul 2009 00:57:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: gdb-patches ml , "mark.kettenis@xs4all.nl" Subject: Re: [RFA/RFC Prec] Add Linux AMD64 process record support second version, (AMD64 Linux system call support) 3/3 References: <4A5A8438.6030005@vmware.com> <4A6121FC.3030205@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2009-07/txt/msg00458.txt.bz2 Hui Zhu wrote: > On Sat, Jul 18, 2009 at 09:14, Michael Snyder wrote: >> Hui Zhu wrote: >> >> >>> + /* Convert tmpulongest to number in record_linux_system_call. */ >>> + switch (tmpulongest) >>> + { >>> + /* sys_read */ >>> + case 0: >>> + num = 3; >>> + break; >>> + /* sys_write */ >>> + case 1: >>> + num = 4; >>> + break; >> Hey Hui, >> >> This switch statement is over 1000 lines long! ;-) >> >> It's OK, there's no real rule against that, but it just >> makes me think about whether shortening it might make it >> any easier to read and maintain... >> >> I thought of suggesting a look-up table, but that would >> actually make it harder to read and maintain, I think... >> >> What about this? If you wrote it this way... >> >> case 1: /* sys_write */ >> >> you'd save over 250 lines, and I think it would be more readable. >> >> And then, if you abstracted the switch statement out >> into a separate function, you could code it like this... >> >> case 1: /* sys_write */ >> return 4; >> case 2: /* sys_open */ >> >> and save another 250 lines, cutting the whole thing by half. >> You'd have to special-case number 158, of course. >> >> I leave it up to you, you can decide. >> >> Other than that it looks fine. Mark? >> >> >> > > That is really a big work. Please let me post a special patch for it later. Yeah, OK.