mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-03-27 22:56:48 +08:00
when attaching the debugger to the device, make sure to pass the appropriate arch to the debug server and lldb (which could be arm64)
This commit is contained in:
19
bin/deploy.m
19
bin/deploy.m
@@ -836,6 +836,15 @@ start_debug_server(am_device_t dev)
|
||||
[NSTemporaryDirectory() fileSystemRepresentation]);
|
||||
assert(mktemp(lldb_socket_path) != NULL);
|
||||
|
||||
const char *remote_arch = getenv("RM_REMOTE_ARCH");
|
||||
assert(remote_arch != NULL);
|
||||
if (strcmp(remote_arch, "arm64") != 0
|
||||
&& strcmp(remote_arch, "armv7s") != 0
|
||||
&& strcmp(remote_arch, "armv7") != 0) {
|
||||
fprintf(stderr, "Invalid target architecture `%s'\n", remote_arch);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Prepare lldb commands file.
|
||||
NSString *py_cmds = [NSString stringWithFormat:@""\
|
||||
"# -*- coding: utf-8 -*-\n"\
|
||||
@@ -847,7 +856,7 @@ start_debug_server(am_device_t dev)
|
||||
"debugger = lldb.debugger\n"\
|
||||
"debugger.SetAsync(False)\n"\
|
||||
"error = lldb.SBError()\n"\
|
||||
"target = debugger.CreateTarget(\"%@\", \"armv7s-apple-ios\", \"remote-ios\", False, error)\n"\
|
||||
"target = debugger.CreateTarget(\"%@\", \"%s-apple-ios\", \"remote-ios\", False, error)\n"\
|
||||
"module = target.FindModule(target.GetExecutable())\n"\
|
||||
"filespec = lldb.SBFileSpec(\"%@\", False)\n"\
|
||||
"module.SetPlatformFileSpec(filespec)\n"\
|
||||
@@ -861,7 +870,9 @@ start_debug_server(am_device_t dev)
|
||||
"process.Continue()\n"\
|
||||
"",
|
||||
lldb_socket_path,
|
||||
app_path, app_remote_path,
|
||||
app_path,
|
||||
remote_arch,
|
||||
app_remote_path,
|
||||
device_support_path, device_support_path, device_support_path];
|
||||
NSString *py_cmds_path = [NSString pathWithComponents:
|
||||
[NSArray arrayWithObjects:NSTemporaryDirectory(),
|
||||
@@ -894,7 +905,9 @@ start_debug_server(am_device_t dev)
|
||||
|
||||
// Run lldb.
|
||||
gdb_task = [[RMTask launchedTaskWithLaunchPath:lldb_path
|
||||
arguments:[NSArray arrayWithObjects:@"-s", cmds_path, nil]] retain];
|
||||
arguments:[NSArray arrayWithObjects:@"-s", cmds_path,
|
||||
@"--arch", [NSString stringWithUTF8String:remote_arch],
|
||||
nil]] retain];
|
||||
|
||||
// Connect to the lldb UNIX socket.
|
||||
const int lldb_socket = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
|
||||
@@ -231,6 +231,17 @@ task :device => :archive do
|
||||
App.fail "Device ID `#{device_id}' not provisioned in profile `#{App.config.provisioning_profile}'"
|
||||
end
|
||||
env = "XCODE_DIR=\"#{App.config.xcode_dir}\""
|
||||
if ENV['debug']
|
||||
unless remote_arch = ENV['arch']
|
||||
ary = App.config.archs['iPhoneOS']
|
||||
remote_arch = ary.last
|
||||
if ary.size > 1
|
||||
$stderr.puts "*** Application is built for multiple architectures (#{ary.join(', ')}), the debugger will target #{remote_arch}. Pass the `arch' option in order to specify which one to use (ex. rake device debug=1 arch=arm64)."
|
||||
end
|
||||
end
|
||||
env << " RM_REMOTE_ARCH=\"#{remote_arch}\""
|
||||
end
|
||||
|
||||
deploy = File.join(App.config.bindir, 'ios/deploy')
|
||||
flags = Rake.application.options.trace ? '-d' : ''
|
||||
Signal.trap(:INT) { } if ENV['debug']
|
||||
|
||||
Reference in New Issue
Block a user