4 Dallas police officers have been killed and 7 wounded by sniper fire during protests against the shooting of black men by police.