Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
macbook-pros-computer:ruby187 lourens$ gdb miniruby
GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct 2 04:07:49 UTC 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .... done
(gdb) break malloc_error_break
(gdb) b eval.c : 10544
Breakpoint 2 at 0x330ba: file eval.c, line 10545.
(gdb) run -e 'Thread.new{ Fiber.new{p 1}.resume }'
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Users/lourens/projects/ruby187/miniruby -e 'Thread.new{ Fiber.new{p 1}.resume }'
Breakpoint 2, rb_thread_save_context (th=0x802000) at eval.c:10545
10545 len = ruby_stack_length(&pos);
(gdb) p len
(gdb) run -e 'Thread.new{ Fiber.new{} }.join'
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Users/lourens/projects/ruby187/miniruby -e 'Thread.new{ Fiber.new{} }.join'
miniruby(29493) malloc: *** error for object 0x803e00: double free
*** set a breakpoint in malloc_error_break to debug
Breakpoint 1, 0x9452b4a9 in malloc_error_break ()
(gdb) bt
#0 0x9452b4a9 in malloc_error_break ()
VALUE
rb_obj_clone(obj)
VALUE obj;
{
VALUE clone;
if (rb_special_const_p(obj)) {
rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj));
}
clone = rb_obj_alloc(rb_obj_class(obj));
# Define an attribute reader method. Cope with nil column.
def define_read_method(symbol, attr_name, column)
cast_code = column.type_cast_code('v') if column
access_code = cast_code ? "(v=@attributes['#{attr_name}']) && #{cast_code}" : "@attributes['#{attr_name}']"
unless attr_name.to_s == self.primary_key.to_s
access_code = access_code.insert(0, "missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); ")
end
if cache_attribute?(attr_name)
require 'set'
module ActiveRecord
class Base
attr_accessor :scrooge_callsite,
:scrooge_callsite_set,
:scrooge_own_callsite_set
@@scrooge_mutex = Mutex.new
Processing HomeController#show (for 127.0.0.1 at 2009-03-09 03:21:15) [GET]
Parameters: {"action"=>"show", "controller"=>"home"}
Continent Load (118.5ms) SELECT `continents`.id FROM `continents`
Rendering template within layouts/application
Rendering home/show
Rendered shared/_header (0.4ms)
Rendered shared/_navigation (0.7ms)
Missing template home/_show_sidebar.erb in view path app/views
Rendered shared/_sidebar (0.6ms)
Rendered shared/_footer (0.3ms)
macbook-pros-computer:scrooge lourens$ rake
(in /Users/lourens/projects/scrooge)
/opt/local/bin/ruby -Ilib:/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test:/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/connections/native_mysql -r /Users/lourens/projects/scrooge/test/setup "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/aaa_create_tables_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/adapter_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/aggregations_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/ar_schema_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/associations/belongs_to_associations_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/associations/callbacks_test.rb" "/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.1/test/cases/associations/cascaded_eager_loadin
# Reset id and @new_record if the transaction rolls back.
def rollback_active_record_state!
id_present = has_attribute?(self.class.primary_key)
previous_id = id
previous_new_record = new_record?
yield
rescue Exception
@new_record = previous_new_record
if id_present
self.id = previous_id
def test_should_rollback_any_changes_if_an_exception_occurred_while_saving
before = [@pirate.catchphrase, @pirate.ship.name]
@pirate.catchphrase = 'Arr'
@pirate.ship.name = 'The Vile Insanity'
# Stub the save method of the @pirate.ship instance to raise an exception
class << @pirate.ship
def save(*args)
super