Fix 'dr=' columns width for 64bit registers

This commit is contained in:
pancake 2013-10-31 01:53:17 +01:00
parent 403baf93e7
commit 629c64c851
4 changed files with 38 additions and 13 deletions

View File

@ -141,6 +141,7 @@ static int do_help(int line) {
" -b bsize specify the size of the block (instead of full file)\n"
" -B show per-block hash\n"
" -f from start hashing at given address\n"
" -i num repeat hash N iterations\n"
" -k show hash using the openssh's randomkey algorithm\n"
" -q run in quiet mode (only show results)\n"
" -L list all available algorithms (see -a)\n"

View File

@ -1124,7 +1124,7 @@ toro:
int delta = 0;
if (f) { delta = cc.jump-flag->offset; }
if (!strncmp (flag->name, ccstr, strlen (flag->name))) {
if (ccstr[strlen(flag->name)] == '(') {
if (ccstr[strlen (flag->name)] == '(') {
tmp[0] = 0;
} else {
if (delta)

View File

@ -46,7 +46,7 @@ R_API int r_debug_reg_list(RDebug *dbg, int type, int size, int rad) {
cols = 3;
} else {
fmt = "%s = 0x%08"PFMT64x"%s";
fmt2 = "%4s 0x%08"PFMT64x"%s";
fmt2 = "%5s 0x%08"PFMT64x"%s";
cols = 4;
}
if (rad=='j')
@ -86,16 +86,37 @@ R_API int r_debug_reg_list(RDebug *dbg, int type, int size, int rad) {
break;
case 'd':
case 2:
if (delta) // TODO: DO NOT COLORIZE ALWAYS ..do debug knows about console?? use inverse colors
dbg->printf (Color_BWHITE); //INVERT); //Color_BWHITE);
if (item->flags) {
char *str = r_reg_get_bvalue (dbg->reg, item);
dbg->printf ("%s = %s%s", item->name, str, ((n+1)%cols)?" ":"\n");
free (str);
} else dbg->printf (fmt2, item->name, value, ((n+1)%cols)?" ":"\n");
if (delta) // TODO: use inverse colors
//dbg->printf (Color_INVERT_RESET); //Color_RESET);
dbg->printf (Color_RESET); //Color_RESET);
{
char whites[16];
strcpy (whites, " ");
if (delta) // TODO: DO NOT COLORIZE ALWAYS ..do debug knows about console?? use inverse colors
dbg->printf (Color_BWHITE); //INVERT); //Color_BWHITE);
if (item->flags) {
char *str = r_reg_get_bvalue (dbg->reg, item);
//int len = strlen (str);
dbg->printf ("%s = %s%s", item->name,
str, ((n+1)%cols)? whites: "\n");
free (str);
} else {
char content[128];
int len;
snprintf (content, sizeof (content), "0x%"PFMT64x, value);
len = strlen (content);
if (len>10) {
len -= 10;
if (len>8)len=8;
else len = 8-len;
whites[len] = 0;
}
dbg->printf (fmt2, item->name, value,
((n+1)%cols)? whites:"\n");
}
if (delta) // TODO: only in color mode ON
dbg->printf (Color_RESET);
}
break;
case 3:
if (delta) {

View File

@ -100,8 +100,11 @@ static void open_pidmem (RIOPtrace *iop) {
char pidmem[32];
snprintf (pidmem, sizeof (pidmem), "/proc/%d/mem", iop->pid);
iop->fd = open (pidmem, O_RDWR);
#if 0
if (iop->fd == -1)
eprintf ("Cannot use /proc/%d/mem. Fallback to ptrace io.\n", iop->fd);
eprintf ("Warning: Cannot open /proc/%d/mem. "
"Fallback to ptrace io.\n", iop->pid);
#endif
}
static void close_pidmem(RIOPtrace *iop) {