mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 02:23:58 +00:00
Ugliest commit ever, but passing all px tests on big endian
* My future self will fix that, doing baby steps here for now
This commit is contained in:
parent
26edf29b01
commit
fab3348d82
@ -1101,7 +1101,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
print ((col == 1)? "|": " ");
|
||||
}
|
||||
for (j = i; j < i + inc; j++) {
|
||||
if (j!=i && use_align && rowbytes == inc) {
|
||||
if (j != i && use_align && rowbytes == inc) {
|
||||
int sz = (p && p->offsize)? p->offsize (p->user, addr + j): -1;
|
||||
if (sz >= 0) {
|
||||
rowbytes = bytes;
|
||||
@ -1151,15 +1151,36 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
#if R_SYS_ENDIAN
|
||||
if (base == 32) {
|
||||
// only needed for big endian
|
||||
ut32 n32;
|
||||
ut32 n32 = 0;
|
||||
r_mem_swaporcopy ((ut8 *)&n32, buf + j, 4, be);
|
||||
if (sz_n == 2) {
|
||||
switch (sz_n) {
|
||||
case 1:
|
||||
n = n32 & 0xff;
|
||||
break;
|
||||
case 2:
|
||||
n = n32 & 0xffff;
|
||||
} else {
|
||||
break;
|
||||
case 4:
|
||||
n = n32;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
r_mem_swaporcopy ((ut8 *) &n, buf + j, sz_n, be);
|
||||
ut64 n64 = 0;
|
||||
r_mem_swaporcopy ((ut8 *) &n64, buf + j, 8, be);
|
||||
switch (sz_n) {
|
||||
case 1:
|
||||
n = n64 & 0xff;
|
||||
break;
|
||||
case 2:
|
||||
n = n64 & 0xffff;
|
||||
break;
|
||||
case 4:
|
||||
n = n64 & 0xffffffff;
|
||||
break;
|
||||
default:
|
||||
n = n64;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
r_mem_swaporcopy ((ut8 *) &n, buf + j, sz_n, be);
|
||||
@ -1278,26 +1299,23 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
} else {
|
||||
r_print_byte (p, addr + j, bytefmt, j, buf[j]);
|
||||
}
|
||||
bool mustspace = false;
|
||||
if (pairs && !compact && (inc & 1)) {
|
||||
bool mustspace = (rows % 2) ? !(j&1) : (j&1);
|
||||
if (mustspace) {
|
||||
print (" ");
|
||||
}
|
||||
mustspace = (rows % 2) ? !(j&1) : (j&1);
|
||||
} else if (bytes % 2 || !pairs) {
|
||||
if (col == 1) {
|
||||
if (j + 1 < inc + i) {
|
||||
if (!compact) {
|
||||
print (" ");
|
||||
}
|
||||
mustspace = !compact;
|
||||
} else {
|
||||
print ("|");
|
||||
}
|
||||
} else {
|
||||
if (!compact) {
|
||||
print (" ");
|
||||
}
|
||||
mustspace = !compact;
|
||||
}
|
||||
}
|
||||
if (mustspace) {
|
||||
print (" ");
|
||||
}
|
||||
}
|
||||
if (hl) {
|
||||
print (Color_RESET);
|
||||
|
@ -5,22 +5,26 @@ e asm.arch=x86
|
||||
e asm.bits=64
|
||||
woe 1 255
|
||||
s+11
|
||||
?e vuit
|
||||
b 8
|
||||
pxr8
|
||||
pxr4
|
||||
pxr2
|
||||
pxr1
|
||||
?e quatre
|
||||
b 4
|
||||
pxr8
|
||||
pxr4
|
||||
pxr2
|
||||
pxr1
|
||||
?e dos
|
||||
b 2
|
||||
pxr8
|
||||
pxr4
|
||||
pxr2
|
||||
pxr1
|
||||
pxr2
|
||||
?e u
|
||||
b 1
|
||||
pxr8
|
||||
pxr4
|
||||
@ -28,6 +32,7 @@ pxr2
|
||||
pxr1
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
vuit
|
||||
0x0000000b 0x0101010101010101 ........
|
||||
0x0000000b 0x01010101 .... 16843009
|
||||
0x0000000f 0x01010101 .... 16843009
|
||||
@ -44,6 +49,7 @@ EXPECT=<<EOF
|
||||
0x00000010 001 .
|
||||
0x00000011 001 .
|
||||
0x00000012 001 .
|
||||
quatre
|
||||
0x0000000b 0x0000000001010101 ....
|
||||
0x0000000b 0x01010101 .... 16843009
|
||||
0x0000000b 0101 .. 257 R W X 'add byte [rax], al'
|
||||
@ -53,6 +59,7 @@ EXPECT=<<EOF
|
||||
0x0000000c 001 .
|
||||
0x0000000d 001 .
|
||||
0x0000000e 001 .
|
||||
dos
|
||||
0x0000000b 0x0000000000000101 ..
|
||||
0x0000000b 0x00000101 ..
|
||||
0x0000000b 0101 .. 257 R W X 'add byte [rax], al'
|
||||
@ -60,6 +67,7 @@ EXPECT=<<EOF
|
||||
0x0000000b 001 .
|
||||
0x0000000c 001 .
|
||||
0x0000000b 0101 .. 257 R W X 'add byte [rax], al'
|
||||
u
|
||||
0x0000000b 0x0000000000000001 .
|
||||
0x0000000b 0x00000001 .
|
||||
0x0000000b 01 .
|
||||
|
Loading…
Reference in New Issue
Block a user