gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/as_object.h


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog server/as_object.h
Date: Tue, 20 Mar 2007 12:37:48 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/03/20 12:37:48

Modified files:
        .              : ChangeLog 
        server         : as_object.h 

Log message:
        Demangle the object name in the exception message if GCC >= 3 is being
        used.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2640&r2=1.2641
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.46&r2=1.47

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2640
retrieving revision 1.2641
diff -u -b -r1.2640 -r1.2641
--- ChangeLog   20 Mar 2007 11:51:50 -0000      1.2640
+++ ChangeLog   20 Mar 2007 12:37:47 -0000      1.2641
@@ -18,6 +18,8 @@
 
        * server/as_object.h: Add ensureType<classname>, which is intended to
        replace the class-specific ensureClass functions. Suggested by Ann.
+       Demangle the object name in the exception message if GCC >= 3 is being
+       used.
        * server/asobj/Boolean.cpp: Switch ensureClass to ensureType.
        * server/vm/ASHandlers.cpp: In ActionDelete(), don't pop an object off
        the AS stack in the hopes that it magically has a property which might

Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- server/as_object.h  20 Mar 2007 09:45:28 -0000      1.46
+++ server/as_object.h  20 Mar 2007 12:37:48 -0000      1.47
@@ -32,6 +32,10 @@
 #include "GnashException.h"
 #include <sstream>
 
+#if defined(__GNUC__) && __GNUC__ > 2
+#  include <cxxabi.h>
+#endif
+
 #include <cmath>
 #include <utility> // for std::pair
 
@@ -469,14 +473,33 @@
 {
        T* ret = dynamic_cast<T*>(obj);
 
-       // This path is fairly unlikely, so it's a potential  __builtin_expect.
        if (!ret) {
-               std::ostringstream stream;
-               stream  << "builtin method or gettersetter for " 
-                       << typeid(T).name() << " called from "
-                       << typeid(obj).name() << " instance.";
+               std::string     target = typeid(T).name(),
+                               source = typeid(obj).name();
+#if defined(__GNUC__) && __GNUC__ > 2
+               int status;
+               char* target_unmangled = 
+                       abi::__cxa_demangle (target.c_str(), NULL, NULL,
+                                              &status);
+               if (status == 0) {
+                       target = target_unmangled;
+                       free(target_unmangled);
+               }
+
+               char* source_unmangled =
+                       abi::__cxa_demangle (source.c_str(), NULL, NULL,
+                                             &status);
+
+               if (status == 0) {
+                       source = source_unmangled;
+                       free(source_unmangled);
+               }
+#endif // __GNUC__ > 2
+
+               std::string msg = "builtin method or gettersetter for " +
+                       target + " called from " + source + " instance.";
 
-               throw ActionException(stream.str());
+               throw ActionException(msg);
         }
         return ret;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]