Back to index

glibc  2.9
Defines | Functions | Variables
register-dump.h File Reference
#include <stddef.h>
#include <string.h>

Go to the source code of this file.

Defines

#define NREGS   (32+32+3)
#define O(FIELD, LF)   offsetof(struct sigcontext, FIELD) + LF
#define REGISTER_DUMP   register_dump (fd, ctx)

Functions

static const char __attribute__ ((aligned(8))) regnames[NREGS][8]
static void register_dump (int fd, struct sigcontext *ctx)

Variables

static const int offsets [NREGS]

Define Documentation

#define NREGS   (32+32+3)

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

#define O (   FIELD,
  LF 
)    offsetof(struct sigcontext, FIELD) + LF

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

#define REGISTER_DUMP   register_dump (fd, ctx)

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


Function Documentation

static const char __attribute__ ( (aligned(8))  ) [static]
static void register_dump ( int  fd,
struct sigcontext ctx 
) [static]

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

{
  char buf[NREGS*(8+16) + 25 + 80];
  char *p = buf;
  size_t i;
  
  p = stpcpy (p, "Register dump:\n\n");

  for (i = 0; i < NREGS; ++i)
    {
      int this_offset, this_lf;
      unsigned long val;
      signed long j;
      
      this_offset = offsets[i];
      this_lf = this_offset & 7;

      val = *(unsigned long *)(((size_t)ctx + this_offset) & -8);

      memcpy (p, regnames[i], 8);
      p += 8;

      for (j = 60; j >= 0; j -= 4)
       {
         unsigned long x = (val >> j) & 15;
         x += x < 10 ? '0' : 'a' - 10;
         *p++ = x;
       }

      if (this_lf > 0)
       {
         if (this_lf > 1)
           *p++ = '\n';
         *p++ = '\n';
       }
    }

  write (fd, buf, p - buf);
}

Here is the call graph for this function:


Variable Documentation

const int offsets[NREGS] [static]
Initial value:
 
{
  O(sc_regs[0], 0),  O(sc_regs[1], 0),  O(sc_regs[2], 1),
  O(sc_regs[3], 0),  O(sc_regs[4], 0),  O(sc_regs[5], 1),
  O(sc_regs[6], 0),  O(sc_regs[7], 0),  O(sc_regs[8], 1),
  O(sc_regs[9], 0),  O(sc_regs[10], 0), O(sc_regs[11], 1),
  O(sc_regs[12], 0), O(sc_regs[13], 0), O(sc_regs[14], 1),
  O(sc_regs[15], 0), O(sc_regs[16], 0), O(sc_regs[17], 1),
  O(sc_regs[18], 0), O(sc_regs[19], 0), O(sc_regs[20], 1),
  O(sc_regs[21], 0), O(sc_regs[22], 0), O(sc_regs[23], 1),
  O(sc_regs[24], 0), O(sc_regs[25], 0), O(sc_regs[26], 1),
  O(sc_regs[27], 0), O(sc_regs[28], 0), O(sc_regs[29], 1),
  O(sc_regs[30], 0), O(sc_pc, 2),

  O(sc_fpregs[0], 0),  O(sc_fpregs[1], 0),  O(sc_fpregs[2], 1),
  O(sc_fpregs[3], 0),  O(sc_fpregs[4], 0),  O(sc_fpregs[5], 1),
  O(sc_fpregs[6], 0),  O(sc_fpregs[7], 0),  O(sc_fpregs[8], 1),
  O(sc_fpregs[9], 0),  O(sc_fpregs[10], 0), O(sc_fpregs[11], 1),
  O(sc_fpregs[12], 0), O(sc_fpregs[13], 0), O(sc_fpregs[14], 1),
  O(sc_fpregs[15], 0), O(sc_fpregs[16], 0), O(sc_fpregs[17], 1),
  O(sc_fpregs[18], 0), O(sc_fpregs[19], 0), O(sc_fpregs[20], 1),
  O(sc_fpregs[21], 0), O(sc_fpregs[22], 0), O(sc_fpregs[23], 1),
  O(sc_fpregs[24], 0), O(sc_fpregs[25], 0), O(sc_fpregs[26], 1),
  O(sc_fpregs[27], 0), O(sc_fpregs[28], 0), O(sc_fpregs[29], 1),
  O(sc_fpregs[30], 0), O(sc_fpcr, 2),

  O(sc_traparg_a0, 0),  O(sc_traparg_a1, 0),  O(sc_traparg_a2, 1)
}

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