{"record":{"id":"b02f137327e7e4c3","repo":"NationalSecurityAgency/ghidra","slug":"s-unknown-demangling-style-s","errorCode":null,"errorMessage":"%s: unknown demangling style `%s'","messagePattern":"(.+?): unknown demangling style `(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"GPL/DemanglerGnu/src/demangler_gnu_v2_24/c/cplus-dem.c","lineNumber":5217,"sourceCode":"\t\t  break;\n\t\tcase 't':\n\t\t  flags |= DMGL_TYPES;\n\t\t  break;\n\t\tcase 'i':\n\t\t  flags &= ~ DMGL_VERBOSE;\n\t\t  break;\n\t\tcase 'v':\n\t\t  printf (\"GNU %s (C++ demangler), version %s\\n\", program_name, program_version);\n\t\t  return 0;\n\t\tcase '_':\n\t\t  strip_underscore = 1;\n\t\t  break;\n\t\tcase 's':\n\t\t\tcurrent_demangling_style\n\t\t\t\t= cplus_demangle_name_to_style (optarg);\n\t\t\tif (current_demangling_style == unknown_demangling)\n\t\t\t{\n\t\t\t\tfprintf (stderr, \"%s: unknown demangling style `%s'\\n\",\n\t\t\t\t\tprogram_name, optarg);\n\t\t\t\treturn (1);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (optind < argc)\n\t{\n\t\tfor ( ; optind < argc; optind++)\n\t\t{\n\t\t\tdemangle_it (argv[optind]);\n\t\t\tputchar ('\\n');\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch (current_demangling_style)","sourceCodeStart":5199,"sourceCodeEnd":5235,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/GPL/DemanglerGnu/src/demangler_gnu_v2_24/c/cplus-dem.c#L5199-L5235","documentation":"The cplus-dem standalone driver accepts -s <style> to choose a demangling style (auto, gnu, lucid, arm, hp, edg, etc.). It calls cplus_demangle_name_to_style(optarg); if that returns unknown_demangling, the option string did not match any known style and the program prints this error and returns 1. It is an argument-validation failure at startup.","triggerScenarios":"Invoking the demangler with -s <value> where <value> is not one of the recognized style names. A typo, an unsupported style, or a style name from a different/older demangler version triggers it.","commonSituations":"Typo in the style name (e.g. 'gnu-v3' vs 'gnu'); passing a style that exists in a newer/older libiberty but not this build; confusing compiler style flags with demangler style flags; scripting that interpolates an empty or wrong variable as the style.","solutions":["Run the demangler with --help (or -h) to list the exact style names this build accepts.","Fix the typo / use the canonical style name (common ones: auto, gnu, lucid, arm, hp, edg, gnu-v3 where supported).","Omit -s to use the default (auto) style if you do not need a specific one.","Confirm the demangler binary version supports the desired style; rebuild/upgrade if needed."],"exampleFix":"# before\n$ c++filt -s gnu_v3 _Z3foov\n... unknown demangling style `gnu_v3'\n\n# after - use the exact name the build recognizes (often 'gnu-v3' or just default)\n$ c++filt -s gnu-v3 _Z3foov","handlingStrategy":"validation","validationCode":"// Validate the style name against the build's accepted set before invoking\nconst char *known[] = {\"auto\",\"gnu\",\"lucid\",\"arm\",\"hp\",\"edg\",\"gnu-v3\",NULL};\nint ok = 0; for (int i=0; known[i]; ++i) if (!strcmp(style, known[i])) { ok=1; break; }\nif (!ok) { fprintf(stderr,\"unsupported style: %s\\n\", style); exit(2); }\nexeclp(\"c++filt\", \"c++filt\", \"-s\", style, (char*)NULL);","typeGuard":"// (build-time) verify the style is recognized by this binary\nenum demangling_style st = cplus_demangle_name_to_style(optarg);\nbool isValidStyle = (st != unknown_demangling);","tryCatchPattern":"// CLI validation error with exit code 1; capture and handle in the caller\nint rc = run_child({\"c++filt\", \"-s\", style, symbol});\nif (rc != 0 && stderr_contains(\"unknown demangling style\")) {\n    // fall back to the default (auto) style or surface a config error\n}","preventionTips":["List accepted styles via --help before scripting a -s value.","Use canonical style names; watch for gnu_v3 vs gnu-v3 and case.","If a specific style is optional, default to 'auto' to avoid hard failures.","Pin the demangler version so the accepted style set is stable across builds."],"tags":["demangler","cli","arguments","validation","config"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}