Merge branch 'master' of github.com:lrz/RubyMotion

This commit is contained in:
Laurent Sansonetti
2013-08-07 14:31:12 +02:00
7 changed files with 118 additions and 14 deletions

8
NEWS
View File

@@ -1,3 +1,11 @@
= RubyMotion 2.7 =
* fix a bug in Range.new where it would cause malloc_error_break error.
* [iOS] Added `:light_content' as new status bar style for UIStatusBarStyle
property. Thanks to Chris Radford for the patch (pull request #116).
* [iOS] Fixed a bug in debugger where built-in debugger command does not
work with lldb in iOS 7 simulator.
= RubyMotion 2.6 =
* Added support for iOS 7.0 Beta 4 and Xcode 5.0 DP 4.

View File

@@ -86,7 +86,7 @@ task :install do
public_binaries = ['./bin/motion']
binaries = public_binaries.dup.concat(['./bin/ios/deploy', './bin/ios/sim',
'./bin/osx/sim', './bin/llc', './bin/ruby', './bin/ctags',
'lib/yard/bin/yard', 'lib/yard/bin/yardoc', 'lib/yard/bin/yri'])
'lib/yard/bin/yard', 'lib/yard/bin/yardoc', 'lib/yard/bin/yri', './lldb/lldb.py'])
data = ['./NEWS']
data.concat(Dir.glob('./lib/**/*', File::FNM_DOTMATCH))
data.delete_if { |x| true if x.include?("lib/yard/bin/") }

View File

@@ -872,7 +872,7 @@ again:
}
static NSString *
gdb_commands_file(void)
save_debugger_command(NSString *cmds)
{
#if defined(SIMULATOR_IOS)
# define SIMGDBCMDS_BASE @"_simgdbcmds_ios"
@@ -882,6 +882,22 @@ gdb_commands_file(void)
NSString *cmds_path = [NSString pathWithComponents:
[NSArray arrayWithObjects:NSTemporaryDirectory(), SIMGDBCMDS_BASE,
nil]];
NSError *error = nil;
if (![cmds writeToFile:cmds_path atomically:YES
encoding:NSASCIIStringEncoding error:&error]) {
fprintf(stderr,
"can't write gdb commands file into path %s: %s\n",
[cmds_path UTF8String],
[[error description] UTF8String]);
exit(1);
}
return cmds_path;
}
static NSString *
gdb_commands_file(void)
{
NSString *cmds = @""\
"set breakpoint pending on\n"\
"break rb_exc_raise\n"\
@@ -902,16 +918,36 @@ gdb_commands_file(void)
#endif
];
}
NSError *error = nil;
if (![cmds writeToFile:cmds_path atomically:YES
encoding:NSASCIIStringEncoding error:&error]) {
fprintf(stderr,
"can't write gdb commands file into path %s: %s\n",
[cmds_path UTF8String],
[[error description] UTF8String]);
exit(1);
return save_debugger_command(cmds);
}
static NSString *
lldb_commands_file(int pid)
{
NSString *cmds = [NSString stringWithFormat:@""\
"process attach -p %d\n"\
"command script import /Library/RubyMotion/lldb/lldb.py\n"\
"breakpoint set --name rb_exc_raise\n"\
"breakpoint set --name malloc_error_break\n",
pid];
NSString *user_cmds = [NSString stringWithContentsOfFile:
@"debugger_cmds" encoding:NSUTF8StringEncoding error:nil];
if (user_cmds != nil) {
cmds = [cmds stringByAppendingString:user_cmds];
cmds = [cmds stringByAppendingString:@"\n"];
}
return cmds_path;
if (getenv("no_continue") == NULL) {
cmds = [cmds stringByAppendingString:
#if defined(SIMULATOR_IOS)
@"continue\n"
#else
@"run\n"
#endif
];
}
return save_debugger_command(cmds);
}
#if defined(SIMULATOR_IOS)
@@ -990,8 +1026,7 @@ gdb_commands_file(void)
else if ([[NSFileManager defaultManager] fileExistsAtPath:lldb_path]) {
gdb_task = [[NSTask launchedTaskWithLaunchPath:lldb_path
arguments:[NSArray arrayWithObjects:@"-a", @"i386",
@"-p", [pidNumber description], @"-x", gdb_commands_file(),
nil]] retain];
@"-s", lldb_commands_file([pidNumber intValue]), nil]] retain];
}
else {
fprintf(stderr, "can't locate a debugger (gdb `%s' or lldb `%s')\n",

View File

@@ -252,6 +252,7 @@ module Motion; module Project;
when :default then 'UIStatusBarStyleDefault'
when :black_translucent then 'UIStatusBarStyleBlackTranslucent'
when :black_opaque then 'UIStatusBarStyleBlackOpaque'
when :light_content then 'UIStatusBarStyleLightContent'
else
App.fail "Unknown status_bar_style value: `#{@status_bar_style}'"
end

41
lldb/lldb.py Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/python
import lldb
def pro(debugger, command, result, internal_dict):
"""
pro(obj): inspects the given 'obj'
"""
args = command.split()
if len(args) != 1:
print pro.__doc__
return
cmd = "po rb_inspect(" + args[0] + ")"
lldb.debugger.HandleCommand(cmd)
def pri(debugger, command, result, internal_dict):
"""
pri(name): inspects the given instance variable 'name' on self
pri(rcv, name): inspects the given instance variable 'name' on 'rcv'
"""
args = command.split()
if len(args) == 1:
cmd = "po rb_inspect((void *)rb_ivar_get(self, (void *)rb_intern(" + args[0] + ")))"
elif len(args) == 2:
cmd = "po rb_inspect((void *)rb_ivar_get(" + args[0] + ", (void *)rb_intern(" + args[1] + ")))"
else:
print pri.__doc__
return
lldb.debugger.HandleCommand(cmd)
# And the initialization code to add your commands
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f lldb.pro print-ruby-object')
debugger.HandleCommand('command script add -f lldb.pro pro')
debugger.HandleCommand('command script add -f lldb.pri print-ruby-ivar')
debugger.HandleCommand('command script add -f lldb.pri pri')

View File

@@ -302,3 +302,22 @@ describe "NSMutableArray" do
$nsarray_dealloc.should == true
end
end
class Range
def dealloc
$dealloc_test = true
super
end
end
describe "Range" do
before do
$dealloc_test = false
end
it "#new should work without malloc error" do
autorelease_pool do
Range.new(10, 20)
end
$dealloc_test.should == true
end
end

2
vm

Submodule vm updated: 4e03d5b719...b53195a0bf