new file mode 100644
@@ -0,0 +1,110 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+
+#define NUM_THREADS 2
+#define TIMEOUT 5
+
+const int num_threads = NUM_THREADS;
+pthread_t child_thread[NUM_THREADS];
+volatile pthread_t signal_thread;
+volatile int run = 1;
+
+void
+handler (int signo)
+{
+ run = 0;
+}
+
+/* Align the instruction on a 2 byte boundary
+ Missalign it with a 4 byte boundary. */
+#define THUMB2_INST \
+ asm (" .align 4 \n" \
+ " nop\n" \
+ " nop.w\n" \
+ ) \
+
+#define ITBLOCK \
+ asm (" .align 4 \n" \
+ " nop\n" \
+ " cmp r0, #0\n" \
+ " ite eq\n" \
+ " nop.w \n" \
+ " nop.w \n" \
+ ) \
+
+#define LOOP(macro) \
+ while (run) \
+ { \
+ macro; \
+ } \
+
+void out_of_loop ()
+{
+ return;
+}
+
+void *
+thumb2_function (void *arg)
+{
+ LOOP (THUMB2_INST); /* break thumb2 */
+ out_of_loop ();
+ pthread_exit (NULL);
+}
+
+void *
+itblock_function (void *arg)
+{
+ LOOP (ITBLOCK); /* break itblock */
+ out_of_loop ();
+ pthread_exit (NULL);
+}
+
+int
+main (void)
+{
+ int res;
+ int i, j;
+ void *(*functions[2]) (void *);
+
+ functions[0] = thumb2_function;
+ functions[1] = itblock_function;
+
+ signal (SIGALRM, handler);
+
+ for (i = 0; i < 2; i++)
+ {
+ alarm (TIMEOUT);
+
+ for (j = 0; j < NUM_THREADS; j++)
+ {
+ res = pthread_create (&child_thread[j], NULL, functions[i], NULL);
+ }
+
+ for (j = 0; j < NUM_THREADS; j++)
+ {
+ res = pthread_join (child_thread[j], NULL);
+ }
+
+ run = 1;
+ }
+ exit(EXIT_SUCCESS);
+}
new file mode 100644
@@ -0,0 +1,42 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile
+set executable ${testfile}
+
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "failed to compile"
+ return -1
+}
+
+clean_restart $executable
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test_no_output "set scheduler-locking off"
+
+
+# Test each instruction type, thumb2 is a plain 2 byte aligned but not 4
+# byte aligned thumb2 instruction. itblock is the same but in an itblock.
+foreach_with_prefix inst { "thumb2" "itblock" } {
+ gdb_breakpoint [gdb_get_line_number "break $inst"]
+ gdb_continue_to_breakpoint "break thumb2" ".* break $inst .*"
+ delete_breakpoints
+# gdb_breakpoint "out_of_loop"
+ gdb_test "step" ".*out_of_loop.*" "stepping $inst"
+ # delete_breakpoints
+}