Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit new annotations to support new features in the decompiler in Cutter #20

Open
NirmalManoj opened this issue Aug 4, 2020 · 0 comments

Comments

@NirmalManoj
Copy link
Contributor

Description
I am making this issue on behalf of the Cutter Team. As part of the Improving Decompiler Widget project, we have made a new dedicated context menu for the decompiler in Cutter. These changes can be found in the decompiler-refactoring branch in Cutter and also can be quickly seen from the project linked above. Please have a look at r_annotated_code.h to have an idea of the new annotations added.

For r2retdec to work desirably and support all the actions that are currently available for r2ghidra-dec (in the decompiler-refactoring branch now), it has to provide required annotations.

Detailed description of the data we will need for each type of annotation

  1. For R_CODE_ANNOTATION_TYPE_FUNCTION_NAME:
    1. Range of the function's name in the entire output.
    2. Name of the function
    3. Address of the function
      Example JSON output with all this information (that is currently available from r2ghidra-dec)
    {
      "start": 542,
      "end": 555,
      "type": "function_name",
      "name": "sym.Aeropause",
      "offset": 4199038
    }, 
  1. For R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE and R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE:
    Note: R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE is the annotation type for constant variables with an address. e.g. string literals.
    1. Range of the variable name in the entire output.
    2. Address of the variable
      Example JSON output with all this information (that is currently available from r2ghidra-dec)
    {
      "start": 73,
      "end": 81,
      "type": "global_variable",
      "offset": 4210780
    }, 
    {
      "start": 453,
      "end": 459,
      "type": "constant_variable",
      "offset": 4202553
    }, 
  1. For R_CODE_ANNOTATION_TYPE_LOCAL_VARIABLE and R_CODE_ANNOTATION_TYPE_FUNCTION_PARAMETER:
    1. Range of the variable name in the entire output.
    2. Name of the variable
      Example JSON output with all this information (that is currently available from r2ghidra-dec)
    {
      "start": 636,
      "end": 641,
      "type": "local_variable",
      "name": "uVar1"
    }, 
    {
      "start": 625,
      "end": 629,
      "type": "function_parameter",
      "name": "argv"
    },

Here, I'm linking a file with the pdg output and formatted pdgj output of multiple functions that will cover all new types of annotations, and the binary used. This is just for illustrating the kind of information we need.
AllAnnotationsWithBinary.zip

If any more information is needed, I will be happy to help.

xkubov pushed a commit that referenced this issue Aug 9, 2020
Closes #20

New type annotations were implemented for the new cutter plugin.
This commit provides integration of those changes in r2plugin.
xkubov pushed a commit that referenced this issue Aug 18, 2020
Closes #20

New type annotations were implemented for the new cutter plugin.
This commit provides integration of those changes in r2plugin.
xkubov pushed a commit that referenced this issue Aug 18, 2020
Closes #20

New type annotations were implemented for the new cutter plugin.
This commit provides integration of those changes in r2plugin.
xkubov pushed a commit that referenced this issue Aug 18, 2020
Closes #20

New type annotations were implemented for the new cutter plugin.
This commit provides integration of those changes in r2plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants