* Fix segfault in stepover in non-debugger mode
* Check if file exists before launching rabin to avoid noisy messages * Disable io.va when using the debugger * io.va is now enabled by default (static-analysis-friendly)
This commit is contained in:
parent
790491a707
commit
5748a66278
20
TODO
20
TODO
|
@ -54,6 +54,26 @@ Features:
|
|||
|
||||
---8<------------8<------------------8<---------------------8<------------- -- - -
|
||||
|
||||
Transactions
|
||||
============
|
||||
Loading big binaries results on broken interaction.
|
||||
- Optimize bottlenecks
|
||||
- Index flags by name and offset
|
||||
- Dont walk all the entries all the time
|
||||
- Use RDB or RHashMap
|
||||
- Transactions and threads
|
||||
- BIGLOCK is enought i think
|
||||
- A background thread can load rabin info
|
||||
- r_th is required
|
||||
- We need a way to get 'status' info from thread (msg passing?)
|
||||
- r_th_msg
|
||||
- We can lock the loading thread when a shell command is going to be executed
|
||||
|
|
||||
|--- (while (prompt,lock,run,unlock))
|
||||
\
|
||||
`-- (while (lock,load,unlock))
|
||||
|
||||
|
||||
Analysis
|
||||
========
|
||||
* Implement more get_main() (NOOB)
|
||||
|
|
|
@ -41,9 +41,8 @@ int main(int argc, char **argv) {
|
|||
ut32 bsize = 0;
|
||||
ut64 seek = 0;
|
||||
|
||||
if (argc < 2)
|
||||
if (argc<2)
|
||||
return main_help (1);
|
||||
|
||||
r_core_init (&r);
|
||||
|
||||
while ((c = getopt (argc, argv, "wfhe:ndvVs:p:b:Lui:l:"))!=-1) {
|
||||
|
@ -98,6 +97,8 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if (debug) {
|
||||
char file[1024];
|
||||
r_config_set (r.config, "io.va", "false");
|
||||
r.io->va = R_FALSE;
|
||||
strcpy (file, "dbg://");
|
||||
if (optind < argc) {
|
||||
char *ptr = r_file_path (argv[optind]);
|
||||
|
@ -135,11 +136,8 @@ int main(int argc, char **argv) {
|
|||
eprintf ("Cannot open file.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (r.file == NULL) {
|
||||
//fprintf (stderr, "No file specified\n");
|
||||
if (r.file == NULL) // no given file
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (run_rc) {
|
||||
char *homerc = r_str_home (".radare2rc");
|
||||
|
@ -166,9 +164,10 @@ int main(int argc, char **argv) {
|
|||
else if (bsize) r_core_block_size (&r, bsize);
|
||||
|
||||
// Load the binary information from rabin2
|
||||
{
|
||||
// TODO: use thread to load this, split contents line, per line and use global lock
|
||||
if (r_file_exist (r.file->filename)) {
|
||||
char *cmd = r_str_dup_printf (".!rabin2 -rSIeMzis%s %s",
|
||||
(debug||r.io->va)?"v":"", r.file->filename);
|
||||
(debug||r.io->va)?"v":"", r.file->filename);
|
||||
r_core_cmd (&r, cmd, 0);
|
||||
r_str_free (cmd);
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ R_API int r_core_config_init(RCore *core) {
|
|||
r_config_set_i (cfg, "search.distance", 0);
|
||||
r_config_set_cb (cfg, "scr.html", "false", &config_scrhtml_callback);
|
||||
r_config_set_cb (cfg, "io.ffio", "false", &config_ioffio_callback);
|
||||
r_config_set_cb (cfg, "io.va", "false", &config_iova_callback);
|
||||
r_config_set_cb (cfg, "io.va", "true", &config_iova_callback);
|
||||
r_config_set_cb (cfg, "io.cache", "false", &config_iocache_callback);
|
||||
r_config_set (cfg, "file.path", "");
|
||||
r_config_set (cfg, "file.project", "");
|
||||
|
|
|
@ -2,6 +2,7 @@ Debugger TODO
|
|||
=============
|
||||
* Breakpoints are ignored in some situations.. we must check
|
||||
for them and toggle a .dbg variable to break
|
||||
* stepover waits for one unknown event
|
||||
* ALL threads must be stopped when a breakpoint is handled..
|
||||
-- how to do this?
|
||||
* floating point registers
|
||||
|
@ -9,4 +10,4 @@ Debugger TODO
|
|||
* DRX control
|
||||
* Implement dump+restore as macros
|
||||
(dump,)
|
||||
* regio not implemented // really necessary?
|
||||
* regio not implemented // it is really necessary?
|
||||
|
|
|
@ -201,7 +201,7 @@ R_API int r_debug_step_over(RDebug *dbg, int steps) {
|
|||
RAnalOp op;
|
||||
ut8 buf[64];
|
||||
int ret = -1;
|
||||
if (dbg->anal) {
|
||||
if (dbg->anal && dbg->reg) {
|
||||
ut64 pc = r_debug_reg_get (dbg, dbg->reg->name[R_REG_NAME_PC]);
|
||||
dbg->iob.read_at (dbg->iob.io, pc, buf, sizeof (buf));
|
||||
r_anal_aop (dbg->anal, &op, pc, buf, sizeof (buf));
|
||||
|
@ -211,7 +211,7 @@ R_API int r_debug_step_over(RDebug *dbg, int steps) {
|
|||
ret = r_debug_continue (dbg);
|
||||
r_bp_del (dbg->bp, bpaddr);
|
||||
} else ret = r_debug_step (dbg, 1);
|
||||
} else fprintf (stderr, "Undefined pointer at dbg->anal\n");
|
||||
} else fprintf (stderr, "Undefined debugger backend\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ R_API ut64 r_debug_reg_get(struct r_debug_t *dbg, const char *name) {
|
|||
name = r_reg_get_name (dbg->reg, role);
|
||||
if (name == NULL || *name == '\0') {
|
||||
eprintf ("Cannot resolve name for register role '%s'.\n", name);
|
||||
return 0LL;
|
||||
}
|
||||
}
|
||||
ri = r_reg_get (dbg->reg, name, R_REG_TYPE_GPR);
|
||||
|
|
|
@ -28,36 +28,18 @@ static void r_reg_free_internal(struct r_reg_t *reg) {
|
|||
}
|
||||
|
||||
R_API int r_reg_get_name_idx(const char *type) {
|
||||
int role = type[0] + (type[1]<<8);
|
||||
switch (role) {
|
||||
case 'p'+('c'<<8):
|
||||
role = R_REG_NAME_PC;
|
||||
break;
|
||||
case 's'+('r'<<8):
|
||||
role = R_REG_NAME_SR;
|
||||
break;
|
||||
case 's'+('p'<<8):
|
||||
role = R_REG_NAME_SP;
|
||||
break;
|
||||
case 'b'+('p'<<8):
|
||||
role = R_REG_NAME_BP;
|
||||
break;
|
||||
case 'a'+('0'<<8):
|
||||
role = R_REG_NAME_A0;
|
||||
break;
|
||||
case 'a'+('1'<<8):
|
||||
role = R_REG_NAME_A1;
|
||||
break;
|
||||
case 'a'+('2'<<8):
|
||||
role = R_REG_NAME_A2;
|
||||
break;
|
||||
case 'a'+('3'<<8):
|
||||
role = R_REG_NAME_A3;
|
||||
break;
|
||||
default:
|
||||
role = -1;
|
||||
if (type)
|
||||
switch (*type | (type[1]<<8)) {
|
||||
case 'p'+('c'<<8): return R_REG_NAME_PC;
|
||||
case 's'+('r'<<8): return R_REG_NAME_SR;
|
||||
case 's'+('p'<<8): return R_REG_NAME_SP;
|
||||
case 'b'+('p'<<8): return R_REG_NAME_BP;
|
||||
case 'a'+('0'<<8): return R_REG_NAME_A0;
|
||||
case 'a'+('1'<<8): return R_REG_NAME_A1;
|
||||
case 'a'+('2'<<8): return R_REG_NAME_A2;
|
||||
case 'a'+('3'<<8): return R_REG_NAME_A3;
|
||||
}
|
||||
return role;
|
||||
return -1;
|
||||
}
|
||||
|
||||
R_API int r_reg_set_name(struct r_reg_t *reg, int role, const char *name) {
|
||||
|
|
Loading…
Reference in New Issue