[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 17/17] ptrace: add more Debug to access_reg
From: |
Cody P Schafer |
Subject: |
[Libunwind-devel] [PATCH 17/17] ptrace: add more Debug to access_reg |
Date: |
Fri, 14 Sep 2012 17:12:02 -0700 |
This was useful in debugging issues with the libunwind-ptrace code on
ppc64.
---
src/ptrace/_UPT_access_reg.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/src/ptrace/_UPT_access_reg.c b/src/ptrace/_UPT_access_reg.c
index 99949b2..910f0f7 100644
--- a/src/ptrace/_UPT_access_reg.c
+++ b/src/ptrace/_UPT_access_reg.c
@@ -43,6 +43,10 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
unw_word_t *val,
pid_t pid = ui->pid;
#if UNW_DEBUG
+ Debug(16, "using pokeuser: reg: %s [%u], val: %lx, write: %d\n",
unw_regname(reg), (unsigned) reg, (long) val, write);
+#endif
+
+#if UNW_DEBUG
if (write)
Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val);
#endif
@@ -221,10 +225,13 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
unw_word_t *val,
}
break;
}
-#endif
+#endif /* End of IA64 */
if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0]))
{
+#if UNW_DEBUG
+ Debug(2, "register out of range: >= %zu / %zu\n",
sizeof(_UPT_reg_offset), sizeof(_UPT_reg_offset[0]));
+#endif
errno = EINVAL;
goto badreg;
}
@@ -235,10 +242,19 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
unw_word_t *val,
errno = 0;
if (write)
ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg], *val);
- else
+ else {
+#if UNW_DEBUG
+ Debug(16, "ptrace PEEKUSER pid: %lu , reg: %lu , offs: %lu\n", (unsigned
long)pid, (unsigned long)reg,
+ (unsigned long)_UPT_reg_offset[reg]);
+#endif
*val = ptrace (PTRACE_PEEKUSER, pid, _UPT_reg_offset[reg], 0);
- if (errno)
+ }
+ if (errno) {
+#if UNW_DEBUG
+ Debug(2, "ptrace failure\n");
+#endif
goto badreg;
+ }
#endif
#ifdef UNW_TARGET_IA64
@@ -246,7 +262,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
unw_word_t *val,
#endif
#if UNW_DEBUG
if (!write)
- Debug (16, "%s -> %lx\n", unw_regname (reg), (long) *val);
+ Debug (16, "%s[%u] -> %lx\n", unw_regname (reg), (unsigned) reg, (long)
*val);
#endif
return 0;
@@ -265,8 +281,12 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
unw_word_t *val,
char *r;
#if UNW_DEBUG
+ Debug(16, "using getregs: reg: %s [%u], val: %lx, write: %u\n",
unw_regname(reg), (unsigned) reg, (long) val, write);
+#endif
+
+#if UNW_DEBUG
if (write)
- Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val);
+ Debug (16, "%s [%u] <- %lx\n", unw_regname (reg), (unsigned) reg, (long)
*val);
#endif
if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0]))
{
--
1.7.11.3
- [Libunwind-devel] [PATCH 05/17] build: make libunwind-coredump build optional, (continued)
- [Libunwind-devel] [PATCH 05/17] build: make libunwind-coredump build optional, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 04/17] ppc32: ppc64: test altivec support by running the compiler., Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 06/17] configure: use AS_HELP_STRING for configure args instead of manual formating, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 07/17] ppc64: remove tests/ppc64-test-wchar, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 08/17] configure: avoid using a shell function in autoconf, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 16/17] ptrace: check for NULL arg., Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 14/17] configure: rename configure.in to configure.ac, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 11/17] UPT: Add reg offsets for ppc32/64, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 12/17] ppc64: be explicit in access_reg range check, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 17/17] ptrace: add more Debug to access_reg,
Cody P Schafer <=
- [Libunwind-devel] [PATCH 13/17] ppc64: add FRAME_POINTER & NIP to regname., Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 15/17] ptrace/access_reg: print out register name on "bad register", Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 10/17] configure: use AC_ARG_ENABLE(arg, text, , custom-act), Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 03/17] ppc32: add UNUSED attribute to dmy_ctxt, Cody P Schafer, 2012/09/14
- [Libunwind-devel] [PATCH 09/17] configure: use AC_ARG_ENABLE's defaults when possible, Cody P Schafer, 2012/09/14