introduce the flag to stop strip in order to debug RubyMotion app

This commit is contained in:
Watson
2013-10-01 17:26:28 +09:00
parent 840a1b545a
commit a87fcea92b
3 changed files with 16 additions and 16 deletions

View File

@@ -22,22 +22,15 @@ $ bundle install
## How to debug on RubyMotion app
First, comment out `[ios, sim].map ...` (line 31) in `data/Rakefile` as following:
```ruby
29 # remove debug symbols
30 strip = File.join(PLATFORMS_DIR, '../usr/bin/strip')
31 # [ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") }
```
Then, build RubyMotion
Build RubyMotion as following (enable `DEBUG` environment variable)
```
$ rake optz_level=0
$ DEBUG=true rake
$ sudo rake install
```
At last, debug on RubyMotion app
Debug on RubyMotion app
```
$ rake debug=1 no_continue=1

View File

@@ -1,4 +1,5 @@
verbose(true)
NEED_STRIP = !ENV['DEBUG']
task :default => :all
task :all => [:files, :deploy, :sim, :nfd]
@@ -6,8 +7,9 @@ task :all => [:files, :deploy, :sim, :nfd]
STRIP = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip"
task :files do
bin = 'ruby'
install '../vm/miniruby', 'ruby'
sh "#{STRIP} -x ruby"
sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP
end
task :deploy do
@@ -15,7 +17,7 @@ task :deploy do
bin = 'ios/deploy'
if !File.exist?(bin) or File.mtime('deploy.m') > File.mtime(bin) or File.mtime('builtin_debugger_cmds.h') > File.mtime(bin)
sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 deploy.m -o \"#{bin}\" -framework Foundation -I."
sh "#{STRIP} -x \"#{bin}\""
sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP
end
end
@@ -26,7 +28,7 @@ task :sim do
if !File.exist?(bin) or File.mtime('sim.m') > File.mtime(bin) or File.mtime('builtin_debugger_cmds.h') > File.mtime(bin)
define = "-DSIMULATOR_#{template.upcase}"
sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang #{define} -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 sim.m -o \"#{bin}\" -framework Foundation -framework ApplicationServices -framework AppKit -L. -ledit -Wl,-rpath,/usr/lib -I."
sh "#{STRIP} -x \"#{bin}\""
sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP
end
end
end
@@ -35,7 +37,7 @@ task :nfd do
bin = 'nfd'
if !File.exist?(bin) or File.mtime('nfd.m') > File.mtime(bin)
sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 nfd.m -o \"#{bin}\" -framework Foundation -I."
sh "#{STRIP} -x \"#{bin}\""
sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP
end
end

View File

@@ -3,6 +3,7 @@ IOS_SDK_VERSIONS = ENV['ios_sdk_versions'].split(',')
OSX_SDK_VERSIONS = ENV['osx_sdk_versions'].split(',')
verbose(true)
NEED_STRIP = !ENV['DEBUG']
task :default => :all
task :all => [:vm_files, :bridgesupport_files, :bridgesupport_static_stubs]
@@ -22,7 +23,9 @@ task :vm_files do
install File.join(objs, 'libmacruby-repl.dylib'), sdk
# remove debug symbols
Dir.glob(sdk + '/*.{a,dylib}').each { |x| sh("\"#{strip}\" -S \"#{x}\"") }
if NEED_STRIP
Dir.glob(sdk + '/*.{a,dylib}').each { |x| sh("\"#{strip}\" -S \"#{x}\"") }
end
end
IOS_SDK_VERSIONS.each do |sdk_version|
@@ -45,7 +48,9 @@ task :vm_files do
install File.join(objs, 'libmacruby-repl.dylib'), sim
# remove debug symbols
[ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") }
if NEED_STRIP
[ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") }
end
end
end