Class: CFrida::Script

Inherits:
GObject show all
Defined in:
ext/c_frida/Script.c

Instance Method Summary collapse

Methods inherited from GObject

#off, #on

Instance Method Details

#disable_debuggerObject



111
112
113
114
115
116
117
118
119
120
# File 'ext/c_frida/Script.c', line 111

static VALUE Script_disable_debugger(VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();

    CALL_GVL_FREE_WITH_RET(void *dummy, disable_debugger_sync, d->handle);
    return (Qnil);

    GERROR_BLOCK
}

#enable_debugger(*args) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'ext/c_frida/Script.c', line 134

static VALUE Script_enable_debugger(int argc, VALUE *argv, VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();
    VALUE kws, rport;
    uint port = 0;

    rb_scan_args(argc, argv, ":", &kws);
    if (!NIL_P(kws)) {
        rport = rb_hash_aref(kws, ID2SYM(rb_intern("port")));
        if (!NIL_P(rport)) {
            if (!RB_TYPE_P(rport, T_FIXNUM)) {
                raise_argerror("port must be a number.");
                return (Qnil);
            }
            port = NUM2UINT(rport);
        }
    }
    enable_debugger_proxy_args args = {
        .handle = d->handle,
        .port = port
    };
    CALL_GVL_FREE_WITH_RET(void *dummy, enable_debugger_sync, &args);
    goto done;

gerror:
    raise_rerror(NULL, _gerr);
done:
    return (Qnil);
}

#eternalizeObject



65
66
67
68
69
70
71
72
73
74
# File 'ext/c_frida/Script.c', line 65

static VALUE Script_eternalize(VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();

    CALL_GVL_FREE_WITH_RET(void *dummy, eternalize_sync, d->handle);
    return (Qnil);

    GERROR_BLOCK
}

#is_destroyedObject



20
21
22
23
24
25
26
27
28
# File 'ext/c_frida/Script.c', line 20

static VALUE Script_is_destroyed(VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();
    void	*is_destroyed;

    is_destroyed = rb_thread_call_without_gvl((void_fp)frida_script_is_destroyed, d->handle, NULL, NULL);
    return (is_destroyed ? Qtrue : Qfalse);
}

#loadObject



42
43
44
45
46
47
48
49
50
51
# File 'ext/c_frida/Script.c', line 42

static VALUE Script_load(VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();

    CALL_GVL_FREE_WITH_RET(void *dummy, load_sync, d->handle);
    return (Qnil);

    GERROR_BLOCK
}

#post(*args) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'ext/c_frida/Script.c', line 177

static VALUE Script_post(int argc, VALUE *argv, VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();
    VALUE kws, msg, data;
    gpointer cdata = NULL;

    rb_scan_args(argc, argv, "1:", &msg, &kws);
    if (!NIL_P(kws)) {
        data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
        if (!NIL_P(data)) {
            if (!RB_TYPE_P(data, T_STRING)) {
                raise_argerror("data must be a number.");
                return (Qnil);
            }
            cdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
        }
    }
    post_proxy_args args = {
        .handle = d->handle,
        .message = StringValueCStr(msg),
        .data = cdata
    };
    CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
    goto done;

gerror:
    raise_rerror(NULL, _gerr);
done:
    g_bytes_unref(args.data);
    return (Qnil);
}

#unloadObject



88
89
90
91
92
93
94
95
96
97
# File 'ext/c_frida/Script.c', line 88

static VALUE Script_unload(VALUE self)
{
    GET_GOBJECT_DATA();
    REQUIRE_GOBJECT_HANDLE();

    CALL_GVL_FREE_WITH_RET(void *dummy, unload_sync, d->handle);
    return (Qnil);

    GERROR_BLOCK
}