NationalSecurityAgency/ghidra · error
%s: unknown demangling style `%s'\n
Error message
%s: unknown demangling style `%s'\n
What it means
c++filt's -s option accepts a demangling style name. The name is resolved by cplus_demangle_name_to_style(), which returns unknown_demangling if the string doesn't match any known style. The tool prints the error and returns exit code 1.
Source
Thrown at GPL/DemanglerGnu/src/demangler_gnu_v2_41/c/cxxfilt.c:217
break;
case 't':
flags |= DMGL_TYPES;
break;
case 'i':
flags &= ~ DMGL_VERBOSE;
break;
case 'v':
// print_version ("c++filt"); // Changed 10/31/23
printf ("c++filt 2.41\n"); // Changed 10/31/23
return 0;
case '_':
strip_underscore = 1;
break;
case 's':
style = cplus_demangle_name_to_style (optarg);
if (style == unknown_demangling)
{
fprintf (stderr, "%s: unknown demangling style `%s'\n",
program_name, optarg);
return 1;
}
cplus_demangle_set_style (style);
break;
}
}
if (optind < argc)
{
for ( ; optind < argc; optind++)
{
demangle_it (argv[optind]);
putchar ('\n');
}
return 0;
}View on GitHub (pinned to d5f144c24d)
Solutions
- Use a valid style name (run `c++filt --help` to see the list)
- Common valid styles: gnu-v3, auto, java, gnat, dlang, rust
- Fix the typo in the style name
Example fix
// before ./c++filt -s gnu3 // after ./c++filt -s gnu-v3
Defensive patterns
Strategy: validation
Validate before calling
// Validate the style name before passing to -s
#include <string.h>
static const char *valid_styles[] = {
"auto", "gnu", "lucid", "arm", "hp", "edg",
"gnu-v3", "java", "gnat", "dlang", "rust", NULL
};
static int is_valid_style(const char *s) {
for (int i = 0; valid_styles[i]; i++)
if (strcmp(valid_styles[i], s) == 0) return 1;
return 0;
}
// Use before calling the tool or calling cplus_demangle_name_to_style
if (!is_valid_style(optarg)) {
fprintf(stderr, "Unknown style '%s'. Valid: auto, gnu-v3, java, ...\n", optarg);
exit(1);
} Type guard
static int is_known_demangle_style(const char *name) {
return cplus_demangle_name_to_style(name) != unknown_demangling;
} Try / catch
enum demangling_styles style = cplus_demangle_name_to_style(optarg);
if (style == unknown_demangling) {
fprintf(stderr, "Unknown style '%s'. Use --help for valid styles.\n", optarg);
return EXIT_FAILURE;
}
cplus_demangle_set_style(style); Prevention
- Check style names against a known list before applying
- Provide a --help listing of valid styles
- Use auto style to let the demangler detect the format automatically
When it happens
Trigger: User passes `-s bogus`; cplus_demangle_name_to_style(optarg) returns unknown_demangling. Valid styles include auto, gnu, lucid, arm, hp, edg, gnu-v3, java, gnat, dlang, rust.
Common situations: Typo in the style name (e.g. `gnu3` instead of `gnu-v3`); using a style name from a different version; misunderstanding the supported style list.
Related errors
- Failed: %s (status %d)\n
- Failed: %s\n
- Internal error: no symbol alphabet for current style\n
- %s: unrecognized option `--%s'
- %s: unrecognized option `%c%s'
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/141886c6f4a0a37b.
Report an issue: GitHub.