Don't assume that pointers are 4 bytes or sizeof(int) in size. This fixes
the indirection operator ('*') and address examination ('x/a') on big-endian platoforms for which the above is not true, as well as on little-endian platforms if the cut-off bits are not 0.
This commit is contained in:
parent
e17570ea7d
commit
b6591e77a0
@ -83,26 +83,22 @@ db_examine(addr, fmt, count)
|
||||
while (--count >= 0) {
|
||||
fp = fmt;
|
||||
size = 4;
|
||||
width = 16;
|
||||
while ((c = *fp++) != 0) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
size = 1;
|
||||
width = 4;
|
||||
break;
|
||||
case 'h':
|
||||
size = 2;
|
||||
width = 8;
|
||||
break;
|
||||
case 'l':
|
||||
size = 4;
|
||||
width = 16;
|
||||
break;
|
||||
case 'g':
|
||||
size = 8;
|
||||
width = 32;
|
||||
break;
|
||||
case 'a': /* address */
|
||||
size = sizeof(void *);
|
||||
/* always forces a new line */
|
||||
if (db_print_position() != 0)
|
||||
db_printf("\n");
|
||||
@ -118,6 +114,7 @@ db_examine(addr, fmt, count)
|
||||
db_prev = addr;
|
||||
}
|
||||
|
||||
width = size * 4;
|
||||
switch (c) {
|
||||
case 'r': /* signed, current radix */
|
||||
value = db_get_value(addr, size, TRUE);
|
||||
|
@ -119,7 +119,7 @@ db_unary(valuep)
|
||||
db_error("Syntax error\n");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
*valuep = db_get_value((db_addr_t)*valuep, sizeof(int), FALSE);
|
||||
*valuep = db_get_value((db_addr_t)*valuep, sizeof(void *), FALSE);
|
||||
return (TRUE);
|
||||
}
|
||||
db_unread_token(t);
|
||||
|
Loading…
x
Reference in New Issue
Block a user