target/cortex_m.c: vector_catch command checks if a target is examined
[fw/openocd] / src / target / cortex_m.c
index e52332dd620dfdfcc32185dc561a4f96dd3805bf..55664a79a75437b67625cf8d4a893468436610af 100644 (file)
@@ -2502,6 +2502,11 @@ COMMAND_HANDLER(handle_cortex_m_vector_catch_command)
        if (retval != ERROR_OK)
                return retval;
 
+       if (!target_was_examined(target)) {
+               LOG_ERROR("Target not examined yet");
+               return ERROR_FAIL;
+       }
+
        retval = mem_ap_read_atomic_u32(armv7m->debug_ap, DCB_DEMCR, &demcr);
        if (retval != ERROR_OK)
                return retval;