Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gdb-patches@sources.redhat.com
Cc: Jason Merrill <jason@redhat.com>
Subject: PATCH to gnuv3_rtti_type
Date: Wed, 17 Apr 2002 19:02:00 -0000	[thread overview]
Message-ID: <wvl8z7llq6b.fsf@prospero.cambridge.redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

gnuv3_rtti_type still gets confused sometimes, by constructor vtables and
namespaces at least.  This wouldn't be a big problem, as mostly I don't
care what the real type is, except that it gives an error and aborts.  If
I'm just trying to print the contents of a pointer, this is rather
annoying.

This patch changes the errors to warnings, so that I get the normal output
which is all I really care about.

OK?

2002-04-14  Jason Merrill  <jason@redhat.com>

	* gnu-v3-abi.c (gnuv3_rtti_type): If we get confused, just warn
	and return NULL.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2470 bytes --]

*** gnu-v3-abi.c.~1~	Sun Mar 17 17:10:01 2002
--- gnu-v3-abi.c	Sun Apr 14 22:59:39 2002
*************** gnuv3_rtti_type (struct value *value,
*** 241,262 ****
    vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
    if (vtable_symbol_name == NULL
        || strncmp (vtable_symbol_name, "vtable for ", 11))
!     error ("can't find linker symbol for virtual table for `%s' value",
!            TYPE_NAME (value_type));
    class_name = vtable_symbol_name + 11;
  
    /* Try to look up the class name as a type name.  */
    class_symbol = lookup_symbol (class_name, 0, STRUCT_NAMESPACE, 0, 0);
    if (! class_symbol)
!     error ("can't find class named `%s', as given by C++ RTTI", class_name);
  
    /* Make sure the type symbol is sane.  (An earlier version of this
       code would find constructor functions, who have the same name as
       the class.)  */
    if (SYMBOL_CLASS (class_symbol) != LOC_TYPEDEF
        || TYPE_CODE (SYMBOL_TYPE (class_symbol)) != TYPE_CODE_CLASS)
!     error ("C++ RTTI gives a class name of `%s', but that isn't a type name",
!            class_name);
  
    /* This is the object's run-time type!  */
    run_time_type = SYMBOL_TYPE (class_symbol);
--- 241,273 ----
    vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
    if (vtable_symbol_name == NULL
        || strncmp (vtable_symbol_name, "vtable for ", 11))
!     {
!       warning ("can't find linker symbol for virtual table for `%s' value",
! 	       TYPE_NAME (value_type));
!       if (vtable_symbol_name)
! 	warning ("  found `%s' instead", vtable_symbol_name);
!       return NULL;
!     }
    class_name = vtable_symbol_name + 11;
  
    /* Try to look up the class name as a type name.  */
    class_symbol = lookup_symbol (class_name, 0, STRUCT_NAMESPACE, 0, 0);
    if (! class_symbol)
!     {
!       warning ("can't find class named `%s', as given by C++ RTTI", class_name);
!       return NULL;
!     }
  
    /* Make sure the type symbol is sane.  (An earlier version of this
       code would find constructor functions, who have the same name as
       the class.)  */
    if (SYMBOL_CLASS (class_symbol) != LOC_TYPEDEF
        || TYPE_CODE (SYMBOL_TYPE (class_symbol)) != TYPE_CODE_CLASS)
!     {
!       warning ("C++ RTTI gives a class name of `%s', but that isn't a type name",
! 	       class_name);
!       return NULL;
!     }
  
    /* This is the object's run-time type!  */
    run_time_type = SYMBOL_TYPE (class_symbol);

             reply	other threads:[~2002-04-18  2:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-17 19:02 Jason Merrill [this message]
2002-04-17 19:07 ` Daniel Jacobowitz
2002-04-30 11:28 ` Jason Merrill
2002-04-30 12:10   ` Michael Snyder
2002-05-03 12:36     ` Jason Merrill
2002-05-03 14:16       ` 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=wvl8z7llq6b.fsf@prospero.cambridge.redhat.com \
    --to=jason@redhat.com \
    --cc=gdb-patches@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