Gdb seg character reading errors

When you try to start gdb using a program, it causes crashes when reading characters.

When I run:

gdb /home/user/path/to/program.exe

I get:

 GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/user/path/to/program.exe...Segmentation fault (core dumped) 

I suspect the binary may be too large to load gdb into memory. This error only occurs when compiling with -g (debug flag). Here is the difference in the size of the binaries:

Compiled with

-release flag: 405 MB

-debug flag: 862 MB

Any ideas on the other culprits for this segmentation error? Or is there a way to increase the memory allowed for gdb? This turns out to be a very difficult problem for google.

+6
source share
2 answers

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.

+2
source

I had the same issue with gdb 7.9 on Ubuntu 15.04 x86_64 , which I installed simply using apt-get install gdb .

I solved the problem by compiling and installing the previous version: gdb 7.5.1 .

I had to load the library (which I found out here ), and I also had to run ./configure with some arguments (which I found here ). Everything else is straightforward.

Good luck.

Here are the commands:

 $ cd $ sudo apt-get install libncurses5-dev $ wget ftp://sourceware.org/pub/gdb/releases/gdb-7.5.1.tar.gz $ tar zxf gdb-7.5.1.tar.gz $ cd gdb-7.5.1 $ sudo ./configure --disable-werror $ sudo make $ sudo make install 
+3
source

Source: https://habr.com/ru/post/970270/


All Articles