From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14131 invoked by alias); 13 Mar 2009 17:10:17 -0000 Received: (qmail 14114 invoked by uid 22791); 13 Mar 2009 17:10:15 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_33,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Mar 2009 17:10:10 +0000 Received: from zps36.corp.google.com (zps36.corp.google.com [172.25.146.36]) by smtp-out.google.com with ESMTP id n2DHA8ON030669 for ; Fri, 13 Mar 2009 10:10:08 -0700 Received: from rv-out-0708.google.com (rvfc5.prod.google.com [10.140.180.5]) by zps36.corp.google.com with ESMTP id n2DHA23E031157 for ; Fri, 13 Mar 2009 10:10:07 -0700 Received: by rv-out-0708.google.com with SMTP id c5so190306rvf.54 for ; Fri, 13 Mar 2009 10:10:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.141.33.19 with SMTP id l19mr718154rvj.91.1236964206902; Fri, 13 Mar 2009 10:10:06 -0700 (PDT) In-Reply-To: References: <20081219053421.2D802412300@localhost> Date: Fri, 13 Mar 2009 17:12:00 -0000 Message-ID: Subject: Re: [RFA] linux-nat.c minor cleanup From: Doug Evans To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-System-Of-Record: true 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-03/txt/msg00213.txt.bz2 Ping. On Mon, Jan 5, 2009 at 5:00 PM, Doug Evans wrote: > On Mon, Jan 5, 2009 at 3:04 PM, Doug Evans wrote: >> Ping. >> >> On Thu, Dec 18, 2008 at 9:34 PM, Doug Evans wrote: >>> Hi. >>> >>> linux-nat.c:linux_nat_info_proc_cmd uses a long long to record a pid. >>> There's not much point in that, so this patch changes it to a long. >>> [either that or it shouldn't use strtoul to parse it :-)] >>> >>> The handling of info proc cmd,cwd,exe is odd too. >>> They're always printed and yet argument parsing looks for them anyway, >>> and ignores invalid commands instead of flagging an error. >>> This patch adds a blurb about printing cmd,cwd,exe in the help text. >>> The manual already touches on this, though it doesn't precisely >>> say that cmd,cwd,exe are always printed. >>> I wouldn't mind also submitting a patch to flag unknown commands >>> as errors, but I'm not sure what's intended as far as the parsing >>> of cmd,cwd,exe. > > Going over the file I found a case I missed. > atoi has undefined behaviour for invalid input so I stuck with strtoul > in linux_nat_info_proc_cmd. Granted, it is awkward that some fns use > long and some fns use int, but ptid_get_pid returns an int and strotul > returns a long. strtopid anyone? > > [I realize this is just minor cleanup, but for completeness' sake, > there are several uses of pid_t in linux-nat.c - maybe pid_t should be > used everywhere instead of int - if one wants to be pedantic. But > then one is left with either assuming it's an int or adding int casts > to sprintf arguments (which the code already does). I don't have a > preference, I'll make the patch look like whatever y'all want. It's > just annoying to see long long used here.] > > This version removes the change to the doc string for "info proc". I > could still use some input on what preferred: remove the argument > processing to watch for cmd, cwd, exe? > > 2008-12-18 Doug Evans > > * linux-nat.c (linux_nat_find_memory_regions): Result of PIDGET is an > int, not a long long. > (linux_nat_info_proc_cmd): Store pid in long instead of long long. >