public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@jive.nl>
To: gdb@sourceware.org
Subject: C++ related core dump
Date: Tue, 15 Nov 2005 10:15:00 -0000	[thread overview]
Message-ID: <200511151015.jAFAFKXw032226@jop31.nfra.nl> (raw)

I'm debugging some evil C++ code at work, and gdb keeps dumping core
on me:

(gdb) ptype antennac 
type = class ROScalarColumn<int> : public virtual ROTableColumn {
  protected:
    Bool *canAccessColumn_p;
    Bool *reaskAccessColumn_p;

  public:
    ROScalarColumn();
    ROScalarColumn(Table const&, String const&);
    ROScalarColumn(ROTableColumn const&);
    ROScalarColumn(ROScalarColumn<int> const&);
    virtual ~ROScalarColumn();
    virtual class ROTableColumn * clone() const;
    void reference(ROScalarColumn<int> const&);
    void attach(Table const&, String const&);
    void get(unsigned int, int&) const;
    Int operator()(unsigned int) const;
    void getColumn(Vector<int>&, bool) const;
    Vector<int> getColumn() const;
    void getColumnRange(ArraySlicer const&, Vector<int>&, bool) const;
    Vector<int> getColumnRange(ArraySlicer const&) const;
    void getColumnCells(RefRows const&, Vector<int>&, bool) const;
    Vector<int> getColumnCells(RefRows const&) const;
  private:
    ROScalarColumn<int> & operator=(ROScalarColumn<int> const&);
    void reference(ROTableColumn const&);
    void checkDataType() const;
}

(gdb) p antennac(0)
Segmentation fault (core dumped)

This is with gcc 3.2 on sparc-sun-solaris2.7, which still uses stabs
debugging info.

I tracked it down to some code in valops.c:find_overload_match(),
where SYMBOL_CPLUS_DEMANGLED_NAME is returning a null pointer which we
pass to cp_func_name() and that function can't deal with that.  As a
stopgap, I applied the attached patch, and now I get:

(gdb) p antennac(0)
Invalid data type for function to be called.

which isn't quite what I want, but at least keeps my gdb alive.

What I really want of course is for the above to invoke
antennac.operator()(0).  Is that supposed to work at all?  I know
stabs support for C++ has issues, but reading the code I don't see how
this would work for DWARF2 either.

Regardless of properly invoking operator(), we should do something
about this crash.  Can we do something better than the attached patch?

Mark

Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.161
diff -u -p -r1.161 valops.c
--- valops.c	27 May 2005 04:39:32 -0000	1.161
+++ valops.c	15 Nov 2005 09:52:56 -0000
@@ -1847,7 +1847,8 @@ find_overload_match (struct type **arg_t
   else
     {
       const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym);
-      func_name	= cp_func_name (qualified_name);
+      if (qualified_name)
+	func_name = cp_func_name (qualified_name);
 
       /* If the name is NULL this must be a C-style function.
          Just return the same symbol. */

             reply	other threads:[~2005-11-15 10:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-15 10:15 Mark Kettenis [this message]
2005-11-17  4:11 ` Daniel Jacobowitz
2005-11-17  9:46   ` Mark Kettenis
2005-11-17 14:04     ` Daniel Jacobowitz
2005-11-22  9:21       ` Mark Kettenis
2005-11-22 14:01         ` Daniel Jacobowitz

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=200511151015.jAFAFKXw032226@jop31.nfra.nl \
    --to=kettenis@jive.nl \
    --cc=gdb@sourceware.org \
    /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).