Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WTF, gdb?

Name: Anonymous 2012-08-18 19:35

Why the fuck is it so absolutely convoluted just to get it to display a standard 16 byte + ASCII hexdump of what's in memory at a particular address, unlike almost every other debugger out there?

Name: Anonymous 2012-08-20 23:00

>>29

typedef unsigned char u1;
#define times(i,e) for(i=0; i<(e); i++)
static void hd(u1 *P, int S) {
  int X, Y, I;
  times(Y, (S+15)/16) {
    printf("%04X |", Y*16);
    times(X, 16) {
      I = Y*16 + X;
      if ((I&0xf) == 8) printf(" ");
      if (I<S) printf(" %02X", P[I]);
      else printf("   ");
    }
    printf(" |");
    times(X, 16) {
      I = Y*16 + X;
      if (I<S && isprint(P[I]) && P[I]!='\n' && P[I]!='\t') printf("%c", P[I]);
      else printf(" ");
    }
    printf("\n");
  }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List