]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
osx: decode-panic should work in add-kext only land
authorDerrick Brashear <shadow@dementia.org>
Thu, 17 Mar 2011 05:25:35 +0000 (01:25 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 21 Mar 2011 18:35:38 +0000 (11:35 -0700)
in 64 bit 10.6, you need add-kext (not add-symbol-file)
to decode a panic. deal accordingly

Reviewed-on: http://gerrit.openafs.org/4255
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit c4744cc699be19fffb49f39f469e91ef6aac6585)

Change-Id: I3de2c4799ff1a552e67d4398b76e8736ba2abf7e
Reviewed-on: http://gerrit.openafs.org/4268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/packaging/MacOS/decode-panic

index 41c94474a3ec96480e0a3d22012b38a71535263d..8a02330819fd0ad68877d4100dc293bc46f2e941 100755 (executable)
@@ -31,7 +31,7 @@ my $temp_dir   = tempdir( "afsdebugXXXXXX", DIR => File::Spec->tmpdir,
                          TMPDIR => 1, CLEANUP => 1 );
 my $dump_file  = "/var/db/openafs/logs/crash.dump";
 my $kernel = "/mach_kernel";
-my $kextpath = "/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.kext/";
+my $kextpath = "/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.kext";
 
 my $option_quiet;
 my $option_verbose;
@@ -120,8 +120,20 @@ generate_symbol_files( $crash_info{"afs_kernel_address"}, $temp_dir, $kextarch ,
 
 write_gdb_input_file( $temp_dir, $gdb_file, $crash_info{ "backtrace" } );
 
+# needed so we can put the sym file where the kext is. ick.
+if ($kextprog eq $kextutil) {
+    `cp -R $kextpath $temp_dir`;
+}
+
 if ($option_verbose) {
     print "$gdb $gdbarch $kernel -batch -x $temp_dir/$gdb_file\n";
+    my $gdbi_fh = IO::File->new( $temp_dir . "/" . $gdb_file, '<' )
+        or croak "Can't open backtrace file $gdb_file: $OS_ERROR\n";
+    while (my $line = <$gdbi_fh> ) {
+       print $line;
+    }
+    $gdbi_fh->close()
+        or croak "Can't close file $gdb_file: $OS_ERROR\n";
 }
 my $gdb_output = `$gdb $gdbarch $kernel -batch -x $temp_dir/$gdb_file`;
 croak "gdb failed!\n" if $CHILD_ERROR;
@@ -394,8 +406,12 @@ sub write_gdb_input_file {
     my $fh = IO::File->new( $write_dir . "/" . $filename, '>' )
         or croak "Can't open gdb file $filename for writing: $OS_ERROR\n";
 
-    for my $symbol ( @symbol_files ) {
-        print $fh "add-symbol-file $symbol\n";
+    if ($kextprog eq $kextutil) {
+           print $fh "add-kext " . $write_dir . "/afs.kext\n";
+    } else {
+       for my $symbol ( @symbol_files ) {
+           print $fh "add-symbol-file $symbol\n";
+       }
     }
     
     print $fh "set print asm-demangle on\n";