Layout-Aware Diagnosis