Make backtrace script a bit more generic