This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] change gdbserver's pids to int
On Thu, Dec 4, 2008 at 5:15 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Wed, Dec 03, 2008 at 05:24:16PM -0800, Doug Evans wrote:
>> gdb uses an int for a pid (see ptid.pid in defs.h),
>> and, for example, gdbserver's target_ops.create_inferior returns an int.
>> For consistency I made pid an int elsewhere in gdbserver,
>> except for "id" in struct inferior_list - it's used for more than just pids
>> although I suspect int could be used here too, left for another day.
>>
>> Plus this cleans things up by removing local decls of signal_pid.
>>
>> Ok to check in?
>
> Are you sure that every place you touched gets a system PID, not a
> thread ID? They used to be ints, but were changed to unsigned long
> because NPTL's TIDs do not fit in an int.
Ya, I specifically stuck to pids.
> Also, do Windows PIDs fit in an int? Win32 pids must, but I expect
> we'll get a Win64 port at some point.
Good question. I was in part going for consistency with what gdb uses.
Maybe it would be useful to have gdb_pid_t, gdb_tid_t types that both
gdb and gdbserver use.
> I'd like to know the advantage before moving all the deck chairs round
> again.
Consistency with gdb is good. Plus it's odd to pass an unsigned long
to linux_attach_lwp and then it pass that as the pid argument to
ptrace when linux_create_inferior is using an int for pid. And it's
odd that signal_pid is an unsigned long which is then passed to
waitpid. Compiling gdbserver with -Wconversion may have a lot of
noise (enough to warrant not making it the default anyway), but I
think we can still make an effort to be clean.