I'm starting this thread to answer the question opened here:
http://www.keil.com/forum/13796/ http://www.keil.com/forum/17900/
To solve the problem of the endless loop in the dbg_task_notify() in the os_sys_init() use configuration file C:\Keil\ARM\Startup\ST\STM32DBG.ini Add it in "Target Options" - "Debug" - "Initialization file", edit it and set a tick on 'TRACE_IOEN' on "Configuration Wizard" tab.
Do not forget to enable ITM in "Target Options" - "Debug" - "Settings" - "Trace" - "ITM Stimulus Ports" - "0" too.