I have a web server written in C++. Everything works fine, but sometimes it will cause segmentation fault 11. I guess there is a null pointer being dereferenced. But unlike Golang, there will be no stack trace being printed out. It's a little hard to get the exact position just reading the code. So how could I get the exact position of where the dereferencing happened?
Someone notice that I can use debugger. Sure I know that, but in production mode, it's hard to simulate all kinds of input created by users. And sometimes, the application runs for several days and this crash happens. How could I use debugger for this? And what I want is how other companies handle such kind of problem with C++?
What I mean is to write the information into log file like this in Golang:
goroutine 1 [running]:
main.causedPanic(...)
/Users/me/awesomeProject/main.go:13
main.run(...)
/Users/me/awesomeProject/main.go:7
main.main()
/Users/me/awesomeProject/main.go:4 +0x2
Aucun commentaire:
Enregistrer un commentaire