public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tomasz Grobelny <tomasz@grobelny.oswiecenia.net>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: <gdb@sourceware.org>
Subject: Re: sun compiler and gdb
Date: Thu, 03 May 2012 14:00:00 -0000	[thread overview]
Message-ID: <543302446b67dbf68e8cedb69a197d77@192.168.5.248> (raw)
In-Reply-To: <m3zk9pwygq.fsf@redhat.com>

On Thu, 03 May 2012 03:49:41 -0300, Sergio Durigan Junior
<sergiodj@redhat.com> 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_<unknown> (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_<unknown> (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

  reply	other threads:[~2012-05-03 14:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03  3:23 Tomasz Grobelny
2012-05-03  6:50 ` Sergio Durigan Junior
2012-05-03 14:00   ` Tomasz Grobelny [this message]
2012-05-09 20:31     ` Tom Tromey
2012-05-09 22:58       ` Tomasz Grobelny
2012-05-09 23:23         ` Tomasz Grobelny
2012-05-10 13:34         ` Tom Tromey
2012-05-10 16:38           ` Tomasz Grobelny
2012-05-10 17:38             ` Tomasz Grobelny
2012-05-10 20:34               ` Tom Tromey
2012-05-10 20:39             ` Tom Tromey
2012-05-10 22:08               ` Tomasz Grobelny
2012-05-11 16:21                 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543302446b67dbf68e8cedb69a197d77@192.168.5.248 \
    --to=tomasz@grobelny.oswiecenia.net \
    --cc=gdb@sourceware.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).