Back to index

glibc  2.9
Defines | Functions
register-dump.h File Reference
#include <sys/uio.h>
#include <stdio-common/_itoa.h>

Go to the source code of this file.

Defines

#define ADD_STRING(str)
#define ADD_MEM(str, len)
#define REGISTER_DUMP   register_dump (fd, ctx)

Functions

static void hexvalue (unsigned long int value, char *buf, size_t len)
static void register_dump (int fd, struct sigcontext *ctx)

Define Documentation

#define ADD_MEM (   str,
  len 
)
Value:
iov[nr].iov_base = str;                                              \
  iov[nr].iov_len = len;                                             \
  ++nr
#define ADD_STRING (   str)
Value:
iov[nr].iov_base = (char *) str;                                     \
  iov[nr].iov_len = strlen (str);                                    \
  ++nr
#define REGISTER_DUMP   register_dump (fd, ctx)

Definition at line 130 of file register-dump.h.


Function Documentation

static void hexvalue ( unsigned long int  value,
char *  buf,
size_t  len 
) [static]

Definition at line 41 of file register-dump.h.

{
  char *cp = _itoa_word (value, buf + len, 16, 0);
  while (cp > buf)
    *--cp = '0';
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void register_dump ( int  fd,
struct sigcontext ctx 
) [static]

Definition at line 49 of file register-dump.h.

{
  char regs[19][8];
  struct iovec iov[40];
  size_t nr = 0;

#define ADD_STRING(str) \
  iov[nr].iov_base = (char *) str;                                   \
  iov[nr].iov_len = strlen (str);                                    \
  ++nr
#define ADD_MEM(str, len) \
  iov[nr].iov_base = str;                                            \
  iov[nr].iov_len = len;                                             \
  ++nr

  /* Generate strings of register contents.  */
  hexvalue (ctx->sregs->regs.gprs[0], regs[0], 8);
  hexvalue (ctx->sregs->regs.gprs[1], regs[1], 8);
  hexvalue (ctx->sregs->regs.gprs[2], regs[2], 8);
  hexvalue (ctx->sregs->regs.gprs[3], regs[3], 8);
  hexvalue (ctx->sregs->regs.gprs[4], regs[4], 8);
  hexvalue (ctx->sregs->regs.gprs[5], regs[5], 8);
  hexvalue (ctx->sregs->regs.gprs[6], regs[6], 8);
  hexvalue (ctx->sregs->regs.gprs[7], regs[7], 8);
  hexvalue (ctx->sregs->regs.gprs[8], regs[8], 8);
  hexvalue (ctx->sregs->regs.gprs[9], regs[9], 8);
  hexvalue (ctx->sregs->regs.gprs[10], regs[10], 8);
  hexvalue (ctx->sregs->regs.gprs[11], regs[11], 8);
  hexvalue (ctx->sregs->regs.gprs[12], regs[12], 8);
  hexvalue (ctx->sregs->regs.gprs[13], regs[13], 8);
  hexvalue (ctx->sregs->regs.gprs[14], regs[14], 8);
  hexvalue (ctx->sregs->regs.gprs[15], regs[15], 8);
  hexvalue (ctx->sregs->regs.psw.mask, regs[16], 8);
  hexvalue (ctx->sregs->regs.psw.addr, regs[17], 8);

  /* Generate the output.  */
  ADD_STRING ("Register dump:\n\n GPR0: ");
  ADD_MEM (regs[0], 8);
  ADD_STRING ("  GPR1: ");
  ADD_MEM (regs[1], 8);
  ADD_STRING ("  GPR2: ");
  ADD_MEM (regs[2], 8);
  ADD_STRING ("  GPR3: ");
  ADD_MEM (regs[3], 8);
  ADD_STRING ("\n GPR4: ");
  ADD_MEM (regs[4], 8);
  ADD_STRING ("  GPR5: ");
  ADD_MEM (regs[5], 8);
  ADD_STRING ("  GPR6: ");
  ADD_MEM (regs[6], 8);
  ADD_STRING ("  GPR7: ");
  ADD_MEM (regs[7], 8);
  ADD_STRING ("\n GPR8: ");
  ADD_MEM (regs[8], 8);
  ADD_STRING ("  GPR9: ");
  ADD_MEM (regs[9], 8);
  ADD_STRING ("  GPRA: ");
  ADD_MEM (regs[10], 8);
  ADD_STRING ("  GPRB: ");
  ADD_MEM (regs[11], 8);
  ADD_STRING ("\n GPRC: ");
  ADD_MEM (regs[12], 8);
  ADD_STRING ("  GPRD: ");
  ADD_MEM (regs[13], 8);
  ADD_STRING ("  GPRE: ");
  ADD_MEM (regs[14], 8);
  ADD_STRING ("  GPRF: ");
  ADD_MEM (regs[15], 8);
  ADD_STRING ("\n\n PSW.MASK: ");
  ADD_MEM (regs[16], 8);
  ADD_STRING ("  PSW.ADDR: ");
  ADD_MEM (regs[17], 8);
  ADD_STRING ("  TRAP: ");
  ADD_MEM (regs[18], 4);
  ADD_STRING ("\n");

  /* Write the stuff out.  */
  writev (fd, iov, nr);
}

Here is the call graph for this function: