Militants in Saudi Arabia have attacked the U.S. Consulate in the port city of Jeddah with machine guns and explosives .