Refactor evars asm.lines.* (#10085)

* asm.linesout > asm.lines.out
* asm.var.submin fix
This commit is contained in:
Giovanni 2018-05-18 10:29:00 +02:00 committed by radare
parent ddb7bfc316
commit 855eb16d93
6 changed files with 16 additions and 16 deletions

View File

@ -28,7 +28,7 @@ Add comments using the ';' key in visual mode or the 'CC' command from the radar
Assemble opcodes with the 'a' and 'A' keys in visual mode, which are bindings to the 'wa' and 'wA' commands
Find expanded AES keys in memory with '/Ca'
Find wide-char strings with the '/w <string>' command
Enable ascii-art jump lines in disassembly by setting 'e asm.lines=true'. asm.linesout and asm.linestyle may interest you as well
Enable ascii-art jump lines in disassembly by setting 'e asm.lines=true'. asm.lines.out and asm.linestyle may interest you as well
Control the signal handlers of the child process with the 'dk' command
Get a free shell with 'ragg2 -i exec -x'
Interpret radare2 scripts with '. <path-to-script>'. Similar to the bash source alias command.

View File

@ -2478,10 +2478,10 @@ R_API int r_core_config_init(RCore *core) {
SETPREF ("asm.lines", "true", "Show ASCII-art lines at disassembly");
SETPREF ("asm.lines.call", "false", "Enable call lines");
SETPREF ("asm.lines.ret", "false", "Show separator lines after ret");
SETPREF ("asm.linesout", "true", "Show out of block lines");
SETPREF ("asm.linesright", "false", "Show lines before opcode instead of offset");
SETPREF ("asm.lineswide", "false", "Put a space between lines");
SETICB ("asm.lineswidth", 7, &cb_asmlineswidth, "Number of columns for program flow arrows");
SETPREF ("asm.lines.out", "true", "Show out of block lines");
SETPREF ("asm.lines.right", "false", "Show lines before opcode instead of offset");
SETPREF ("asm.lines.wide", "false", "Put a space between lines");
SETICB ("asm.lines.width", 7, &cb_asmlineswidth, "Number of columns for program flow arrows");
SETICB ("asm.var.submin", 0x100, &cb_asmvarsubmin, "Minimum value to substitute in instructions (asm.var.sub)");
SETPREF ("asm.middle", "false", "Allow disassembling jumps in the middle of an instruction");
SETPREF ("asm.noisy", "true", "Show comments considered noisy but possibly useful");

View File

@ -599,7 +599,7 @@ static RDisasmState * ds_init(RCore *core) {
ds->show_varaccess = r_config_get_i (core->config, "asm.var.access");
ds->maxrefs = r_config_get_i (core->config, "asm.maxrefs");
ds->show_lines = r_config_get_i (core->config, "asm.lines");
ds->linesright = r_config_get_i (core->config, "asm.linesright");
ds->linesright = r_config_get_i (core->config, "asm.lines.right");
ds->show_indent = r_config_get_i (core->config, "asm.indent");
ds->indent_space = r_config_get_i (core->config, "asm.indentspace");
ds->tracespace = r_config_get_i (core->config, "asm.tracespace");
@ -611,7 +611,7 @@ static RDisasmState * ds_init(RCore *core) {
ds->show_lines_ret = r_config_get_i (core->config, "asm.lines.ret");
ds->show_size = r_config_get_i (core->config, "asm.size");
ds->show_trace = r_config_get_i (core->config, "asm.trace");
ds->linesout = r_config_get_i (core->config, "asm.linesout");
ds->linesout = r_config_get_i (core->config, "asm.lines.out");
ds->adistrick = r_config_get_i (core->config, "asm.middle"); // TODO: find better name
ds->asm_demangle = r_config_get_i (core->config, "asm.demangle");
ds->asm_describe = r_config_get_i (core->config, "asm.describe");
@ -716,7 +716,7 @@ static RDisasmState * ds_init(RCore *core) {
if (ds->show_flag_in_bytes) {
ds->show_flags = 0;
}
if (r_config_get_i (core->config, "asm.lineswide")) {
if (r_config_get_i (core->config, "asm.lines.wide")) {
ds->linesopts |= R_ANAL_REFLINE_TYPE_WIDE;
}
if (core->cons->vline) {
@ -751,7 +751,7 @@ static RDisasmState * ds_init(RCore *core) {
} else {
ds->cursor = -1;
}
if (r_config_get_i (core->config, "asm.lineswide")) {
if (r_config_get_i (core->config, "asm.lines.wide")) {
ds->linesopts |= R_ANAL_REFLINE_TYPE_WIDE;
}
if (core->cons->vline) {

View File

@ -2882,14 +2882,14 @@ static int visual_responsive(RCore *core) {
r_config_set_i (core->config, "asm.offset", 1);
}
if (w > 80) {
r_config_set_i (core->config, "asm.lineswidth", 14);
r_config_set_i (core->config, "asm.lineswidth", w - (w / 1.2));
r_config_set_i (core->config, "asm.lines.width", 14);
r_config_set_i (core->config, "asm.lines.width", w - (w / 1.2));
r_config_set_i (core->config, "asm.cmt.col", w - (w / 2.5));
} else {
r_config_set_i (core->config, "asm.lineswidth", 7);
r_config_set_i (core->config, "asm.lines.width", 7);
}
if (w < 70) {
r_config_set_i (core->config, "asm.lineswidth", 1);
r_config_set_i (core->config, "asm.lines.width", 1);
r_config_set_i (core->config, "asm.bytes", 0);
} else {
r_config_set_i (core->config, "asm.bytes", 1);

View File

@ -1 +1 @@
function docss(t){return"<font color=black>"+t+"</font>"}enyo.kind({name:"DisassemblerOld",kind:"Scroller",tag:"div",style:"margin:0px;background-color:#c0c0c0",data:null,components:[{tag:"div",allowHtml:!0,classes:"colorbar",name:"colorbar"},{tag:"br"},{tag:"div",content:"^",classes:"moreless",ontap:"less"},{tag:"pre",allowHtml:!0,name:"text",content:"..",style:"margin-left:5px"},{tag:"div",content:"v",classes:"moreless",ontap:"more"}],min:0,max:0,block:512,base:"entry0",less:function(){var t=this.$.text;this.min+=this.block,r2.get_disasm(this.base+"-"+this.min,this.block,function(e){e=docss(r2.filter_asm(e,"pd"));var s=r2ui._dis.getScrollBounds().height;t.setContent("<div class='enyo-selectable'>"+e+t.getContent()+"</div>");var i=r2ui._dis.getScrollBounds().height;r2ui._dis.scrollTo(0,i-s)})},more:function(){var t=this.$.text;this.max+=this.block,r2.get_disasm(this.base+"+"+this.max,this.block,function(e){e=docss(r2.filter_asm(e,"pd")),t.setContent("<div class='enyo-selectable'>"+t.getContent()+e+"</div>")})},seek:function(t){var e=this.$.text;this.base=t,this.min=this.max=0,r2.get_disasm(t,this.block,function(t){t=docss(r2.filter_asm(t,"pd")),e.setContent("<div class='enyo-selectable'>"+t+"</div>")}),this.scrollTo(0,0)},create:function(){this.inherited(arguments);this.$.text;r2.cmd("e asm.lineswidth = 20",function(t){}),this.seek("entry0"),r2ui._dis=this,r2ui.history_push("entry0")},colorbar_create:function(){var t=this;r2.cmd("p-j 24",function(e){try{var s=JSON.parse(e)}catch(i){return void alert(i)}console.log(s);for(var o="<table class='colorbar'><tr valign=top style='height:8px;border-spacing:0'>",r={flags:"#c0c0c0",comments:"yellow",functions:"#5050f0",strings:"orange"},n="",l=16,a=0;a<s.blocks.length;a++){var c=s.blocks[a],d="<div style='overflow:hidden;width:12px;'>____</div>";if(c.offset){var d="<table width='width:100%' height="+l+" style='border-spacing:0px'>",h=0;for(var b in r)c[b]&&h++;if(h++,1==h)break;var m=l/h;for(var b in r){r[b];c[b]&&(d+="<tr><td class='colorbar_item' style='background-color:"+r[b]+"'><div style='width:12px;overflow:hidden;height:"+m+"px'>____</div></td></tr>")}d+="</table>",n="0x"+c.offset.toString(16)}else n="0x"+(s.from+s.blocksize*a).toString(16);o+="<td onclick='r2ui.seek("+n+",true)' title='"+n+"' style='height:"+l+"px' width=15px>"+d+"</td>"}o+="</tr></table>",t.$.colorbar.setContent(o)})}});
function docss(t){return"<font color=black>"+t+"</font>"}enyo.kind({name:"DisassemblerOld",kind:"Scroller",tag:"div",style:"margin:0px;background-color:#c0c0c0",data:null,components:[{tag:"div",allowHtml:!0,classes:"colorbar",name:"colorbar"},{tag:"br"},{tag:"div",content:"^",classes:"moreless",ontap:"less"},{tag:"pre",allowHtml:!0,name:"text",content:"..",style:"margin-left:5px"},{tag:"div",content:"v",classes:"moreless",ontap:"more"}],min:0,max:0,block:512,base:"entry0",less:function(){var t=this.$.text;this.min+=this.block,r2.get_disasm(this.base+"-"+this.min,this.block,function(e){e=docss(r2.filter_asm(e,"pd"));var s=r2ui._dis.getScrollBounds().height;t.setContent("<div class='enyo-selectable'>"+e+t.getContent()+"</div>");var i=r2ui._dis.getScrollBounds().height;r2ui._dis.scrollTo(0,i-s)})},more:function(){var t=this.$.text;this.max+=this.block,r2.get_disasm(this.base+"+"+this.max,this.block,function(e){e=docss(r2.filter_asm(e,"pd")),t.setContent("<div class='enyo-selectable'>"+t.getContent()+e+"</div>")})},seek:function(t){var e=this.$.text;this.base=t,this.min=this.max=0,r2.get_disasm(t,this.block,function(t){t=docss(r2.filter_asm(t,"pd")),e.setContent("<div class='enyo-selectable'>"+t+"</div>")}),this.scrollTo(0,0)},create:function(){this.inherited(arguments);this.$.text;r2.cmd("e asm.lines.width = 20",function(t){}),this.seek("entry0"),r2ui._dis=this,r2ui.history_push("entry0")},colorbar_create:function(){var t=this;r2.cmd("p-j 24",function(e){try{var s=JSON.parse(e)}catch(i){return void alert(i)}console.log(s);for(var o="<table class='colorbar'><tr valign=top style='height:8px;border-spacing:0'>",r={flags:"#c0c0c0",comments:"yellow",functions:"#5050f0",strings:"orange"},n="",l=16,a=0;a<s.blocks.length;a++){var c=s.blocks[a],d="<div style='overflow:hidden;width:12px;'>____</div>";if(c.offset){var d="<table width='width:100%' height="+l+" style='border-spacing:0px'>",h=0;for(var b in r)c[b]&&h++;if(h++,1==h)break;var m=l/h;for(var b in r){r[b];c[b]&&(d+="<tr><td class='colorbar_item' style='background-color:"+r[b]+"'><div style='width:12px;overflow:hidden;height:"+m+"px'>____</div></td></tr>")}d+="</table>",n="0x"+c.offset.toString(16)}else n="0x"+(s.from+s.blocksize*a).toString(16);o+="<td onclick='r2ui.seek("+n+",true)' title='"+n+"' style='height:"+l+"px' width=15px>"+d+"</td>"}o+="</tr></table>",t.$.colorbar.setContent(o)})}});

File diff suppressed because one or more lines are too long