Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA] linux-nat.c minor cleanup
Date: Fri, 13 Mar 2009 17:12:00 -0000	[thread overview]
Message-ID: <e394668d0903131010g1c186b18jf8797c81ff7b67c@mail.gmail.com> (raw)
In-Reply-To: <e394668d0901051600w109d4cc9l800c68c56e5d52af@mail.gmail.com>

Ping.

On Mon, Jan 5, 2009 at 5:00 PM, Doug Evans <dje@google.com> wrote:
> On Mon, Jan 5, 2009 at 3:04 PM, Doug Evans <dje@google.com> wrote:
>> Ping.
>>
>> On Thu, Dec 18, 2008 at 9:34 PM, Doug Evans <dje@google.com> 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  <dje@google.com>
>
>        * 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.
>


  reply	other threads:[~2009-03-13 17:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19  5:35 Doug Evans
2009-01-05 23:04 ` Doug Evans
2009-01-06  0:00   ` Doug Evans
2009-03-13 17:12     ` Doug Evans [this message]
2009-03-14 12:53       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e394668d0903131010g1c186b18jf8797c81ff7b67c@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox