Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hidva committed Apr 3, 2021
1 parent a4c74ce commit 4d7a518
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ And `atoi.cfg.svg` looks like:
~~The operand in instruction is represented by its SSA name, it means that if two operands in the same block have the same SSA name, they are the same operand.~~
And we will attempt to generate more meaningful expression for edge constructed by Jcc(JE, JNE, etc.) instruction, such as that the expression for the edge constructed by the 'je(0x400590)' after 'cmp(dl_1,0x9)' is `dl_1 == 0x9` and `dl_1 != 0x9`, not just `ZF = 1` and `ZF = 0`.
And we will attempt to generate more meaningful expression for edge constructed by Jcc(JE, JNE, etc.) instruction, such as that the expression for the edge constructed by the 'jbe 0x400500' after 'cmp cl,0x9' is `cl > 0x9` and `cl <= 0x9`, not just `CF = 1 or ZF = 1`.
Instructions marked with an '=>' will be more prominent when displayed:
```
0x00000000004004f8 <+56>: ja 0x40051a <MyAtoI+90>
0x00000000004004fa <+58>: nop WORD PTR [rax+rax*1+0x0]
=> 0x0000000000400500 <+64>: lea ecx,[rax+rax*4]
0x0000000000400503 <+67>: add rdi,0x1
0x0000000000400507 <+71>: lea eax,[rdx+rcx*2-0x30]
```
![atoi.cfg.mark.jpg](https://github.com/hidva/as2cfg/blob/master/atoi.cfg.mark.jpg)
![h](https://blog.hidva.com/assets/followme.gif?f=GITHUBas2cfg)
Binary file added atoi.cfg.mark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn insts2label(cfgnode: &cfg::Node, cfggraph: &cfg::Graph) -> (String, bool) {
let mut interested = false;
let mut labelline = vec![
"<".to_string(),
"<TABLE BORDER=\"0\" CELLBORDER=\"0\" ALIGN=\"LEFT\">".to_string(),
"<TABLE BORDER=\"0\" CELLBORDER=\"0\">".to_string(),
];
for &inst_id in &cfgnode.insts {
let inst = &cfggraph.insts[inst_id];
Expand All @@ -24,7 +24,7 @@ fn insts2label(cfgnode: &cfg::Node, cfggraph: &cfg::Graph) -> (String, bool) {
};
let font_end = if inst.interested { "</FONT>" } else { "" };
let linestr = format!(
"<TR><TD ALIGN=\"LEFT\">{}{:#x}{}</TD><TD ALIGN=\"LEFT\">{}</TD></TR>",
"<TR><TD ALIGN=\"RIGHT\">{}{:#x}{}</TD><TD ALIGN=\"LEFT\">{}</TD></TR>",
font_begin,
inst.addr,
font_end,
Expand Down

0 comments on commit 4d7a518

Please sign in to comment.