Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob@brasko.net>
To: Holger Sesterhenn <Holger.Sesterhenn@smgwtest.aachen.utimaco.de>
Cc: gdb@sources.redhat.com
Subject: Re: Problem debugging statically linked c++ program with GDB 6.0
Date: Fri, 02 Apr 2004 13:26:00 -0000	[thread overview]
Message-ID: <20040402132605.GA31210@white> (raw)
In-Reply-To: <406D578A.6010408@smgwtest.aachen.utimaco.de>

On Fri, Apr 02, 2004 at 02:07:38PM +0200, Holger Sesterhenn wrote:
> Hi,
> 
> I have a bug in my statically linked c++ program and would like to use
> DDD with GDB to see whats wrong. I use <string> from the stdlibc++.
> DDD/GDB shows a SIGSGV if I call a member function e.g. c_str() to take
> a look at the value of the string.
> 
> I have written a little program to reproduce the problem (don't need
> DDD). If the program is linked dynamically, everything works as expected!
> 
> If somebody can confirm the problem I would submit a bug report.
> Searching the bug database I did not find any hint.
> 
> Running Linux 2.4.21 (IA86/32), compiled gcc 3.3.3, glibc 2.3.2 and gdb
> 6.0 myself (chrooted). The problem can be reproduced with a plain SuSE
> 9.0 installation (gcc 3.3.1, glibc 2.3.2, gdb 5.3.92).

I don't know if this is helpful, however, GDB crashes for me even when I
link dynamically. It will only evaluate the expression sometimes for me.

Because of this, I have added the snippet below to my .gdbinit file

   # prints a C++ string
   define pc
      set $string_length=$arg0.length()
      set print elements $string_length
      print $arg0.dat
      set print elements 0
   end

   document pc
      Prints a C++ string
   end
   
This seems to work ok, even though it's not the perfect solution.
For some reason calling the length() function never seems to crash for
me.

Bob Rossi


  reply	other threads:[~2004-04-02 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-02 12:08 Holger Sesterhenn
2004-04-02 13:26 ` Bob Rossi [this message]
2004-04-02 14:48   ` Holger Sesterhenn
2004-04-02 15:16     ` Bob Rossi
2004-04-05  9:45       ` Holger Sesterhenn

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=20040402132605.GA31210@white \
    --to=bob@brasko.net \
    --cc=Holger.Sesterhenn@smgwtest.aachen.utimaco.de \
    --cc=gdb@sources.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