aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/bin/backtrace
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2009-10-18 20:01:19 +0000
committerN.N. <matju@users.sourceforge.net>2009-10-18 20:01:19 +0000
commitccddec68116fc6403858ebfa13d4a7b1aa3d5278 (patch)
tree6b90e41b15bbf2440afa76d53cc436debf5b5c5b /externals/gridflow/bin/backtrace
parenta1fb215b39535805aa19608185d5e52c0f524b42 (diff)
hi gridflow 0.9.5
svn path=/trunk/; revision=12611
Diffstat (limited to 'externals/gridflow/bin/backtrace')
-rwxr-xr-xexternals/gridflow/bin/backtrace18
1 files changed, 18 insertions, 0 deletions
diff --git a/externals/gridflow/bin/backtrace b/externals/gridflow/bin/backtrace
new file mode 100755
index 00000000..ac1358af
--- /dev/null
+++ b/externals/gridflow/bin/backtrace
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+if ARGV.length != 1
+ puts "usage: core.rb <corefile>"
+ exit 1
+end
+qfile=ARGV[0].gsub /'/, "\\\\'"
+x=`gdb --batch -c '#{qfile}'`.split"\n"
+m=/`([^']+)/.match x[0]
+f=File.open("/tmp/backtrace_#{$$}.gdb","w")
+f.puts"bt"
+f.puts"quit"
+f.close
+cmd="gdb #{m[1]} #{qfile} --command=/tmp/backtrace_#{$$}.gdb"
+x=`#{cmd}`.split("\n")
+i=nil
+x.each_with_index {|line,i| break if /^#0/ =~ line }
+x[0..i]=[]
+puts x