mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-24 00:03:00 +00:00
* Apply edu's project patch
- CC now ask for size, like the rest of r_meta_add commands - Project tracks meta, xrefs and sections information and actual offset - Visual add comment patched to use new r_meta_add comment with size - Documented C* in r_meta help.
This commit is contained in:
parent
df9cc8983c
commit
984b5c4d16
@ -310,9 +310,9 @@ struct r_range_t *r_meta_ranges(RMeta *m)
|
||||
|
||||
static void printmetaitem(RMeta *m, RMetaItem *d) {
|
||||
char *str = r_str_unscape (d->str);
|
||||
m->printf ("%s 0x%08"PFMT64x" 0x%08"PFMT64x" %d \"%s\"\n",
|
||||
m->printf ("%s %d \"%s\" @ 0x%08"PFMT64x"\n",
|
||||
r_meta_type_to_string (d->type),
|
||||
d->from, d->to, (int)(d->to-d->from), str);
|
||||
(int)(d->to-d->from), str, d->from);
|
||||
free (str);
|
||||
}
|
||||
|
||||
|
@ -981,7 +981,7 @@ static int cmd_section(void *data, const char *input) {
|
||||
case '?':
|
||||
r_cons_printf (
|
||||
" S ; list sections\n"
|
||||
" S* ; list sections (in radare commands\n"
|
||||
" S* ; list sections (in radare commands)\n"
|
||||
" S= ; list sections (in nice ascii-art bars)\n"
|
||||
" S [offset] [vaddr] [size] [vsize] [name] [rwx] ; adds new section\n"
|
||||
" S -[offset] ; remove this section definition\n");
|
||||
@ -2861,18 +2861,10 @@ static int cmd_meta(void *data, const char *input) {
|
||||
}
|
||||
} else eprintf ("Cannot find meta information at 0x%08"PFMT64x"\n", core->offset);
|
||||
break;
|
||||
case 'C': /* add comment */
|
||||
// TODO: do we need to get the size? or the offset?
|
||||
// TODO: is this an exception compared to other C? commands?
|
||||
if (input[1]==' ') input++;
|
||||
if (input[1]=='-')
|
||||
r_meta_del (core->meta, R_META_COMMENT, core->offset, core->offset, input+2);
|
||||
else if (input[1])
|
||||
r_meta_add (core->meta, R_META_COMMENT, core->offset, core->offset, input+1);
|
||||
break;
|
||||
case '!':
|
||||
r_meta_sync (core->meta);
|
||||
break;
|
||||
case 'C':
|
||||
case 'S':
|
||||
case 's':
|
||||
case 'd': /* data */
|
||||
@ -2937,6 +2929,7 @@ static int cmd_meta(void *data, const char *input) {
|
||||
eprintf (
|
||||
"Usage: C[-LCsSmxX?] [...]\n"
|
||||
" C! # sync xrefs with (to be deprecated)\n"
|
||||
" C* # List meta and xref info in r2 commands\n"
|
||||
" C-[@][ addr] # delete metadata at given address\n"
|
||||
" CL[-] [addr] # show 'code line' information (bininfo)\n"
|
||||
" CC [string] # add comment\n"
|
||||
|
@ -86,6 +86,15 @@ R_API int r_core_project_save(RCore *core, const char *file) {
|
||||
// TODO: r_str_writef (fd, "e asm.arch=%s", r_config_get ("asm.arch"));
|
||||
r_config_list (core->config, NULL, R_TRUE);
|
||||
r_cons_flush ();
|
||||
r_str_write (fd, "# sections\n");
|
||||
r_io_section_list (core->io, core->offset, 1);
|
||||
r_cons_flush ();
|
||||
r_str_write (fd, "# meta\n");
|
||||
r_meta_list (core->meta, R_META_ANY);
|
||||
r_cons_flush ();
|
||||
r_str_write (fd, "# seek\n");
|
||||
r_str_writef (fd, "s 0x%08"PFMT64x, core->offset);
|
||||
r_cons_flush ();
|
||||
r_cons_singleton ()->fdout = 1;
|
||||
close (fd);
|
||||
} else {
|
||||
|
@ -928,8 +928,8 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
r_cons_printf ("Enter a comment: (prefix it with '-' to remove)\n");
|
||||
r_cons_flush ();
|
||||
r_cons_set_raw (0);
|
||||
strcpy (buf, "CC ");
|
||||
if (r_cons_fgets (buf+3, 1000, 0, NULL) <0)
|
||||
strcpy (buf, "CC 0 ");
|
||||
if (r_cons_fgets (buf+5, 1000, 0, NULL) <0)
|
||||
buf[0]='\0';
|
||||
if (buf[0]) {
|
||||
if (curset) r_core_seek (core, core->offset + cursor, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user