All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The established rule that will answer your question according to the scholars is that in principle if it is possible for something to take place in two different times, then it is attributed to the nearest time to it.
As-Suyooti said in his book Al-Ashbaah wa An-Nathaa’ir: "The general rule is attributing an incident to the most recent time." [End of quote]
Hence, a woman estimates the occurrence of menses to the time when she wakes up. The same thing applies when she doubts her purity from menses. So, if she sleep while she is pure, and then wakes up and finds that she is in menses, then the menstruation is considered to have happened when she woke up. If the time of a prayer expired while she was asleep, then she must make up the prayer after she becomes pure.
On the other hand, if she sleeps while she is in menses and then wakes up and notices that she is pure, then she estimates that this (purity) happened at the time of waking up. Therefore, she does not have to make up the prayers whose time expired whilst she was sleeping.
Allah knows best.