This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA/RFC] Replace call_ptrace and ptrace_wait in inf-ptrace.c



Either way we'll end up with casts:
CORE_ADDR -> (void *)
(void *) -> long
etc, why not have methods that at least avoid the casts (or do it locally to GDB's ptrace code?).


The problem here is that the third argument of ptrace is used for two
purposes:

1. For specifying memory addresses of objects in the debugger's
   address space (PT_GETREGS, PT_SETREGS, PT_IO).

2. For specifying memory addresses in the inferior.

This gets especially complicated with 32x64 "native" cross-debugging
and is further complicated by the fact that some systems use an
integer type and other systems use a pointer type for this third
arguments.

Right, no matter what a single function is, casing is required.


I've tried to come up with a function signature for
gdb_ptrace() that would work for all targets, and I failed.

With two ptrace functions, one with void* (for host buffer) and one with CORE_ADDR (for target address), this problem would be solved.


Andrew



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