--------------040407030304030600010102
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Moin.

Currently tracer.rb tries to extract the source code of binary 
extensions (e.g. socket.so) and will display it to STDIN. That does not 
make much sense IMHO.

The following patch uses these mechanisms for detecting whether a line 
from a file is binary code and should be ignored:

1) File ext is .so, .o, .dll, .lib or .bundle (case insensitive) or
2) File ext is a DLEXTs defined in rbconfig (case insensitive) or
3) Line is longer than 399 characters and contains at least one ASCII 
control character (code < 32 and not carriage return or newline).

Regards,
Florian Gross

--------------040407030304030600010102
Content-Type: text/plain;
 nameracer-binary.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filenameracer-binary.patch"

--- tracer.rb.original	2005-01-15 11:44:28.000000000 +0100
+++ tracer.rb	2005-01-15 11:49:18.000000000 +0100
@@ -79,13 +79,26 @@
   def set_get_line_procs(file, p  roc)
     @get_line_procs[file]  
   end
+
+  def binary_suffix?(filename)
+    exts  w(.so .o .dll .lib .bundle)
+    require 'rbconfig'
+    Config::CONFIG.keys.grep(/^DLEXT\d+$/).each do |key|
+      exts << "." + Config::CONFIG[key].downcase
+    end
+  ensure
+    return exts.include?(File.extname(filename).downcase)
+  end
+  private :binary_suffix?
   
   def get_line(file, line)
     if p  get_line_procs[file]
       return p.call(line)
     end
 
-    unless list  CRIPT_LINES__[file]
+    binary_re  [\x00-\x09\x0B\x0C\x0E-\x1F]/
+
+    if not list  CRIPT_LINES__[file] and not binary_suffix?(file)
       begin
 	f  pen(file)
 	begin 
@@ -97,7 +110,9 @@
 	SCRIPT_LINES__[file]  ist  ]
       end
     end
-    if l  ist[line - 1]
+    if list and l  ist[line - 1] and
+      (l.size < 400 or not binary_re.match(l))
+    then
       l
     else
       "-\n"

--------------040407030304030600010102--