diff --git a/configure.in b/configure.in index cbf581ce..e5d4ac28 100644 --- a/configure.in +++ b/configure.in @@ -59,6 +59,20 @@ AC_CHECK_DECLS(PTRACE_POKEUSER, [], [], #endif #include ]) +AC_CHECK_DECLS(PTRACE_POKEDATA, [], [], +[$ac_includes_default +#if HAVE_SYS_TYPES_H +#include +#endif +#include +]) +AC_CHECK_DECLS(PT_IO, [], [], +[$ac_includes_default +#if HAVE_SYS_TYPES_H +#include +#endif +#include +]) AC_CHECK_DECLS(PT_GETFPREGS, [], [], [$ac_includes_default #if HAVE_SYS_TYPES_H diff --git a/src/ptrace/_UPT_access_mem.c b/src/ptrace/_UPT_access_mem.c index 6900c19d..8c36387b 100644 --- a/src/ptrace/_UPT_access_mem.c +++ b/src/ptrace/_UPT_access_mem.c @@ -25,6 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "_UPT_internal.h" +#if HAVE_DECL_PTRACE_POKEDATA || HAVE_TTRACE int _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, void *arg) @@ -57,3 +58,27 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, } return 0; } +#elif HAVE_DECL_PT_IO +int +_UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + struct ptrace_io_desc iod; + + iod.piod_offs = (void *)addr; + iod.piod_addr = val; + iod.piod_len = sizeof(*val); + iod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D; + if (write) + Debug (16, "mem[%lx] <- %lx\n", (long) addr, (long) *val); + if (ptrace(PT_IO, pid, (caddr_t)&iod, 0) == -1) + return -UNW_EINVAL; + if (!write) + Debug (16, "mem[%lx] -> %lx\n", (long) addr, (long) *val); + return 0; +} +#else +#error Fix me +#endif