Remove all Sl commands ##refactoring (#11967)

This commit is contained in:
Maijin 2018-10-27 17:21:33 +02:00 committed by GitHub
parent 734c74932f
commit 2044e2b925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 43 deletions

View File

@ -218,7 +218,7 @@ static const char *help_msg_dm[] = {
"dmi.", "", "List closest symbol to the current address",
"dmiv", "", "Show address of given symbol for given lib",
"dmj", "", "List memmaps in JSON format",
"dml", " <file>", "Load contents of file into the current map region (see Sl)",
"dml", " <file>", "Load contents of file into the current map region",
"dmm", "[?][j*]", "List modules (libraries, binaries loaded in memory)",
"dmp", "[?] <address> <size> <perms>", "Change page at <address> with <size>, protection <perms> (perm)",
"dms", "[?] <id> <mapaddr>", "Take memory snapshot",

View File

@ -16,18 +16,11 @@ static const char *help_msg_S[] = {
"S-.","","remove section at core->offset (can be changed with @)",
"S=","","list sections (ascii-art bars) (io.va to display paddr or vaddr)",
"Sa","[-] [A] [B] [[off]]","Specify arch and bits for given section",
"Sl"," [file]","load contents of file into current section (see dml)",
NULL
};
static const char *help_msg_Sl[] = {
"Usage:", "Sl", "[file]",
NULL
};
static void cmd_section_init(RCore *core) {
DEFINE_CMD_DESCRIPTOR (core, S);
DEFINE_CMD_DESCRIPTOR (core, Sl);
}
#define PRINT_CURRENT_SEEK \
@ -217,40 +210,6 @@ static int cmd_section(void *data, const char *input) {
}
}
break;
case 'l': // "Sl"
{
ut64 o = core->offset;
SdbListIter *iter;
RIOSection *s;
if (input[1] != ' ') {
r_core_cmd_help (core, help_msg_Sl);
return false;
}
if (core->io->va || core->io->debug) {
s = r_io_section_vget (core->io, core->offset);
o = s ? core->offset - s->vaddr + s->paddr : core->offset;
}
ls_foreach (core->io->sections, iter, s) {
if (o >= s->paddr && o < s->paddr + s->size) {
int sz;
char *buf = r_file_slurp (input + 2, &sz);
// TODO: use mmap here. we need a portable implementation
if (!buf) {
eprintf ("Cannot allocate 0x%08"PFMT64x""
" bytes\n", s->size);
return false;
}
r_io_write_at (core->io, s->vaddr, (const ut8*)buf, sz);
eprintf ("Loaded %d byte(s) into the map region "
" at 0x%08"PFMT64x"\n", sz, s->vaddr);
free (buf);
return true;
}
}
eprintf ("No debug region found here\n");
return false;
}
break;
case '-': // "S-"
// remove all sections
if (input[1] == '*') {

View File

@ -810,7 +810,7 @@ static const char *radare_argv[] = {
"db ", "db-", "dbd", "dbe", "dbs", "dbte", "dbtd", "dbts",
"dp", "dr", "dcu", "dmd", "dmp", "dml",
"ec","ecs", "eco",
"S", "S.", "S*", "S-", "S=", "Sa", "Sa-", "Sd", "Sl", "SSj",
"S", "S.", "S*", "S-", "S=", "Sa", "Sa-", "Sd",
"s", "s+", "s++", "s-", "s--", "s*", "sa", "sb", "sr",
"!", "!!", "!!!", "!!!-",
"#sha1", "#crc32", "#pcprint", "#sha256", "#sha512", "#md4", "#md5",