StikDebug/StikJIT/JSSupport/IDeviceJSBridgeDebugProxy.m
Huge_Black 354333d873
JS controlled Debug Proxy (#211)
* ensure heartbeat happened recently before enabling jit

* JS controlled Debug Proxy

* Fix heartbeat issue & JS nil issue

* Update idevice

* Fix compile issue
2025-07-04 12:24:00 -04:00

33 lines
1 KiB
Objective-C

//
// IDeviceJSBridgeDebugProxy.m
// StikJIT
//
// Created by s s on 2025/4/25.
//
@import Foundation;
@import JavaScriptCore;
#import "JSSupport.h"
#import "../idevice/JITEnableContext.h"
#import "../idevice/idevice.h"
#include "../idevice/jit.h"
NSString* handleJSContextSendDebugCommand(JSContext* context, NSString* commandStr, DebugProxyHandle* debugProxy) {
DebugserverCommandHandle* command = 0;
command = debugserver_command_new([commandStr UTF8String], NULL, 0);
char* attach_response = 0;
IdeviceFfiError* err = debug_proxy_send_command2(debugProxy, command, &attach_response);
debugserver_command_free(command);
if (err) {
context.exception = [JSValue valueWithObject:[NSString stringWithFormat:@"error code %d, msg %s", err->code, err->message] inContext:context];
idevice_error_free(err);
return nil;
}
NSString* commandResponse = nil;
if(attach_response) {
commandResponse = @(attach_response);
}
idevice_string_free(attach_response);
return commandResponse;
}