crash-watch 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRnnRBAAoJECrHRaUKISqMN28H/3ScjJga1Aqi/5EONbkGd9p0
6
- LN43oEbYL5Y1dhSfVK+bV9a5oGKFStTPmHcWkUontQjzHJMoT/LlcXd7QLYnfYga
7
- 7wWC/wv5ro9tybNQm20T2RLcGijkH2UHo5Cod8nolPcBf13IBlcuL2JjOsbS63Z5
8
- spGky9E43K0nVG61zHN5DVX8R1XhtI7yVZ9B77y3hNezpM0jac5LfVSUL/5+cz9O
9
- lpe3roWqAzSV8h2kKvm9297qMb0v8rVwxO4nqsgp9xsz3YiDppjLq1w6qdy/CZvc
10
- N78ijnXnJum7pG0muNoexTD/5Yvwa7Df8fLjEAj5GO9vJ7v31lMfaW9ZEar+XLE=
11
- =QiiL
5
+ iQEcBAABAgAGBQJRoN3dAAoJECrHRaUKISqMtOUH/R3vYMTrTqNcqd02b9UJPERb
6
+ G+kYMIND2e4zoGbsIUL+WcFohf3PphAyh0VQLW71T6e1k9O1mBNaleuU95ephruQ
7
+ gfzA/dzcKk3dHD7xQTRm1MKJZS5b/zCowq1DSw9oPYl60tcTDELzw6G6DF1Kgq10
8
+ Df8jXKzzbrRW/RQHbpAB1HItjTpXcy50FLiPGA1svMk4nUY0ssBtGX3yi0PDPGK3
9
+ Mn5YqbVx/Q+rgJ9kBIBtqrn2/BPRN8et7SgWoy1nebVJNipf+0lbTk7daqVT55cb
10
+ mNbNryT8oZFmC/1OICygSKT8aiwc7EsGptkXfRfO01Dfc5cTjgtEY/8VdF7ZUvU=
11
+ =4hv1
12
12
  -----END PGP SIGNATURE-----
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ MAINTAINER_EMAIL = "hongli@phusion.nl"
9
9
 
10
10
  desc "Run unit tests"
11
11
  task :test do
12
- ruby "-S spec -f s -c test/*_spec.rb"
12
+ ruby "-S rspec -f s -c test/*_spec.rb"
13
13
  end
14
14
 
15
15
  desc "Build, sign & upload gem"
@@ -42,14 +42,13 @@ elsif ARGV.size != 1
42
42
  exit 1
43
43
  end
44
44
 
45
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
45
46
  require 'crash_watch/gdb_controller'
46
- if !CrashWatch::GdbController.gdb_installed?
47
- abort "*** ERROR ***: 'gdb' isn't installed. Please install it first.\n" +
48
- " Debian/Ubuntu: sudo apt-get install gdb\n" +
49
- "RedHat/CentOS/Fedora: sudo yum install gdb\n" +
50
- " Mac OS X: please install the Developer Tools or XCode\n"
47
+ begin
48
+ gdb = CrashWatch::GdbController.new
49
+ rescue GdbWatch::Error => e
50
+ abort e.message
51
51
  end
52
- gdb = CrashWatch::GdbController.new
53
52
  begin
54
53
  gdb.debug = options[:debug]
55
54
 
@@ -1,6 +1,17 @@
1
1
  # encoding: binary
2
+ require 'rbconfig'
3
+
2
4
  module CrashWatch
3
5
 
6
+ class Error < StandardError
7
+ end
8
+
9
+ class GdbNotFound < Error
10
+ end
11
+
12
+ class GdbBroken < Error
13
+ end
14
+
4
15
  class GdbController
5
16
  class ExitInfo
6
17
  attr_reader :exit_code, :signal, :backtrace, :snapshot
@@ -20,19 +31,9 @@ class GdbController
20
31
  END_OF_RESPONSE_MARKER = '--------END_OF_RESPONSE--------'
21
32
 
22
33
  attr_accessor :debug
23
-
24
- def self.gdb_installed?
25
- ENV['PATH'].to_s.split(/:+/).each do |path|
26
- filename = "#{path}/gdb"
27
- if File.file?(filename) && File.executable?(filename)
28
- return true
29
- end
30
- end
31
- return false
32
- end
33
-
34
+
34
35
  def initialize
35
- @pid, @in, @out = popen_command("gdb", "-n", "-q")
36
+ @pid, @in, @out = popen_command(find_gdb, "-n", "-q")
36
37
  execute("set prompt ")
37
38
  end
38
39
 
