(self, ctx, op)
return False
Generate text representation of an instructon operand.
        This function shouldn't change the database, flags or anything else.
        All these actions should be performed only by u_emu() function.
        The output text is placed in the output buffer initialized with init_output_buffer()
        This function uses out_...() functions from ua.hpp to generate the operand text
        Returns: 1-ok, 0-operand is hidden.
Generate text representation of an instructon operand.
        This function shouldn't change the database, flags or anything else.
        All these actions should be performed only by u_emu() function.
        The output text is placed in the output buffer initialized with init_output_buffer()
        This function uses out_...() functions from ua.hpp to generate the operand text
        Returns: 1-ok, 0-operand is hidden.
Generate text representation of an instructon operand . This function shouldn t change the database flags or anything else . All these actions should be performed only by u_emu () function . The output text is placed in the output buffer initialized with init_output_buffer () This function uses out_ ... () functions from ua . hpp to generate the operand text Returns : 1 - ok 0 - operand is hidden .
def notify_out_operand(self, ctx, op):
        '''
        Generate text representation of an instructon operand.
        This function shouldn't change the database, flags or anything else.
        All these actions should be performed only by u_emu() function.
        The output text is placed in the output buffer initialized with init_output_buffer()
        This function uses out_...() functions from ua.hpp to generate the operand text
        Returns: 1-ok, 0-operand is hidden.
        '''
        if op.type == WASM_BLOCK:
            if op.value == 0xFFFFFFC0:  # VarInt7 for 0x40
                # block has empty type
                pass
            else:
                # ref: https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
                # TODO(wb): untested!
                ctx.out_keyword({
                    # TODO(wb): I don't think these constants will line up in practice
                    0x7F: 'type:i32',
                    0x7E: 'type:i64',
                    0x7D: 'type:f32',
                    0x7C: 'type:f64',
                }[op.value])
            return True

        elif op.type == idaapi.o_reg:
            wtype = op.specval
            if wtype == WASM_LOCAL:
                # output a function-local "register".
                # these are nice because they can be re-named by the analyst.
                #
                # eg.
                #     code:0D57    get_local    $param0
                #     code:0D4B    set_local    $local9
                #                                 ^
                #                                these things
                f = self._get_function(ctx.insn.ea)
                if op.reg < f['type']['param_count']:
                    # the first `param_count` indices reference a parameter,
                    ctx.out_register('$param%d' % (op.reg))
                else:
                    # and the remaining indices are local variables.
                    ctx.out_register('$local%d' % (op.reg))
                return True

        elif op.type == idaapi.o_imm:
            wtype = op.specval
            if wtype == WASM_GLOBAL:
                # output a reference to a global variable.
                # note that we provide the address of the variable,
                #  and IDA will insert the correct name.
                # this is particularly nice when a user re-names the variable.
                #
                # eg.
                #
                #     code:0D38    set_global   global_0
                #                                 ^
                #                                this thing
                if op.value in self.globals:
                    g = self.globals[op.value]
                    ctx.out_name_expr(op, g['offset'])
                    return True
                else:
                    logger.info('missing global at index %d', op.value)
                    ctx.out_register('$global%d'% (op.value))
                    return True


            elif wtype == WASM_FUNC_INDEX:
                f = self.functions[op.value]
                if 'offset' in f:
                    # output a reference to an existing function.
                    # note that we provide the address of the function,
                    #  and IDA will insert the correct name.
                    #
                    # eg.
                    #
                    #     code:0D9E    call   $func9
                    #                           ^
                    #                          this thing
                    ctx.out_name_expr(op, f['offset'])
                else:
                    # output a reference to a function by name,
                    # such as an imported routine.
                    # since this won't have a location in the binary,
                    #  we output the raw name of the function.
                    #
                    # TODO: link this to the import entry
                    ctx.out_keyword(f['name'].encode('utf-8'))
                return True

            elif wtype == WASM_TYPE_INDEX:
                # resolve the type index into a type,
                # then human-render it.
                #
                # eg.
                #
                #     code:0B7F  call_indirect  (func (param $param0 i32) (param $param1 i32) (result i32)), 0
                #                  ^
                #                 this thing
                type_index = op.value
                type = self.types[type_index]
                signature = self._render_type(type)

                ctx.out_keyword(signature)
                return True

            elif wtype == WASM_ALIGN:
                # output an alignment directive.
                #
                # eg.
                #
                #     code:0B54   i32.load    0x30, align:2
                #                                     ^
                #                                    this thing
                ctx.out_keyword('align:')
                width = self.dt_to_width(op.dtype)
                ctx.out_value(op, idaapi.OOFW_IMM | width)
                return True

            else:
                width = self.dt_to_width(op.dtype)
                ctx.out_value(op, idaapi.OOFW_IMM | width)
                return True

        # error case
        return False
