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?
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");
}
}