Missing separate debuginfos - c++

I am debugging a coredump file from the production environment(two environment, not the same), I input "gdb [programe name] core.xxx then bt" but it hint like the title and pic below:
enter image description here
There are question masks at the top of the stack and I can't find where the Segmentation fault generated
Kernel Version: enter image description here
Linux Version: enter image description here
System compiled from executable file:enter image description here
(Note :Source code and executable program are not in the same system)
I want to find a way to know where did the segment error occur, I'd appreciate it if you could help me !
I have installed some missing rpm libraries according to the prompts but still not work:
glibc-debuginfo-2.17-326.el7_9.x86_64.rpm
libgcc-4.8.5-44.el7.i686.rpm
ncurses-libs-5.9-14.20130511.el7_4.i686.rpm
libstdc++-4.8.5-44.el7.i686.rpm
kernel-debug-debuginfo-3.10.0-1160.el7.x86_64.rpm
kernel-debuginfo-common-x86_64-3.10.0-1160.el7.x86_64.rpm

My OS CentOS 7.9
Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 libconfig-1.4.9-5.el7.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64
You need to modify the enable=1 of the "/etc/yum.repos.d/CentOS-Debuginfo.repo" file first
Use sudo yum install glibc to install
yum install yum-utils
Use debuginfo-install glibc-2.17-326.el7_9.x86_64 to install.
Hope this help.

Related

Having problems with gdb [duplicate]

How can I include/view the source code of malloc in gdb?
I want to do a step by step execution in gdb, and step into malloc.c source code when any of the malloc functions is called.
Currently what gdb says is:
malloc.c: No such file or directory.
This guy here faced the same problem, but they do not mention a solution, ie how to actually step into the source code of malloc.
I am on Ubuntu server 14.04, and I have already tried to install the following:
libc6-dbg, libc6-dev, and libc6-dbgsym.
I don't even know if one of these packages might help, but installing the libc-dbgsym gives me the following error:
dpkg: error processing archive /var/cache/apt/archives/libc6-dbgsym_2.19-0ubuntu6.6_amd64.ddeb (--unpack): trying to overwrite
'/usr/lib/debug/usr/lib/x86_64-linux-gnu/audit/sotruss-lib.so', which
is also in package libc6-dbg:amd64 2.19-0ubuntu6.6 dpkg-deb: error:
subprocess paste was killed by signal (Broken pipe)
The following worked for me. Not sure whether there is a better way.
Install libc6-dbg (which you have already done):
sudo apt-get install libc6-dbg
Install the eglibc-source package (ubuntu actually uses eglibc): sudo apt-get install eglibc-source.
Unpack the tar file that was installed in /usr/src/glibc: /usr/src/glibc $ sudo tar xvf eglibc-2.19.tar.xz
Crank up gdb and add in the path to the malloc source: (gdb) dir /usr/src/glibc/eglibc-2.19/malloc
(gdb) n
13 char *c = malloc(100);
(gdb) s
__GI___libc_malloc (bytes=100) at malloc.c:2876 2876
{
(gdb)
Gdb can only show the source codes because the debug-compiled binaries contain references between the binary code and the source files.
malloc() is in the C library. On normal systems, it is not compiled with debug metadata, and its sources are also not installed in the system.
But they are reachable, you only need to install the debug versions of these libraries. For example, on debian an apt-get install glibc-debug or similar will do it. On SuSE, a zipper in libc6-debug (afaik, maybe the exact package names could be a little bit differ).

GDB complaining about missing raise.c

I'm getting an an annoying error every time gdb catches an exception.
I've run the following example program
#include <stdexcept>
int main() {
throw std::invalid_argument("");
return 0;
}
And the result from running gdb is
terminate called after throwing an instance of 'std::invalid_argument'
what():
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig#entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
It's not all that bad, as I do get the information I need, it's just bugging me...
Do anyone know how to fix this?
To do full source code debugging of the C library on Ubuntu, there are just a few steps to take:
Install the debuginfo version of libc6.
It's probably already installed - the gdb package on Ubuntu has a dependency on it - but in case it isn't, run sudo apt install libc6-dbg.
Prepare the package system to download and process source code packages, if this hasn't previously been done.
sudo apt install dpkg-dev
grep deb-src /etc/apt/sources.list
Grep's output should show (and there may be additional matches that we don't need to worry about):
deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
If the grep shows that these deb-src lines are commented out with #:
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
then edit /etc/apt/sources.list to remove the # at the beginning of these lines and then run sudo apt update .
Download the source code corresponding to the installed version of the C library.
First, create a directory anywhere - I'll use /opt/src here.
Then do the following:
cd /opt/src
apt source libc6
If the apt command gives an error message like
E: You must put some 'source' URIs in your sources.list
then my instructions in step 2 may have become outdated; post a comment here.
When the download is complete, run this:
find $PWD -maxdepth 1 -type d -name 'glibc*'
Remember this name - it'll be something like /opt/src/glibc-2.23
Determine where gdb expects to find the source code and make appropriate adjustments.
Run gdb, have it run your program until it stops, and at the gdb prompt do this:
(gdb) info source
Current source file is ../sysdeps/unix/sysv/linux/raise.c
Compilation directory is /build/glibc-KM3i_a/glibc-2.23/signal
So gdb is expecting the source code to be in /build/glibc-KM3i_a/glibc-2.23 . There are two ways to fix this:
Move (or use a symlink) so that the source code is (or appears to be) in /build/glibc-KM3i_a/glibc-2.23 .
or
Tell gdb how to substitute the correct source directory pathname:
(gdb) set substitute-path /build/glibc-KM3i_a/glibc-2.23 /opt/src/glibc-2.23
Now, go back to your frame, and gdb should show the source code line:
(gdb) frame 1
#1 0xb7e2fea9 in __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:54
return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);