@@ -264,6 +265,57 @@ private
264
265
  c.binmode
265
266
  return [pid, b, c]
266
267
  end
268
+
269
+ def find_gdb
270
+ result = nil
271
+ if ENV['GDB'] && File.executable?(ENV['GDB'])
272
+ result = ENV['GDB']
273
+ else
274
+ ENV['PATH'].to_s.split(/:+/).each do |path|
275
+ filename = "#{path}/gdb"
276
+ if File.file?(filename) && File.executable?(filename)
277
+ result = filename
278
+ break
279
+ end
280
+ end
281
+ end
282
+
283
+ puts "Found gdb at: #{result}" if result
284
+
285
+ config = defined?(RbConfig) ? RbConfig::CONFIG : Config::CONFIG
286
+ if config['target_os'] =~ /freebsd/ && result == "/usr/bin/gdb"
287
+ # /usr/bin/gdb on FreeBSD is broken:
288
+ # https://github.com/FooBarWidget/crash-watch/issues/1
289
+ # Look for a newer one that's installed from ports.
290
+ puts "#{result} is broken on FreeBSD. Looking for an alternative..."
291
+ result = nil
292
+ ["/usr/local/bin/gdb76", "/usr/local/bin/gdb66"].each do |candidate|
293
+ if File.executable?(candidate)
294
+ result = candidate
295
+ break
296
+ end
297
+ end
298
+
299
+ if result.nil?
300
+ raise GdbBroken,
301
+ "*** ERROR ***: '/usr/bin/gdb' is broken on FreeBSD. " +
302
+ "Please install the one from the devel/gdb port instead. " +
303
+ "If you want to use another gdb"
304
+ else
305
+ puts "Found gdb at: #{result}" if result
306
+ return result
307
+ end
308
+ elsif result.nil?
309
+ raise GdbNotFound,
310
+ "*** ERROR ***: 'gdb' isn't installed. Please install it first.\n" +
311
+ " Debian/Ubuntu: sudo apt-get install gdb\n" +
312
+ "RedHat/CentOS/Fedora: sudo yum install gdb\n" +
313
+ " Mac OS X: please install the Developer Tools or XCode\n" +
314
+ " FreeBSD: use the devel/gdb port\n"
315
+ else
316
+ return result
317
+ end
318
+ end
267
319
  end
268
320
 
269
321
  end
@@ -1,3 +1,3 @@
1
1
  module CrashWatch
2
- VERSION_STRING = '1.1.8'
2
+ VERSION_STRING = '1.1.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crash-watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-23 00:00:00.000000000 Z
12
+ date: 2013-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRnnRBAAoJECrHRaUKISqM2kAIAJuFG1kFUVcJ4e34c+lshduf
6
- Ntb3Urm5ygDBYUGM8BaW/9W9ncpIyrlB2QFZl/T4RHTCaseQ/gYAQ37xOKoN9aZf
7
- 8FIpmpL980nbixThjZmEVnMQDCM8GICW8loHtSDmY++vcnyxmMeSTZQMSIis+8SR
8
- ko5HoG2bAoyVaqFlkDvw871Qyz9yDqvVX5OQ5cqgzdfi6tGszwB9FvEOwK2W6Wkt
9
- D95hfBqrH6JQrRD3+9nZjcnNcHvCnEhvGZtRQyrUs9gk4mRtZXXPOWmQuoalbiL5
10
- m1uEy7eyF8qM2e/PCsiJgTwgVSl+MG+NVixsDkcBx14HuwzWaBCAMDrA2is8OG8=
11
- =R2yM
5
+ iQEcBAABAgAGBQJRoN3dAAoJECrHRaUKISqMrRAH/0UTheexryuP9bNSJUEwzhra
6
+ AONBxRrOkHS+LCVIhCMQuoGUearG+m1gFUAP3DCtqUtWC+0MAy6/8U+ncxvr7bwk
7
+ /qqksKofHQPNCzuixjy7tY+uY4Dg/llXZd0PnzI2N/o8/N7epX8cud7Sw4/FUCS6
8
+ Eia8sIu6LjvxVeWiX9dOepkTZGikmBhiE0m/LsTpeKPxs5qMq3ZSuNub0vqDNjhD
9
+ n0SSOMTiFRWAnsmV3ldDLicoY9pB25eSYWshgbwBPky+rhsk4EO6EMFiwc1KsH6C
10
+ vtgb5OCAFmEMpgITae8YMFcKQTZ/Jn6AznYMlQiY5Uh7cQdjpmX9HQJzrwfhDgo=
11
+ =IW9j
12
12
  -----END PGP SIGNATURE-----