backtracer 0.5.2 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.6.1
data/lib/backtracer.rb CHANGED
@@ -1,16 +1,20 @@
1
1
  # this one display full BT with code, at the end [no performance loss]
2
2
  require 'rbconfig'
3
- WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/
3
+ DOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/
4
4
 
5
5
  require File.dirname(__FILE__) + "/shared"
6
6
 
7
7
  at_exit {
8
8
  if $! && !$!.is_a?(SystemExit) # SystemExit's are normal, not exceptional
9
- puts "\n " + $!.inspect + ' ' + $!.to_s
10
- bt2 = $!.backtrace
9
+ print "\n\t" unless defined?($same_line)
10
+ puts $!.inspect + ' ' + $!.to_s
11
+
12
+ max = 0
13
+ $!.backtrace.each{|bt_line| max = [bt_line.length, max].max}
14
+
11
15
  backtrace_with_code = $!.backtrace.map{ |bt_line|
12
16
  next if bt_line.include? 'bin/backtracer' # binary lines...
13
- if WINDOZE && bt_line[1..1] == ':'
17
+ if DOZE && bt_line[1..1] == ':'
14
18
 
15
19
  drive, file, line, junk = bt_line.split(":")
16
20
  #["C", "/dev/ruby/allgems/lib/allgems/GemWorker.rb", "91", "in `unpack'"]
@@ -20,11 +24,13 @@ at_exit {
20
24
  end
21
25
  line = line.to_i
22
26
  actual_line = Tracer.get_line(file, line)
23
-
24
- "#{bt_line}\n\t#{actual_line.strip if actual_line}"
27
+
28
+ "%-#{max + 1}s #{"\n\t" unless defined?($same_line)}%s" % [bt_line, (actual_line.strip if actual_line)]
25
29
  }.compact
26
30
  puts backtrace_with_code
27
- $!.set_backtrace [] # avoid the original backtrace
31
+ puts # blank line
32
+ $!.set_backtrace [] # avoid the original backtrace being outputted--though annoyingly it does still output its #to_s...
33
+
28
34
  else
29
35
  puts "(backtracer: no exception found to backtrace)" if $VERBOSE
30
36
  end
@@ -0,0 +1,7 @@
1
+ # this one display full BT with code, at the end [no performance loss]
2
+ require 'rbconfig'
3
+ WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/
4
+ $same_line = true
5
+
6
+ require File.dirname(__FILE__) + "/shared"
7
+ require File.dirname(__FILE__) + "/backtracer.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backtracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-13 00:00:00 -07:00
12
+ date: 2009-11-19 00:00:00 -07:00
13
13
  default_executable: backtracer
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,7 @@ files:
44
44
  - examples/run_large_style_output.rb
45
45
  - lib/backtracer.rb
46
46
  - lib/backtracer_ctrl_c_debugger.rb
47
+ - lib/backtracer_inline.rb
47
48
  - lib/backtracer_locals.rb
48
49
  - lib/backtracer_pinger.rb
49
50
  - lib/backtracer_simple.rb