How to use cxxfilt - 8 common examples

To help you get started, we’ve selected a few cxxfilt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gjcarneiro / pybindgen / pybindgen / castxmlparser.py View on Github external
pygen_sink = self._get_pygen_sink_for_definition(fun)
                if pygen_sink:
                    if 'pygen_comment' in global_annotations:
                        pygen_sink.writeln('## ' + global_annotations['pygen_comment'])
                    pygen_sink.writeln("root_module[%r].add_function_as_constructor(%s)" %
                                       (cpp_class.full_name,
                                        ", ".join([repr(fun.name), retval_repr, arglist_repr]),))

                if params_ok:
                    function_wrapper = cpp_class.add_function_as_constructor(fun.name, return_type, arguments)
                    function_wrapper.castxml_definition = fun

                continue

            if check_template(demangle(fun.get_mangled_name()), fun.name):
                template_parameters = get_template_arg(demangle(fun.get_mangled_name()), fun.name)
                kwargs['template_parameters'] = template_parameters
                template_instance_names = global_annotations.get('template_instance_names', '')
                if template_instance_names:
                    for mapping in template_instance_names.split('|'):
                        type_names, name = mapping.split('=>')
                        instance_types = type_names.split(',')
                        if instance_types == template_parameters:
                            kwargs['custom_name'] = name
                            break

            if alt_name:
                kwargs['custom_name'] = alt_name

            if fun.attributes:
                if 'deprecated' in fun.attributes:
                    kwargs['deprecated'] = True
github gjcarneiro / pybindgen / pybindgen / castxmlparser.py View on Github external
member.name, cls, global_annotations['ignore'])
                continue

            logger.debug("Looking at method %s of class %s",
                         member.name, cls)

            ## ------------ method --------------------
            if isinstance(member, (calldef_members.member_function_t, calldef_members.member_operator_t)):
                is_virtual = (member.virtuality != calldef_types.VIRTUALITY_TYPES.NOT_VIRTUAL)
                pure_virtual = (member.virtuality == calldef_types.VIRTUALITY_TYPES.PURE_VIRTUAL)

                kwargs = {} # kwargs passed into the add_method call

                for key, val in global_annotations.items():
                    if key == 'template_instance_names' \
                            and check_template(demangle(member.get_mangled_name()), member.name):
                        pass
                    elif key == 'pygen_comment':
                        pass
                    elif key == 'unblock_threads':
                        kwargs['unblock_threads'] = annotations_scanner.parse_boolean(val)
                    elif key == 'name':
                        kwargs['custom_name'] = val
                    elif key == 'throw':
                        kwargs['throw'] = self._get_annotation_exceptions(val)
                    else:
                        warnings.warn_explicit("Annotation '%s=%s' not used (used in %s)"
                                               % (key, val, member),
                                               AnnotationsWarning, member.location.file_name, member.location.line)
                if isinstance(member, calldef_members.member_operator_t):
                    if member.symbol == '()':
                        kwargs['custom_name'] = '__call__'
github gjcarneiro / pybindgen / pybindgen / castxmlparser.py View on Github external
pygen_sink = self._get_pygen_sink_for_definition(fun)
                if pygen_sink:
                    if 'pygen_comment' in global_annotations:
                        pygen_sink.writeln('## ' + global_annotations['pygen_comment'])
                    pygen_sink.writeln("root_module[%r].add_function_as_constructor(%s)" %
                                       (cpp_class.full_name,
                                        ", ".join([repr(fun.name), retval_repr, arglist_repr]),))

                if params_ok:
                    function_wrapper = cpp_class.add_function_as_constructor(fun.name, return_type, arguments)
                    function_wrapper.castxml_definition = fun

                continue

            if check_template(demangle(fun.get_mangled_name()), fun.name):
                template_parameters = get_template_arg(demangle(fun.get_mangled_name()), fun.name)
                kwargs['template_parameters'] = template_parameters
                template_instance_names = global_annotations.get('template_instance_names', '')
                if template_instance_names:
                    for mapping in template_instance_names.split('|'):
                        type_names, name = mapping.split('=>')
                        instance_types = type_names.split(',')
                        if instance_types == template_parameters:
                            kwargs['custom_name'] = name
                            break

            if alt_name:
                kwargs['custom_name'] = alt_name

            if fun.attributes:
                if 'deprecated' in fun.attributes:
