UQ-PAC / gtirb-semantics

Add instruction semantics to the IR of a dissassembled ARM64 binary
2 stars 0 forks source link

debug_gts.py Instruction Addresses #20

Closed l-kent closed 1 month ago

l-kent commented 1 month ago

It would be very convenient for debugging purposes if each instruction could have its address printed by debug_gts.py in the json output.

So instead of:

    "qPrA/26aRv6grRs6qT6FWg==": {
      "name": "deregister_tm_clones [entry] [1/4]",
      "address": 1680,
      "code": [
        {
          "adrp x0, #69632": [
            "Stmt_Assign(LExpr_Array(LExpr_Var(_R),Expr_LitInt(\"0\")),Expr_LitBits(\"0000000000000000000000000000000000000000000000010001000000000000\"))"
          ]
        },
        {
          "add x0, x0, #16": [
            "Stmt_Assign(LExpr_Array(LExpr_Var(_R),Expr_LitInt(\"0\")),Expr_TApply(add_bits.0,[(Expr_LitInt(\"64\"))],[(Expr_Array(Expr_Var(_R),Expr_LitInt(\"0\")));(Expr_LitBits(\"0000000000000000000000000000000000000000000000000000000000010000\"))]))"
          ]
        },

it would ideally look something like this:

    "qPrA/26aRv6grRs6qT6FWg==": {
      "name": "deregister_tm_clones [entry] [1/4]",
      "address": 1680,
      "code": [
        {
          "address": 1680,
          "adrp x0, #69632": [
            "Stmt_Assign(LExpr_Array(LExpr_Var(_R),Expr_LitInt(\"0\")),Expr_LitBits(\"0000000000000000000000000000000000000000000000010001000000000000\"))"
          ]
        },
        {
          "address": 1684,
          "add x0, x0, #16": [
            "Stmt_Assign(LExpr_Array(LExpr_Var(_R),Expr_LitInt(\"0\")),Expr_TApply(add_bits.0,[(Expr_LitInt(\"64\"))],[(Expr_Array(Expr_Var(_R),Expr_LitInt(\"0\")));(Expr_LitBits(\"0000000000000000000000000000000000000000000000000000000000010000\"))]))"
          ]
        },
katrinafyi commented 1 month ago

Sure! I would like to use a JSON schema which is more regular, though. The address key next to the mnemonic "value" is a bit :eyes:

katrinafyi commented 1 month ago

I have... made a mess of Github's UI. In any case, this is merged in now and will be picked up by the Nix package overnight.