From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18803 invoked by alias); 14 Nov 2008 19:19:04 -0000 Received: (qmail 18742 invoked by uid 22791); 14 Nov 2008 19:19:03 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Nov 2008 19:18:28 +0000 Received: (qmail 14574 invoked from network); 14 Nov 2008 19:18:24 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Nov 2008 19:18:24 -0000 From: Vladimir Prus To: Michael Snyder Subject: Re: [RFC] Implement -list-thread-groups. Date: Sat, 15 Nov 2008 09:00:00 -0000 User-Agent: KMail/1.10.90 (Linux/2.6.24-21-generic; KDE/4.1.73; i686; svn-883826; 2008-11-13) Cc: "gdb-patches@sources.redhat.com" References: <200811122333.29218.vladimir@codesourcery.com> <200811142100.56244.vladimir@codesourcery.com> <491DC976.4050506@vmware.com> In-Reply-To: <491DC976.4050506@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811142218.17090.vladimir@codesourcery.com> 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: 2008-11/txt/msg00370.txt.bz2 On Friday 14 November 2008 21:54:46 Michael Snyder wrote: > >> I'm puzzled by this assert. > >> You don't think we'll ever want to specify both the pid and the thread? > > > > I think that makes no sense. If a thread is specified, then there's no > > possible use of 'pid'. Threads are globally numbered. > > Even if it makes no sense in the sense that > it's not required, that doesn't necessarily make it > an error. Suppose somebody specifies both the pid and > the thread? What's the harm? If they're inconsistent > (this pid does not contain this thread), THEN we'll > return an error. I think it's better to make functions have as tight preconditions as possible. In this case, passing both thread and pid does not serve any possible purpose, so it's likely that caller is doing this by mistake. It's best to assert immediately, rather than spending time and code space verifying if those parameters are consistent. Checking if a thread belongs to a process is not the part of this this function purpose. - Volodya