bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.78k stars 480 forks source link

Executable being deleted or replaced prevents backtrace from being displayed #146

Closed forrestv closed 4 years ago

forrestv commented 5 years ago

Backward-cpp currently finds the path to the executable by calling readlink("/proc/self/exe"). /proc/self/exe is a special file that normally acts like a symlink, but when the executable it links to has been deleted or replaced, calling readlink on it returns the path to the original executable with the string " (deleted)" appended, which is obviously not a valid path, and prevents Backward-cpp from working as a result. However, in that case, directly opening /proc/self/exe still lets you access the original executable file!

Backward-cpp should be directly opening /proc/self/exe rather than the file it links to in order to function correctly when the executable has been deleted or replaced.

forrestv commented 5 years ago

See pull request #147 for a fix.

forrestv commented 4 years ago

PR #147 was merged. This should've been closed then, but wasn't.