]> granicus.if.org Git - strace/commitdiff
2005-02-02 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 2 Feb 2005 20:55:23 +0000 (20:55 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 2 Feb 2005 20:55:23 +0000 (20:55 +0000)
* util.c (printcall): Print 16 ?s when long is 8 bytes.
Fixes RH#146932.

util.c

diff --git a/util.c b/util.c
index ee03338ad05b7327395a720f2838f8b5c865914c..31e56cab22d164db6fec9260aa03e4a3a6841bbd 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1040,13 +1040,16 @@ void
 printcall(tcp)
 struct tcb *tcp;
 {
+#define PRINTBADPC tprintf(sizeof(long) == 4 ? "[????????] " : \
+                          sizeof(long) == 8 ? "[????????????????] " : \
+                          NULL /* crash */)
 
 #ifdef LINUX
 #ifdef I386
        long eip;
 
        if (upeek(tcp->pid, 4*EIP, &eip) < 0) {
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%08lx] ", eip);
@@ -1054,7 +1057,7 @@ struct tcb *tcp;
 #elif defined(S390) || defined(S390X)
          long psw;
          if(upeek(tcp->pid,PT_PSWADDR,&psw) < 0) {
-                 tprintf("[????????] ");
+                 PRINTBADPC;
                  return;
          }
 #ifdef S390
@@ -1067,7 +1070,7 @@ struct tcb *tcp;
        long rip;
 
        if (upeek(tcp->pid, 8*RIP, &rip) < 0) {
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%16lx] ", rip);
@@ -1075,7 +1078,7 @@ struct tcb *tcp;
        long ip;
 
        if (upeek(tcp->pid, PT_B0, &ip) < 0) {
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%08lx] ", ip);
@@ -1099,14 +1102,14 @@ struct tcb *tcp;
        long pc;
 
        if (upeek(tcp->pid, REG_PC, &pc) < 0) {
-               tprintf ("[????????] ");
+               tprintf ("[????????????????] ");
                return;
        }
        tprintf("[%08lx] ", pc);
 #elif defined(SPARC) || defined(SPARC64)
        struct regs regs;
        if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)&regs,0) < 0) {
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%08lx] ", regs.r_pc);
@@ -1138,7 +1141,7 @@ struct tcb *tcp;
        long pc;
 
        if (upeek(tcp->pid, REG_PC, &pc) < 0) {
-               tprintf ("[????????] ");
+               tprintf ("[????????????????] ");
                return;
        }
        tprintf("[%08lx] ", pc);
@@ -1146,7 +1149,7 @@ struct tcb *tcp;
        long pc;
 
        if (upeek(tcp->pid, 4*15, &pc) < 0) {
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%08lx] ", pc);
@@ -1158,7 +1161,7 @@ struct tcb *tcp;
 
        if (ptrace(PTRACE_GETREGS, tcp->pid, (char *) &regs, 0) < 0) {
                perror("printcall: ptrace(PTRACE_GETREGS, ...)");
-               tprintf("[????????] ");
+               PRINTBADPC;
                return;
        }
        tprintf("[%08x] ", regs.r_o7);
@@ -1166,7 +1169,7 @@ struct tcb *tcp;
 
 #ifdef SVR4
        /* XXX */
-       tprintf("[????????] ");
+       PRINTBADPC;
 #endif
 
 #ifdef FREEBSD