ERROR: Failed to build PhantomJS! Building Qt Base failed

I have Debian Linux(64-bit) in VirtualBox.
Ram: 8Gb (for Debian 4Gb)
CPU: i5-3470
If any other details are needed please tell me.
I have followed instructions written here, and here you can see the console log.
For some reason I am unable to to build phantomjs and I can't understand why its not working... Have searched a lot, but couldn't find any thread which would be about this error.
--- EDIT ---
When I executed this command:
./configure --with-openssl-includes=/usr/include/openssl-1.0/ --with-openssl-libraries=/usr/lib/openssl-1.0/
Output was this:
--with-openssl-includes=/usr/include/openssl-1.0/: invalid command-line switch
--with-openssl-libraries=/usr/lib/openssl-1.0/: invalid command-line switch
The output of the console has changed but I still get errors: https://pastebin.com/wbgi8syg
Looks like you are on stretch (or later) and that you are already aware of the libssl vs libssl1.0 case.
Therefore, if you don't have libssl-dev installed, this line will get you further:
python build.py --qt-config "-I /usr/include/openssl-1.0/ -L /usr/lib/openssl-1.0/"
If you already have it installed and my suggestion doesn't work, you can uninstall libssl-dev for the time to build phantomjs which will likely avoid having to play further with configuration related variables.

Could not install sudo apt-get install libshogun17

When trying to install shogun im getting this error. Can some one suggest a solution?
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Unable to locate package libshogun17
Im using ubuntu operating system.
See this explanation of the origin and purpose of .ucf-dist files. This means you can either ignore the notice (that's what the N: prefix stands for) or remove said file.
sudo rm /etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist
libshogun17 is not part of ubuntu by default. Currently we supply two different ppa's for xenial and trusty:
for nightly builds: https://launchpad.net/~shogun-toolbox/+archive/ubuntu/nightly
for stable releases: https://launchpad.net/~shogun-toolbox/+archive/ubuntu/stable
please follow the instruction either the given page or http://shogun.ml/install#ubuntu how to add the ppa to your system.
Note, as mentioned above those PPAs only supply packages for ubuntu trusty or xenial.

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6_2.9.i686 libgcc-4.4.6-3.el6.i686 libstdc++-4.4.6-3.el6.i686

CentOS 6.2 + GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
When I debug a simple c++ code with GDB, I saw the following warning:
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6_2.9.i686 libgcc-4.4.6-3.el6.i686 libstdc++-4.4.6-3.el6.i686
I have tried the following methods and none of them fix the problems:
Search SO
yum install glibc
debuginfo-install glibc-2.12-1.47.el6_2.9.i686 libgcc-4.4.6-3.el6.i686 libstdc++-4.4.6-3.el6.i686
In fact, when I install those RPM one by one, I just realized that they are installed already.
[root#localhost Excluded]# rpm -ivh glibc-2.12-1.47.el6_2.9.i686.rpm
Preparing... ########################################### [100%]
package glibc-2.12-1.47.el6_2.9.i686 is already installed
[root#localhost Excluded]# ls *.rpm
glibc-2.12-1.47.el6_2.9.i686.rpm libgcc-4.4.6-3.el6.i686.rpm
[root#localhost Excluded]# rpm -ivh libgcc-4.4.6-3.el6.i686.rpm
Preparing... ########################################### [100%]
package libgcc-4.4.6-3.el6.i686 is already installed
[root#localhost Excluded]# rpm -ivh libstdc++-4.4.6-3.el6.i686.rpm
warning: libstdc++-4.4.6-3.el6.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing... ########################################### [100%]
package libstdc++-4.4.6-3.el6.i686 is already installed
file /usr/lib/libstdc++.so.6.0.13 from install of libstdc++-4.4.6-3.el6.i686 conflicts with file from package libstdc++-4.4.6-3.el6.i686
Why GDB cannot find it?
Question: Do I have to worry about this issue? If not, how to turn it off? If yes, how to fix it?
Thank you
debuginfo-install is a command of yum-utils, so
yum install yum-utils
debuginfo-install glibc
if the warning's still there, edit /etc/yum.repos.d/CentOS-Debuginfo.repo, set enabled=1
In case, someone else encounters the same issue,
I had updated the glibc and somehow the old ldconfig had been flushed
was facing this error while running the application
error while loading shared libraries: libjson-c.so.2: cannot open shared object file: No such file or directory
Even after setting the LD_LIBRARY_PATH it didn't work:
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
Finally the commands below came to the rescue.
// Add you library path here.
echo /usr/local/lib >> /etc/ld.so.conf
// And then Run ldconfig to reflect the path
ldconfig
The order of the accepted answer doesn't work for me.
I followed some tips in the comments and here's what I tried and succceded in my fresh install CentOS 7.2
From #lkraav's comment, I followed this wiki https://wiki.centos.org/AdditionalResources/Repositories/DebugInfo and create a new file.
The following could be appended to /etc/yum.repos.d/CentOS-Base.repo or a new file created such as /etc/yum.repos.d/CentOS-Debug.repo.
I pasted those contents from the wiki into the new /etc/yum.repos.d/CentOS-Debug.repo file but edit enabled=0 line to enabled=1
I debuginfo-install everything showed in the gdb warning and succeeded installing.