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 105 of file register-dump.h.


Function Documentation

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

Definition at line 36 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 44 of file register-dump.h.

{
  char regs[38][8];
  struct iovec iov[38 * 2 + 10];
  size_t nr = 0;
  int i;

#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.  */
  for (i = 0; i < 32; i++)
    hexvalue (ctx->sc_regs[i], regs[i], 8);
  hexvalue (ctx->sc_pc, regs[32], 8);
  hexvalue (ctx->sc_mdhi, regs[33], 8);
  hexvalue (ctx->sc_mdlo, regs[34], 8);

  /* Generate the output.  */
  ADD_STRING ("Register dump:\n\n R0   ");
  for (i = 0; i < 8; i++)
    {
      ADD_MEM (regs[i], 8);
      ADD_STRING (" ");
    }
  ADD_STRING ("\n R8   ");
  for (i = 8; i < 16; i++)
    {
      ADD_MEM (regs[i], 8);
      ADD_STRING (" ");
    }
  ADD_STRING ("\n R16  ");
  for (i = 16; i < 24; i++)
    {
      ADD_MEM (regs[i], 8);
      ADD_STRING (" ");
    }
  ADD_STRING ("\n R24  ");
  for (i = 24; i < 32; i++)
    {
      ADD_MEM (regs[i], 8);
      ADD_STRING (" ");
    }
  ADD_STRING ("\n            pc       lo       hi\n      ");
  for (i = 32; i < 35; i++)
    {
      ADD_MEM (regs[i], 8);
      ADD_STRING (" ");
    }
  ADD_STRING ("\n");

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

Here is the call graph for this function: