Deserialize the stored context from it's file representation dict. Args: serialized_ctx (dict): a dict containing a serialize()d context instance source_index (int): source index for the current function Return value: The newly created context in
(serialized_ctx, source_index)
| 699 | |
| 700 | @staticmethod |
| 701 | def deserialize(serialized_ctx, source_index): |
| 702 | """Deserialize the stored context from it's file representation dict. |
| 703 | |
| 704 | Args: |
| 705 | serialized_ctx (dict): a dict containing a serialize()d context instance |
| 706 | source_index (int): source index for the current function |
| 707 | |
| 708 | Return value: |
| 709 | The newly created context instance, built according to the serialized form |
| 710 | """ |
| 711 | context = SourceContext(serialized_ctx["Function Name"], source_index) |
| 712 | # Numeric Consts |
| 713 | [context.recordConst(int(x)) for x in serialized_ctx["Numeric Consts"]] |
| 714 | # Strings |
| 715 | [context.recordString(x) for x in serialized_ctx["Strings"]] |
| 716 | # Function Calls |
| 717 | [context.recordCall(x) for x in serialized_ctx["Calls"]] |
| 718 | # Unknowns |
| 719 | [context.recordUnknown(x, False) for x in serialized_ctx["Unknown Functions"]] |
| 720 | [context.recordUnknown(x, True) for x in serialized_ctx["Unknown Globals"]] |
| 721 | # Hash |
| 722 | context.setHash(serialized_ctx["Hash"]) |
| 723 | # Frame size |
| 724 | context.setFrame(serialized_ctx["Stack Frame Size"]) |
| 725 | # Function size |
| 726 | context.setInstrCount(serialized_ctx["Instruction Count"]) |
| 727 | # Function Blocks |
| 728 | [context.recordBlock(x) for x in serialized_ctx["Code Block Sizes"]] |
| 729 | # Call order |
| 730 | context.setCallOrder(serialized_ctx["Call Order"]) |
| 731 | # Is static |
| 732 | if serialized_ctx["Is Static"]: |
| 733 | context.markStatic() |
| 734 | # Now rank the consts |
| 735 | context.rankConsts() |
| 736 | return context |
| 737 | |
| 738 | class BinaryContext(BinFileFunction, FunctionContext): |
| 739 | """A context that describes the full canonical representation of a binary function, with all of it's logic. |
no test coverage detected