this is why im glad i never got to have a child with my ex-wife.
for some detail, i'll share what i would do if i had one.
i would make sure my child will have some level of financial comfort before i leave because i know how shitty it is to not have much money during a young and adult age. money IS the most important thing to have in this world to live comfortably so saving a decent amount will help him have some cushion to fall back on.
Eventually i'd talk about the topic of suicide in an objective manner without placing shame in the idea, and not in way that makes it a selfish choice like so many express it as. this is to allow him to understand to an extent what will happen when someone leaves.
important points to be shared with my child and more. ensuring he's as ready as he can be, then i'd kill myself.
whatever your reason was for having a child, it's too late now for regrets or whatever else. just be fully aware that there is now a child alive in front of you who never chose to be born in the first place.
with that said, it will ALWAYS be your choice to leave or stay even with a child, because everything after the fact will mean nothing since you're dead. you're still a human being whom experiences suffering and acting upon it to relieve yourself is not wrong. you have the right of it, because you're the one suffering. having a child doesn't take that away. now whether it's going to be an easy or difficult thing to do is a different story.
but since you asked for advice, above is my short take on it. i don't know if you legitimately care about your child's situation or you're asking for other unknown reasons. if you really do care, help him get situated for a while, then leave if you still want to. you WILL be miserable and you WILL struggle. something you will have to accept until then.
whatever you do, just be aware of the facts. good luck.