mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-06 13:29:46 +00:00
Fix #3898 - Persistent section name in project files
This commit is contained in:
parent
6f346b6d6d
commit
a93ecf2b69
@ -320,6 +320,8 @@ R_API int r_core_project_save(RCore *core, const char *file) {
|
||||
sdb_file (core->anal->sdb_xrefs, buf);
|
||||
sdb_sync (core->anal->sdb_xrefs);
|
||||
}
|
||||
r_core_cmd (core, "S*", 0);
|
||||
r_cons_flush ();
|
||||
r_core_cmd (core, "fV*", 0);
|
||||
r_cons_flush ();
|
||||
r_core_cmd (core, "ax*", 0);
|
||||
|
@ -30,6 +30,23 @@ R_API RIOSection *r_io_section_get_name(RIO *io, const char *name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static RIOSection *findMatching (RIO *io, ut64 paddr, ut64 vaddr, ut64 size, ut64 vsize, int rwx, const char *name) {
|
||||
RListIter *iter;
|
||||
RIOSection *s;
|
||||
r_list_foreach (io->sections, iter, s) {
|
||||
if (s->offset != paddr) continue;
|
||||
if (s->vaddr != vaddr) continue;
|
||||
s->size = size;
|
||||
s->vsize = vsize;
|
||||
s->rwx = rwx;
|
||||
if (name && strcmp (name, s->name)) {
|
||||
strcpy (s->name, name); /// XXX overflow here
|
||||
}
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API RIOSection *r_io_section_add(RIO *io, ut64 offset, ut64 vaddr, ut64 size, ut64 vsize, int rwx, const char *name, ut32 bin_id, int fd) {
|
||||
int update = 0;
|
||||
RIOSection *s;
|
||||
@ -39,6 +56,10 @@ R_API RIOSection *r_io_section_add(RIO *io, ut64 offset, ut64 vaddr, ut64 size,
|
||||
size, name, vaddr);
|
||||
return NULL;
|
||||
}
|
||||
s = findMatching (io, offset, vaddr, size, vsize, rwx, name);
|
||||
if (s) {
|
||||
return s;
|
||||
}
|
||||
s = r_io_section_get_name (io, name);
|
||||
if (s == NULL) {
|
||||
s = R_NEW (RIOSection);
|
||||
|
Loading…
x
Reference in New Issue
Block a user