diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e6d7020..b8ea173b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,10 +210,14 @@ add_subdirectory(tools/crash) configure_file(scripts/mcreboot-smp.sh.in mcreboot.sh @ONLY) configure_file(scripts/mcstop+release-smp.sh.in mcstop+release.sh @ONLY) configure_file(scripts/mcreboot.1in mcreboot.1 @ONLY) +configure_file(scripts/eclair-dump-backtrace.exp.in eclair-dump-backtrace.exp @ONLY) install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/mcreboot.sh" "${CMAKE_CURRENT_BINARY_DIR}/mcstop+release.sh" DESTINATION "${CMAKE_INSTALL_SBINDIR}") +install(PROGRAMS + "${CMAKE_CURRENT_BINARY_DIR}/eclair-dump-backtrace.exp" + DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES "scripts/irqbalance_mck.in" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mcreboot.1" diff --git a/scripts/eclair-dump-backtrace.exp.in b/scripts/eclair-dump-backtrace.exp.in new file mode 100755 index 00000000..9b8adc57 --- /dev/null +++ b/scripts/eclair-dump-backtrace.exp.in @@ -0,0 +1,96 @@ +#!/usr/bin/expect + +set INST_DIR "@prefix@" + +spawn $INST_DIR/bin/eclair -k $INST_DIR/smp-@ARCH@/kernel/mckernel.img -i -l + +set state "init" +set thread_id 0 +set timeout -1 + +expect { + "Quit anyway? (y or n) " { + send "y\r" + wait + exit 0 + } + "Unknown thread*" { + send "quit\r" + exp_continue + } + "in ?? ()" { + switch -- $state { + "thread_chosen" { + set state "thread_skip" + } + "thread_bt" { + set state "thread_skip" + } + } + + exp_continue + } + "(eclair) " { + switch -- $state { + "init" { + set state "threads_list" + send "info threads\r" + } + "threads_list" { + incr thread_id + set state "thread_chosen" + send "thread $thread_id\r" + } + "thread_bt" { + incr thread_id + set state "thread_chosen" + send "thread $thread_id\r" + } + "thread_skip" { + incr thread_id + set state "thread_chosen" + send "thread $thread_id\r" + } + "thread_chosen" { + set state "thread_bt" + send "bt\r" + } + } + + exp_continue + } + "Type for more, q to quit, c to continue without paging--" { + switch -- $state { + "threads_list" { + send "\r" + } + "thread_bt" { + send "q\r" + } + "thread_skip" { + send "q\r" + } + } + exp_continue + } + "Type to continue, or q to quit" { + switch -- $state { + "threads_list" { + send "\r" + } + "thread_bt" { + send "\r" + } + "thread_skip" { + send "q\r" + } + } + exp_continue + } + " not known." { + expect "(eclair) " { send "quit\r" } + expect "Quit anyway? (y or n) " { send "y\r" } + exit 0 + } +} +