def notify_out_operand ( self , ctx , op ) : if op . type == WASM_BLOCK : if op . value == 0xFFFFFFC0 : # VarInt7 for 0x40 # block has empty type pass else : # ref: https://webassembly.github.io/spec/core/binary/types.html#binary-valtype # TODO(wb): untested! ctx . out_keyword ( { # TODO(wb): I don't think these constants will line up in practice 0x7F : 'type:i32' , 0x7E : 'type:i64' , 0x7D : 'type:f32' , 0x7C : 'type:f64' , } [ op . value ] ) return True elif op . type == idaapi . o_reg : wtype = op . specval if wtype == WASM_LOCAL : # output a function-local "register". # these are nice because they can be re-named by the analyst. # # eg. #     code:0D57    get_local    $param0 #     code:0D4B    set_local    $local9 #                                 ^ #                                these things f = self . _get_function ( ctx . insn . ea ) if op . reg < f [ 'type' ] [ 'param_count' ] : # the first `param_count` indices reference a parameter, ctx . out_register ( '$param%d' % ( op . reg ) ) else : # and the remaining indices are local variables. ctx . out_register ( '$local%d' % ( op . reg ) ) return True elif op . type == idaapi . o_imm : wtype = op . specval if wtype == WASM_GLOBAL : # output a reference to a global variable. # note that we provide the address of the variable, #  and IDA will insert the correct name. # this is particularly nice when a user re-names the variable. # # eg. # #     code:0D38    set_global   global_0 #                                 ^ #                                this thing if op . value in self . globals : g = self . globals [ op . value ] ctx . out_name_expr ( op , g [ 'offset' ] ) return True else : logger . info ( 'missing global at index %d' , op . value ) ctx . out_register ( '$global%d' % ( op . value ) ) return True elif wtype == WASM_FUNC_INDEX : f = self . functions [ op . value ] if 'offset' in f : # output a reference to an existing function. # note that we provide the address of the function, #  and IDA will insert the correct name. # # eg. # #     code:0D9E    call   $func9 #                           ^ #                          this thing ctx . out_name_expr ( op , f [ 'offset' ] ) else : # output a reference to a function by name, # such as an imported routine. # since this won't have a location in the binary, #  we output the raw name of the function. # # TODO: link this to the import entry ctx . out_keyword ( f [ 'name' ] . encode ( 'utf-8' ) ) return True elif wtype == WASM_TYPE_INDEX : # resolve the type index into a type, # then human-render it. # # eg. # #     code:0B7F  call_indirect  (func (param $param0 i32) (param $param1 i32) (result i32)), 0 #                  ^ #                 this thing type_index = op . value type = self . types [ type_index ] signature = self . _render_type ( type ) ctx . out_keyword ( signature ) return True elif wtype == WASM_ALIGN : # output an alignment directive. # # eg. # #     code:0B54   i32.load    0x30, align:2 #                                     ^ #                                    this thing ctx . out_keyword ( 'align:' ) width = self . dt_to_width ( op . dtype ) ctx . out_value ( op , idaapi . OOFW_IMM | width ) return True else : width = self . dt_to_width ( op . dtype ) ctx . out_value ( op , idaapi . OOFW_IMM | width ) return True # error case return False