How to build debuggable executable on Solaris?

Skip Montanaro skip at pobox.com
Tue Oct 1 16:33:25 EDT 2002


I swear this dang Solaris machine is trying to thwart my every attempt to
make progress... *sigh*

I'm trying to build a version of Python 2.2.1 which contains useful
debugging symbols.  I built it like so:

    CC='mycc' CXX='mycc' OPT='-g' CFLAGS='-g' LDFLAGS='-g' ../configure
    make CC='mycc' CXX='mycc' OPT='-g' CFLAGS='-g' LDFLAGS='-g'

'mycc' is shell script Robib Dunn wrote that decides whether to execute the
C or C++ compiler based upon file extensions (it's a distutils thing - I'm
willing to discuss offline).  If any files end in ".c", 'cc' is run,
otherwise 'CC' is run.

During compilation it generated commands like

    mycc -c -g -I. -I../Include -DHAVE_CONFIG_H  -o Python/traceback.o \
         ../Python/traceback.c

The link command looked like

    mycc -g  -o python Modules/python.o \
         libpython2.2.a -lsocket -lnsl -ldl  -lpthread -lthread   -lm  

(and was thus linked using CC) and modules were compiled and linked like

    mycc -DNDEBUG -g -I. -I/home/skip/src/Python-2.2.1/./Include \
         -I/usr/local/include -IInclude/ \
         -c /home/skip/src/Python-2.2.1/Modules/_hotshot.c \
         -o build/temp.solaris-2.8-sun4u-2.2/_hotshot.o -g

    mycc -G build/temp.solaris-2.8-sun4u-2.2/_hotshot.o -L/usr/local/lib \
         -o build/lib.solaris-2.8-sun4u-2.2/_hotshot.so

When I try to debug it with gdb I get

    GNU gdb 5.0
    Copyright 2000 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 "sparc-sun-solaris2.8"...
    (no debugging symbols found)...

Dbx seems okay with the executable (it doesn't warn about not finding any
debug symbols), but "stop main" doesn't work as I remembered from ages ago:

    For information about new features see `help changes'
    To remove this message, put `dbxenv suppress_startup_message 7.0' in your .dbxrcReading python
    Reading ld.so.1
    Reading libsocket.so.1
    ...
    Reading libCstd_isa.so.1
    detected a multithreaded program
    (dbx) b main
    b: not found
    (dbx) stop main
    dbx: anachronism: Use 'stop change <variable>' or 'stop cond <bool-expr>'.
    Event specifications without keywords will not be accepted in future releases
    dbx: 'main' is a function or procedure, expected variable
    (dbx) run
    Running: python 
    (process id 25873)
    Python 2.2.1 (#1, Oct  1 2002, 14:42:11) [C] on sunos5
    Type "help", "copyright", "credits" or "license" for more information.
    >>> ^D

Thinking that maybe the cc compilation vs the CC link commands which mycc
generates could be the problem, I executed "make clean" then rebuilt using 

    make CC='cc' OPT='-g' CFLAGS='-g' LDFLAGS='-g'

Same result.  Any suggestions?

Thx,

-- 
Skip Montanaro - skip at pobox.com
"Airplanes don't fly until the paperwork equals the weight of the
aircraft. Same with i18N." - from the "Perl, Unicode and i18N FAQ"




More information about the Python-list mailing list