If you compile without the -g flag, you do not include debugging information in your executable, so when gdb loads much less information to load there.
If gdb segfaults during startup, then this is a gdb error, there is no executable file that you could pass to gdb that should call segfault, in the worst case you should get an error message.
You can try running gdb under gdb (just do gdb --args gdb /home/user/path/to/program.exe ), this will not help you, but it can give some idea of ββwhat is wrong with gdb, you could would then load the gdb error here: https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb , but this is only worth doing if you have good steps to play or backtrack from broken gdb.
Reinstalling gdb may help, but I will not hope so unless you change the version of gdb that you are installing, gdb itself is a fairly simple program to install, so itβs rather difficult to make a mistake.
You can also try creating gdb from git, it is quite simple, and the error may have already been fixed, start here: http://www.gnu.org/software/gdb/current/
If you extend your question using backtrace from broken gdb, others may be able to offer you more information on why this is crashing, but your version of gdb is certainly to blame.
source share