Australia have clung on for a valiant draw in the first Test against Pakistan, grinding out a record-breaking day-five fightback in Dubai led by Usman Khawaja.