github cyliustack / sofa / bin / sofa_ml.py View on Github external
        lambda x: cxxfilt.demangle(str( x[x.find(char1)+1 : x.find(char2)].split('@')[0] ))
    )
github dongyangwu / p-joker / mackernel / misc_func.py View on Github external
def demangle(uc_name):
    if uc_name.startswith("0x"):
        return uc_name
    uc_name = uc_name[1:]
    return cxxfilt.demangle(uc_name)
github google / tock-on-titan / tools / print_memory_usage.py View on Github external
def parse_mangled_name(name):
    """Take a potentially mangled symbol name and demangle it to its
       name, removing the trailing hash. Raise a cxxflit.InvalidName exception
       if it is not a mangled symbol."""
    demangled = cxxfilt.demangle(name, external_only=False)
    corrected_name = trim_hash_from_symbol(demangled)
    # Rust-specific mangled names triggered by Tock Components, e.g.
    # ZN100_$LT$capsules..ieee802154..driver..RadioDriver$u20$as$u20$capsules..ieee802154..device..RxClient$GT$7receive
    # This name has two parts: the structure, then the trait method it is
    # implementing. This code parses only the structure name, so all
    # methods that are trait implementations are just clumped under the
    # name of the structure. -pal
    if corrected_name[0:5] == "_$LT$":
        # Trim off the _$LT$, then truncate at next $, this will extract
        # capsules..ieee802154..driver..RadioDriver
        corrected_name = corrected_name[5:]
        endpos = corrected_name.find("$")
        if endpos > 0:
            corrected_name = corrected_name[0:endpos]

    return corrected_name
github dongyangwu / p-joker / iokit_kextclass / TypeParser.py View on Github external
def type_parser(method_type):
    if method_type.startswith("0x"):
        return method_type
    uc_name = method_type[1:]
    cx_name = cxxfilt.demangle(uc_name)
    if cx_name[-5:] == "const":
        return cx_name[:-6]
    return cx_name
github google / tock-on-titan / tools / print_memory_usage.py View on Github external
# Initialized data: part of the flash image, then copied into RAM
        # on start. The .data section in normal hosted C.
        if segment == "relocate":
            try:
                demangled = parse_mangled_name(name)
                kernel_initialized.append((demangled, addr, size, 0))
            except cxxfilt.InvalidName:
                kernel_initialized.append((name, addr, size, 0))

        # Uninitialized data, stored in a zeroed RAM section. The
        # .bss section in normal hosted C.
        elif segment == "sram":
            try:
                demangled = parse_mangled_name(name)
                kernel_uninitialized.append((demangled, addr, size, 0))
            except cxxfilt.InvalidName:
                kernel_uninitialized.append((name, addr, size, 0))

        # Code and embedded data.
        elif segment == "text":
            # pylint: disable=anomalous-backslash-in-string
            match = re.search('\$(((\w+\.\.)+)(\w+))\$', name)
            if match != None:
                symbol = match.group(1)
                symbol = symbol.replace('..', '::')
                symbol = trim_hash_from_symbol(symbol)
                kernel_functions.append((symbol, addr, size, 0))
            else:
                try:
                    symbol = parse_mangled_name(name)
                    kernel_functions.append((symbol, addr, size, 0))
                except cxxfilt.InvalidName:

cxxfilt

Python interface to c++filt / abi::__cxa_demangle

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis

Popular cxxfilt functions

Similar packages