Because there is no sure way to tell if you are in a state of grace (even after Confession) the best thing to do when you are in a state of mortal sin is the pray that God won't abandon you in sin and that He will give you the grace of a good confession and a perfect (or imperfect) contrition.
Hmmm.. My understanding is that the the sacrament of confession, through the priest, makes the contrition perfect, even though the penitent's contrition would otherwise be imperfect. So unless you knowingly made a bad confession (omitted some sins, did not intend to complete your penance, etc) you would almost assuredly be in a state of grace.
Perhaps I'm missing something Vlad?