Module: Hoe::Debugging
- Defined in:
- lib/hoe/debugging.rb
Overview
Whee, stuff to help when your codes are b0rked. Tasks provided:
-
test:gdb
-
test:valgrind
-
test:valgrind:mem
-
test:valgrind:mem0
Constant Summary collapse
- VERSION =
:nodoc:
"1.0.4"
Instance Attribute Summary collapse
-
#gdb_options ⇒ Object
Optional: Used to add flags to GDB.
-
#valgrind_options ⇒ Object
Optional: Used to add flags to valgrind.
Instance Method Summary collapse
-
#define_debugging_tasks ⇒ Object
:nodoc:.
- #hoe_debugging_make_test_cmd ⇒ Object
- #hoe_debugging_ruby ⇒ Object
-
#initialize_debugging ⇒ Object
:nodoc:.
Instance Attribute Details
#gdb_options ⇒ Object
Optional: Used to add flags to GDB. [default: []
]
18 19 20 |
# File 'lib/hoe/debugging.rb', line 18 def @gdb_options end |
#valgrind_options ⇒ Object
Optional: Used to add flags to valgrind. [default: %w(--num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no)
]
25 26 27 |
# File 'lib/hoe/debugging.rb', line 25 def @valgrind_options end |
Instance Method Details
#define_debugging_tasks ⇒ Object
:nodoc:
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/hoe/debugging.rb', line 51 def define_debugging_tasks #:nodoc: desc "Run the test suite under GDB." task "test:gdb" do sh "gdb #{.join ' '} --args #{hoe_debugging_ruby} #{hoe_debugging_make_test_cmd}" end desc "Run the test suite under Valgrind." task "test:valgrind" do sh "valgrind #{.join ' '} #{hoe_debugging_ruby} #{hoe_debugging_make_test_cmd}" end desc "Run the test suite under Valgrind with memory-fill." task "test:valgrind:mem" do sh "valgrind #{.join ' '} " + "--freelist-vol=100000000 --malloc-fill=6D --free-fill=66 " + "#{hoe_debugging_ruby} #{hoe_debugging_make_test_cmd}" end desc "Run the test suite under Valgrind with memory-zero." task "test:valgrind:mem0" do sh "valgrind #{.join ' '} " + "--freelist-vol=100000000 --malloc-fill=00 --free-fill=00 " + "#{hoe_debugging_ruby} #{hoe_debugging_make_test_cmd}" end end |
#hoe_debugging_make_test_cmd ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/hoe/debugging.rb', line 41 def hoe_debugging_make_test_cmd cmd = [] if File.directory? "spec" cmd << "-S rspec" else cmd << make_test_cmd end cmd.join(' ') end |
#hoe_debugging_ruby ⇒ Object
36 37 38 39 |
# File 'lib/hoe/debugging.rb', line 36 def hoe_debugging_ruby # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/151376 @ruby ||= File.join(Config::CONFIG["bindir"], (Config::CONFIG["RUBY_INSTALL_NAME"] + Config::CONFIG["EXEEXT"])) end |
#initialize_debugging ⇒ Object
:nodoc:
27 28 29 30 31 32 33 34 |
# File 'lib/hoe/debugging.rb', line 27 def initialize_debugging #:nodoc: self. = [] self. = ["--num-callers=50", "--error-limit=no", "--partial-loads-ok=yes", "--undef-value-errors=no"] end |