From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19044 invoked by alias); 3 May 2012 14:00:12 -0000 Received: (qmail 18996 invoked by uid 22791); 3 May 2012 14:00:06 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from poczta.oswiecenia.net (HELO poczta.oswiecenia.net) (83.13.108.61) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 May 2012 13:59:53 +0000 Received: from localhost (localhost [127.0.0.1]) by poczta.oswiecenia.net (Postfix) with ESMTP id D1FBC3BD640; Thu, 3 May 2012 15:59:51 +0200 (CEST) Received: from poczta.oswiecenia.net ([127.0.0.1]) by localhost (poczta.oswiecenia.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TW7KFdI8tupv; Thu, 3 May 2012 15:59:47 +0200 (CEST) Received: from poczta.oswiecenia.net (unknown [192.168.5.248]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by poczta.oswiecenia.net (Postfix) with ESMTPSA id BC5E03BD60A; Thu, 3 May 2012 15:59:47 +0200 (CEST) MIME-Version: 1.0 Date: Thu, 03 May 2012 14:00:00 -0000 From: Tomasz Grobelny To: Sergio Durigan Junior Cc: Subject: Re: sun compiler and gdb In-Reply-To: References: <25b0084e43f4d35410c8dff55a3be61d@192.168.5.248> Message-ID: <543302446b67dbf68e8cedb69a197d77@192.168.5.248> X-Sender: tomasz@grobelny.oswiecenia.net User-Agent: RoundCube Webmail/0.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00008.txt.bz2 On Thu, 03 May 2012 03:49:41 -0300, Sergio Durigan Junior wrote: > On Thursday, May 03 2012, Tomasz Grobelny wrote: > >> Hi all, >> Should it be possible to debug C++ programs compiled using sun compiler >> using GDB? If so which debug format should I use? Which versions of the >> compiler/gdb support such a scenario? Currently the situation looks like >> this (which does not look very promising): > > Indeed. In a quick search using Google, I found some links reporting > that the compiler is kind of broken, probably when it comes to DWARF > generation. Anyway, by reading this link: > > http://netbeans.org/bugzilla/show_bug.cgi?id=89876 > > especifically in comment #8, I saw that you can try enabling some > options in your C++ compiler: > > -Qoption cg -h_gcc -xO0 -g > > Also, I saw that passing `-xs' to the compiler might help a bit. But > overall, AFAIU, you don't have many options here, unfortunately. > However, I'm definitely not an expert in the platform, so maybe someone > more experienced will show up and help you further. > > Good luck. > Now it looks like this (on sparc as the comment suggested that): > /opt/solstudio12.2/prod/bin/CC -xdebugformat=dwarf -Qoption cg -h_gcc -xO0 -g -xs test.cpp > gdb -q ./a.out Reading symbols from /login/sg209371/a.out...done. (gdb) break main Die: DW_TAG_ (abbrev 8, offset 0x199) parent at offset: 0x175 has children: TRUE attributes: DW_AT_name (DW_FORM_string) string: "basic_ostream" (is canonicalized) DW_AT_ (DW_FORM_string) string: "nNbasic_ostream3CTACTB_" (not canonicalized) DW_AT_decl_file (DW_FORM_data1) constant: 2 DW_AT_decl_line (DW_FORM_data1) constant: 74 Dwarf Error: Cannot find type of die [in module /login/sg209371/a.out] (gdb) run Starting program: /login/sg209371/a.out [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] hello world Program exited normally. (gdb) quit > This time this is gdb 7.0.1. The question is indeed whether the issue is on compiler side or gdb side. The comments from the link you mentioned are from 2007, I would think that Oracle is capable of fixing a bug in 5 years... Also the dwarfdump shows some sensible information (some symbols, names of the source files). -- Regards, Tomasz Grobelny