Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 42220 - Unable to get debugging symbols for C++ app using -g flag
Summary: Unable to get debugging symbols for C++ app using -g flag
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High major
Assignee: Please assign to toolchain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-19 23:31 UTC by Stephen Torri
Modified: 2004-02-23 11:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Torri 2004-02-19 23:31:27 UTC
I have gcc-3.3.2 20031218 installed as well as hardened-gcc 3.3.2.1-r2. I 
originally just installed hardened-gcc and did not rebuild gcc-3.3.2. Some where 
along the line I was getting failures from a configure script saying that the 
compiler could not compile C++ programs. So I figured that since I had just 
installed hardened-gcc I should recompile it. So i did and the problem went away. Yet another bug has not. No matter how I have tried to collect a core dump
for a program I am debugging I can not get debugging symbols. I have run 
the application in a shell term with 'ulimit -c unlimited'. No luck. The core
backtrace was a just a memory address list. I tried to load the core in gdb:
./gdb --core=core ./app. No luck. No debugging symobls. The test program I have
is unfortunately requires a monster of a library to build (ACE and ACEXML) I cannot give a example from that but I do have a simpler example

Reproducible: Always
Steps to Reproduce:
1. Compile test file: g++ -g -o test test.cpp
2. Run app in gdb: gdb ./test
3. Attempt to set breakpoint in main:  b main
4. Try to run: r
5. Watch program fail :(

Actual Results:  
bash-2.05b$ g++ -g -o test test.cpp
bash-2.05b$ gdb ./test
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) b main
Breakpoint 1 at 0xc7b: file test.cpp, line 6.
(gdb) bt
No stack.
(gdb) n
The program is not being run.
(gdb) r
Starting program: /home/storri/test
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0xc7b: Input/output error.

Expected Results:  
Stopped in main().

Test program:

#include <inttypes.h>
#include <iostream>

int main (int, char*) {

  std::cout << "size of unsigned char: " << sizeof(unsigned char) << std::endl;
  std::cout << "size of uint16_t: " << sizeof(uint16_t) << std::endl;
  std::cout << "size of uint8_t: " << sizeof(uint8_t) << std::endl;
}
Comment 1 Stephen Torri 2004-02-19 23:35:10 UTC
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.4.22-gentoo-r5)
=================================================================
System uname: 2.4.22-gentoo-r5 i686 Pentium III (Katmai)
Gentoo Base System version 1.4.3.13
distcc 2.11.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.7.7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=pentium3 -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache fixpackages sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X alsa apm arts avi berkdb bonobo cdr crypt cups curl encode esd flash foomaticdb gd gdbm gif gnome gpm gtk gtk2 gtkhtml guile imlib java jpeg kde ldap libg++ libwww mad mikmod mmx motif mozilla mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl php png python qt quicktime readline sdl slang snmp spell ssl svga tcltk tcpd tetex truetype x86 xml2 xmms xv zlib"

bash-2.05b$ gcc --version
gcc (GCC) 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
Comment 2 Stephen Torri 2004-02-20 21:30:04 UTC
Symbols can be received if the hardened-gcc is disabled and the application recompiled. It would be recommended to at least provide a man page for hcc that tells the use what hardened-gcc provides for the user, what changes they need to make to their compiler flags to best utilize it and how to confirm they are using it when they call 'make'.
Comment 3 Stephen Torri 2004-02-20 21:33:05 UTC
To disable hcc I did:

hcc -r

I know that doing hcc -a will enable the hardened-gcc. 

Note: If hcc is enabled and the application was compiled with debug symbols while   hcc was disabled then the compiler debug symbols are still there. I know that should be the case but it would be a thing to add to the man page as a "alert". I would not want someone testing their application to forget to recompile with hcc on before releasing their program.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2004-02-23 11:25:49 UTC
Please look at comments #2 and #3.