abi-compliance-checker icon indicating copy to clipboard operation
abi-compliance-checker copied to clipboard

Quote string with symbols in c++filt call

Open alex-savchuk opened this issue 7 years ago • 3 comments

For complex mangled symbols tool generates something like '_Z...(bool)false...' during work and passes it as parameter for c++filt.

To avoid c++filt execution error due such unescaped special symbols the string with symbols needs to be quoted.

alex-savchuk avatar Mar 24 '17 00:03 alex-savchuk

Hi,

Seems that it doesn't work properly:

c++filt '_ZTv0_n24_NSt9strstreamD1Ev _ZdaPv'
_ZTv0_n24_NSt9strstreamD1Ev _ZdaPv

We need:

c++filt '_ZTv0_n24_NSt9strstreamD1Ev' '_ZdaPv'
virtual thunk to std::strstream::~strstream()
operator delete[](void*)

How to reproduce this case?

Thank you.

lvc avatar Mar 24 '17 05:03 lvc

@lvc I agree - my fix is incorrect. Each symbol should be quoted independently, as you said. Let me update this PR. Updated: fixed.

About reproducing:

I could provide only modified version of mangled symbol:

_ZN7testingNamespace20recoverFunctionERN5utilNamespace10containerNamespace8hashmappISsPNS2_IxPNS0_6allocator11storeENS1_12hasherELb0ELm4EEES6_Lb0ELm4EEERNS2_ISsPNS2_IxP12customObjectS6_Lb0ELm4EEES6_Lb0ELm4EEERKNS2_ISsP7_objectS6_Lb0ELm4EEE

which is expected to be converted to:

testingNamespace::recoverFunction(utilNamespace::containerNamespace::hashmap<std::basic_string, utilNamespace::containerNamespace::hashmap<long long, utilNamespace::allocator::store*, utilNamespace::containerNamespace::hasher, false, 4ul>, utilNamespace::containerNamespace::hasher, false, 4ul>&, utilNamespace::containerNamespace::hashmap<std::basic_string, utilNamespace::containerNamepspace::hashmap<long long, customObject, utilNamespace::containerNamespace::hasher, false, 4ul>, utilNamespace::containerNapespace::hasher, false, 4ul>&, utilNamespace::containerNamespace::hashmap<std::basic_string, _object, utilNamespace::containerNamespace::hasher, false, 4ul>const&)

But I see that during translation at:

    if($COMMON_LANGUAGE{$LibVersion} eq "C++" or $OSgroup eq "windows") {
        translateSymbols(keys(%{$CompleteSignature{$LibVersion}}), $LibVersion);
    }

the tool resolved symbol's typedef-ed/template parameters:

_ZN7testingNamespace20recoverFunctionERN5utilNamespace10containernamespace8hashmapILm4E33testingNamespace::storeTypedefedFunction*11(bool)falseSsNS1_12...

and such symbol leads to errors in console like:

sh: -c: line 0: syntax error near unexpected token `('

I try to create clean example but it's quite complex.

alex-savchuk avatar Mar 27 '17 17:03 alex-savchuk

if($COMMON_LANGUAGE{$LibVersion} eq "C++" or $OSgroup eq "windows") { translateSymbols(keys(%{$CompleteSignature{$LibVersion}}), $LibVersion); }

Did you upgraded to 2.0 version?

There is no such code line in ABICC 2.0.

Also please consider to use ABI Dumper tool (https://github.com/lvc/abi-dumper) to create ABI dumps from DWARF debug info instead of analysis of header files.

Thank you.

lvc avatar Mar 28 '17 06:03 lvc