It is a distinct possibility that you are suffering from the lack of meaningful personal achievements in your vocation of choice, which your subconsciousness recently began to realize and which is why it started poking you to do something about it. Normally, this sort of things starts to happen exactly in one's 30s.
Here's a thing that many (if not most) people working in IT don't realize. Practical software development is actually a creative profession. It's not pure science, it's not plain engineering (even if it has the elements of both), it's mostly a design discipline where outcome directly correlates with the skills and the personality of the human(s) involved. People who enter this field are often enthusiasts, tinkerers, inventors, in a sense artists. They like to create things with their own hands, things that do something interesting, meaningful and useful, and when they succeed then they get happy all around and their life becomes full of meaning and purpose. It happens to be true for most creative professions, you cannot just practice it as a routine, as a job, it has to be giving your life a meaning and the sense of accomplishment.
However, doing software development as a job does not help you advance on that path. You may have had a formally successful career, as you say you started as a simple programmer, moved up and eventually you reached a leadership position, but apparently that did not fill your life with meaning. I have no doubt that in your time you've completed multiple projects, implemented numerous features, solved important problems of your customers and so on. But the trouble is, those were all someone else's goals and other people's objectives. Despite that in the process you probably contributed many useful ideas and had personal input which directed and influenced the work, you only did the bidding of others. You solved the problems and built the things with which you cannot personally identify. Now you look back at your career and you recognize that for a lot of effort you've put in you have no tangible achievements made by your hands that you can be proud of. You need to see something for the work of your life, your legacy if you will, something to leave for the posterity, for the world, but you see nothing of that sort. And that's the root of the problem.
Here's what you say:
>> It just seems meaningless to continue working.
>> Life has seemed to lost meaning and interest.
It feels like yours is exactly the kind of problem I'm talking about. I might of course be wrong about you, this is not the ultimate diagnosis of any kind, but from what little information you've given us, I think this might be it. It would be helpful if you gave us more context and more details about your situation, otherwise it's not easy to figure out what you're going through.
As to what might be the remedy, it all depends. If you really love software engineering and feel it's your calling in life, then you should start looking for ways to use your skills and competences to do something that in your mind would be meaningful. It might be a side project or even a small startup of your own. You have not mentioned any of those therefore I assume you have none. You might consider one now. But it must not be a dummy project to simply have a project of your own or to dive into a new technology to have a sense of novelty. Those won't help. It's not about tools or the process (both of which you've mastered), it's all about the personal achievements (which you supposedly lack). You should think of something which would contribute in some useful way to the society, to solving real problems of real people, to making their lives easier, not about adding more forms and more rules to some boring enterprise software or fixing bugs in some opensource project. You need to go higher and it must be all yours, the entire pie not just some crumbs of it.
You may also want to explore another career path. If you have an inclination towards some other line of work, perhaps design or photography, you may consider giving it a go as an experiment and seeing how it works out for you. Personally, I've discovered that writing provides a quality diversion for me and is turning into a real passion. You too may have some buried talents which might benefit from your technical background. It's possible to use your knowledge of software engineering to give a major boost to your other abilities and make a difference on that alternative path.
I hope this helps you in your search for answers. Of course I might be mistaken about your condition and there might be something else that is happening with you. You are well advised to seek counselling assistance to help you out of the woods. Good luck and hold on. Don't take any radical actions before figuring out exactly what's been going on with you, or you may acquire additional troubles to your misfortune. Wait till the sky clears and only then begin considering where to go next.