This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ben@ruby-build-box-3 ~]$ cat gdb.txt | |
Thread 5 (Thread 0x7f32595a4700 (LWP 12251)): | |
#0 0x00007f32611de5bc in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 | |
#1 0x0000000000637b95 in wait (this=0x210bb20, state=0x7f32595a3dc0) at /tmp/ruby-build.20140805092211.19382/rubinius-2.2.10/vm/util/thread.hpp:431 | |
#2 rubinius::SignalHandler::perform (this=0x210bb20, state=0x7f32595a3dc0) at vm/signal.cpp:184 | |
#3 0x0000000000637e1c in rubinius::signal_handler_tramp (state=<value optimized out>) at vm/signal.cpp:47 | |
#4 0x00000000006c7842 in rubinius::Thread::in_new_thread (ptr=0x210bd70) at vm/builtin/thread.cpp:259 | |
#5 0x00007f32611da9d1 in start_thread () from /lib64/libpthread.so.0 | |
#6 0x00007f3260787b5d in clone () from /lib64/libc.so.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'socket' | |
require 'resolv' | |
require 'resolv-replace' | |
puts "Run this to trace getaddrinfo calls:" | |
puts "sudo dtrace -p #{$$} -n 'pid$target::getaddrinfo:entry { ustack(); }'" | |
loop do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'newrelic_rpm' | |
def do_something | |
puts 'working!' | |
sleep(3) | |
end | |
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'thread' | |
require 'rubygems' | |
require 'monitor' | |
class Dummy | |
include MonitorMixin | |
def sync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
t0 = Time.now | |
GC::Profiler.enable | |
100000.times do | |
String.new('a' * 1000) | |
end | |
gc_time = GC::Profiler.total_time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "Run this in another terminal:" | |
puts "" | |
puts " sudo ./trace-gc-standalone.sh #{$$}" | |
puts "" | |
puts "... wait for the 'Ready!' message, switch back here and press enter to start." | |
GC::Profiler.enable | |
$stdin.gets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def foo | |
puts "foo from A" | |
end | |
end | |
class B | |
include A | |
def foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class BadString < String; end | |
original = (0..255).to_a.pack("C*").force_encoding("UTF-8") | |
subclass = BadString.new(original) | |
round_tripped = subclass.to_s | |
puts "encoding: original = #{original.encoding}, subclass = #{subclass.encoding}, round_tripped = #{round_tripped.encoding}" | |
puts "valid_encoding? original = #{original.valid_encoding?}, subclass = #{subclass.valid_encoding?}, round_tripped = #{round_tripped.valid_encoding?}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
string = "\n\v" | |
puts "before racc require: #{Array(string).inspect}" | |
require 'racc' | |
puts "after racc require: #{Array(string).inspect}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) t a a bt | |
Thread 5 (process 11796): | |
#0 0x00000001003d8e4f in llvm::SelectionDAG::getFrameIndex () | |
#1 0x000000010027d55b in (anonymous namespace)::X86DAGToDAGISel::getAddressOperands () | |
#2 0x000000010027da18 in (anonymous namespace)::X86DAGToDAGISel::SelectAddr () | |
#3 0x000000010027a78c in (anonymous namespace)::X86DAGToDAGISel::CheckComplexPattern () | |
#4 0x000000010043994c in llvm::SelectionDAGISel::SelectCodeCommon () | |
#5 0x0000000100274536 in (anonymous namespace)::X86DAGToDAGISel::Select () | |
#6 0x000000010043bc41 in llvm::SelectionDAGISel::DoInstructionSelection () |