This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Implement -list-thread-groups.
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