The following commit has been merged in the master branch:
commit d6778cf96d27b6bde6c76c8bda8f722e665fbcef
Author: Modestas Vainius <[email protected]>
Date:   Sat Jan 30 00:51:05 2010 +0200

    Dpkg::Shlibs::Cppfilt: add and export cppfilt_demangle_cpp().
    
    This function is needed to unify how demangling of C++ symbols is done in
    dpkg-dev. Passing 'auto' to cppfilt_demangle() each time is not very obvious
    and error prone.

diff --git a/scripts/Dpkg/Shlibs/Cppfilt.pm b/scripts/Dpkg/Shlibs/Cppfilt.pm
index 79d1799..9898aa1 100644
--- a/scripts/Dpkg/Shlibs/Cppfilt.pm
+++ b/scripts/Dpkg/Shlibs/Cppfilt.pm
@@ -23,7 +23,8 @@ use Dpkg::ErrorHandling;
 use Dpkg::IPC;
 use IO::Handle;
 
-our @EXPORT = qw(cppfilt_demangle);
+our @EXPORT = qw(cppfilt_demangle_cpp);
+our @EXPORT_OK = qw(cppfilt_demangle);
 
 # A hash of 'objects' referring to preforked c++filt processes for the distinct
 # demangling types.
@@ -80,6 +81,11 @@ sub cppfilt_demangle {
     return $filt->{last_result};
 }
 
+sub cppfilt_demangle_cpp {
+    my $symbol = shift;
+    return cppfilt_demangle($symbol, 'auto');
+}
+
 sub terminate_cppfilts {
     foreach (keys %cppfilts) {
        next if not defined $cppfilts{$_}{pid};
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 4450c43..337e498 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -381,7 +381,7 @@ sub convert_to_alias {
            # rawname.
            return "$1" if ($rawname =~ /\@([...@]+)$/);
        } elsif ($rawname =~ /^_Z/ && $type eq "c++") {
-           return cppfilt_demangle($rawname, "auto");
+           return cppfilt_demangle_cpp($rawname);
        }
     }
     return undef;
diff --git a/scripts/t/190_Dpkg_Shlibs_Cppfilt.t 
b/scripts/t/190_Dpkg_Shlibs_Cppfilt.t
index 0e481cf..f7559a3 100644
--- a/scripts/t/190_Dpkg_Shlibs_Cppfilt.t
+++ b/scripts/t/190_Dpkg_Shlibs_Cppfilt.t
@@ -20,21 +20,17 @@ use warnings;
 
 use_ok("Dpkg::Shlibs::Cppfilt");
 
-sub demangle_cpp {
-    return cppfilt_demangle(shift, 'auto');
-}
-
 # Simple C++ demangling tests
-is ( demangle_cpp('_ZNSt10istrstreamC1EPKcl'),
+is ( cppfilt_demangle_cpp('_ZNSt10istrstreamC1EPKcl'),
                   'std::istrstream::istrstream(char const*, long)',
     'demangle symbol' );
-is ( demangle_cpp('_znst10istrstreamc1ep...@base'),
+is ( cppfilt_demangle_cpp('_znst10istrstreamc1ep...@base'),
                   'std::istrstream::istrstream(char const*, long)@Base',
     'demangle symbol with extra postfix' );
-is ( demangle_cpp('foobar _znst10istrstreamc1ep...@base'),
+is ( cppfilt_demangle_cpp('foobar _znst10istrstreamc1ep...@base'),
                   'foobar std::istrstream::istrstream(char const*, long)@Base',
     'demangle symbol with garbage around it' );
-is ( demangle_cpp('FoobarInvalidSymbol'), undef,
+is ( cppfilt_demangle_cpp('FoobarInvalidSymbol'), undef,
     'non-demanglable string' );
 
 # Mass C++ demangling. Checking if c++filt does not hang and cppfilt_demangle()
@@ -83,7 +79,7 @@ END
 
 for (my $try = 1; $try <= 7; $try++) {
     for (my $i = 0; $i <= $#mangledtext; $i++) {
-       my $demangled = demangle_cpp($mangledtext[$i]) || $mangledtext[$i];
+       my $demangled = cppfilt_demangle_cpp($mangledtext[$i]) || 
$mangledtext[$i];
        is( $demangled, $demangledtext[$i], "mass c++ demangling 
(${try}x".(${i}+1).")");
     }
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to