This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdbserver ptrace() argument type cleanups.


On 02/04/2013 07:01 PM, Tom Tromey wrote:
>>>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:
> 
> Mark> I'd use the word "obfuscation" instead of "cleanup".
> 
> It is awful but necessary.
> I think calls in gdb proper probably need this as well.
> 
> 
> I did try writing a patch to fix it a different way, without as many
> casts:
> 
> +static inline PTRACE_TYPE_RET
> +gdb_ptrace (int request, pid_t pid, PTRACE_TYPE_ARG3 addr, void *data)
> +{
> +  return ptrace (request, pid, addr, data);
> +}
> +
> +#undef ptrace
> +#define ptrace ERROR
> 
> 
> ... followed by using gdb_ptrace everywhere.
> 
> However you do still need casts at some call points.
> It's quite awful.
> 
> I can send this if anyone thinks it is better.

Yeah, the same occurred to me.  I didn't try it, but I guessed
you'd need casts anyway, given some ptrace calls take
pointers as extra arguments, while others take integers.
In the end, I just tucked in under the "oh well, it's not that
important" rug.  :-)  However, Marcus' patch is only following
the status quo (*), so I didn't bring that up.  Without seeing the
result it's hard to say which is better.

(*) - http://sourceware.org/ml/gdb-patches/2012-03/msg01072.html

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]