plasma-disassembler / plasma

Plasma is an interactive disassembler for x86/ARM/MIPS. It can generates indented pseudo-code with colored syntax.
GNU General Public License v3.0
3.05k stars 275 forks source link

How to display pseudo and asm code at the same time. #57

Closed lieanu closed 8 years ago

lieanu commented 8 years ago

Like this pic.

ghost commented 8 years ago

Only some instructions are displayed like in C (for example : add, mov, ...). For this pic, you can run :

$ ./run_plasma.py -i tests/server.bin
>> v 0x4009c6

If you are in a function, and you want to print the pseudo decompilation, press tab on an instruction.

If the analyzer didn't pass through this function (it doesn't on this one), you can press c to create code. Note: there is no auto-reload for the moment, if the analyzer has modified the content, you should quit the visual mode and come back. If you want to see the state of the analyzer, you can run the command analyzer.

If you want to print original instructions you can press I. After one press :

  1. no pseudo instructions, it prints the instrucion mnemonic. Also all pointers dereferenced in 3) were not here.
  2. mnemonic + original operand string given by capstone.
  3. Then it comes to the beginning, it prints instructions + pseudo instructions.

Did my answer help you ?

ghost commented 8 years ago

Note: the screenshot is old, I've removed comments with the # on the right. The best will be to used the I key.

lieanu commented 8 years ago

Hey,

Thanks for your reply. The old screenshot which display pseudo decompilation with asm comments is good for learning asm instrs. while I command is not so straightforward(swtich needs time :smile: ).

ghost commented 8 years ago

I don't known if I will add it again, but I take note. For the moment, you can use this patch :

diff --git a/plasma/lib/output.py b/plasma/lib/output.py
index 28e4499..a438e88 100644
--- a/plasma/lib/output.py
+++ b/plasma/lib/output.py
@@ -666,6 +666,7 @@ class OutputAbs():

             self._post_asm_inst(i, tab)

+        self._comment(" # " + self.get_inst_str(i))
         self._inline_comment(i)
         self._new_line()
lieanu commented 8 years ago

Thanks! 👍