2
* Copyright (C) 2006, 2007, 2008
2
* Copyright (C) 2006, 2007, 2008, 2009
3
3
* pancake <youterm.com>
5
5
* radare is free software; you can redistribute it and/or modify
69
69
" fortune ; show fortune message! :D\n"
70
70
" ff [addr] ; flag from this address\n"
71
71
" fb [addr] ; increment flag offset with new base address\n"
72
" fd ; print flag delta offset\n"
72
" fd @ addr ; print flag delta offset\n"
73
73
" fc cmd ; set command to be executed on flag at current seek\n"
74
74
" fi pfx1 pfx2 ; flag interpolation between hit0_ and hit1_ for.example\n"
75
75
" fg text[*] ; grep for flag or all flags matching text* (like f | grep foo)\n"
453
* idx = -2 : single ref with delta
453
454
* idx = -1 : return all flags at given seek separated by comma
454
455
* idx = 0 : just return the first one found
455
456
* idx = 1 : continue searching for flag after the first one
457
458
int string_flag_offset(char *buf, u64 seek, int idx)
459
int delta = (int)config_get_i("cfg.delta");
460
461
flag_t *ref = NULL;
461
462
struct list_head *pos;
466
#warning TODO: Implement delta
468
if ((flag->offset >= seek && flag->offset <= seek+128)) {
469
//|| (flag->offset >= seek && flag->offset <= seek+config.vaddr)) {
473
strcat(buf, flag->name);
474
snprintf(buf2, 32, "+0x%llx", flag->offset-seek);
465
481
list_for_each(pos, &flags) {
466
482
if (config.interrupted) break;
467
483
flag_t *flag = (flag_t *)list_entry(pos, flag_t, list);
468
if (flag->offset == seek) {
484
if (flag->offset == seek || flag->offset == seek+config.vaddr) {
472
488
strcat(buf, ",");
473
strcat(buf, ref->name);
489
strcat(buf, flag->name);
479
if (flag->offset <= seek && (!ref || flag->offset > ref->offset))
495
if (flag->offset <= seek+config.vaddr && (!ref || flag->offset > ref->offset)) {
505
snprintf(buf2, 32, "%s+0x%llx", ref->name, (seek+config.vaddr)-ref->offset);
511
delta = (int)config_get_i("cfg.delta");
486
513
long ul = (seek-ref->offset);
499
526
void print_flag_offset(u64 seek)
503
if ( string_flag_offset(buf, seek, -1) )
529
if ( string_flag_offset(buf, seek, -2) )
504
530
cons_strcat(buf);