Diagnosis of gastrointestinal perforation often involves imaging studies such as an abdominal X-ray or CT scan. These can reveal free air under the diaphragm, indicating a perforation. Blood tests may show elevated white blood cell counts, indicative of infection or inflammation.