NationalSecurityAgency/ghidra · warning
Failed: %s
Error message
Failed: %s
What it means
The non-IN_GLIBCPP_V3 standalone-demangler path: each command-line argument is passed to cplus_demangle_v3(argv[i], options); when it returns NULL the program prints 'Failed: <input>' to stderr and moves on. Unlike the GLIBCPP variant it does not report a status code (that API does not surface one), so the message is a pure 'could not demangle' diagnostic. The process still returns 0.
Source
Thrown at GPL/DemanglerGnu/src/demangler_gnu_v2_24/c/cp-demangle.c:5979
/* Attempt to demangle. */
#ifdef IN_GLIBCPP_V3
s = __cxa_demangle (argv[i], NULL, NULL, &status);
#else
s = cplus_demangle_v3 (argv[i], options);
#endif
/* If it worked, print the demangled name. */
if (s != NULL)
{
printf ("%s\n", s);
free (s);
}
else
{
#ifdef IN_GLIBCPP_V3
fprintf (stderr, "Failed: %s (status %d)\n", argv[i], status);
#else
fprintf (stderr, "Failed: %s\n", argv[i]);
#endif
}
}
}
return 0;
}
#endif /* STANDALONE_DEMANGLER */
View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the input is an Itanium-ABI mangled C++ name (leading _Z) before invoking the demangler.
- Check the -s style and demangling options match the input's ABI/compiler.
- Use a demangler version matching the producing compiler to avoid ABI skew.
- Filter non-mangled tokens out of the batch so expected failures do not flood output.
Example fix
# before $ demangler _Z3foov plain_name Failed: plain_name # after - only feed mangled names $ printf '%s\n' _Z3foov | demangler foo()
Defensive patterns
Strategy: validation
Validate before calling
// Pre-filter to Itanium-ABI mangled names before invoking the standalone demangler
#include <string.h>
int looksMangled(const char *s) { return s && s[0] == '_' && s[1] == 'Z'; }
if (looksMangled(tok)) demangle_it(tok);
else fputs(tok, stdout); /* pass through unchanged */ Type guard
boolean looksLikeItaniumMangled(String s) {
return s != null && s.startsWith("_Z");
} Try / catch
// Standalone tool still returns 0; detect via stderr text.
if (rc == 0 && stderr_contains("Failed:")) {
/* one or more tokens were not valid mangled names; expected for mixed input */
} Prevention
- Filter to plausible mangled names (leading _Z) before demangling.
- Use a demangler version matching the producing compiler.
- Confirm the -s style matches the input's ABI.
- In batch runs, treat non-C++ tokens as expected failures.
When it happens
Trigger: Running the standalone demangler on a token that cplus_demangle_v3 rejects (returns NULL) - i.e. not a valid Itanium C++ mangled name given the selected options/style.
Common situations: Passing non-C++ symbols, already-demangled names, or malformed/truncated mangled names; selecting a demangling style (-s) incompatible with the input; using a demangler built for a different ABI than the compiler that produced the symbols.
Related errors
- Failed: %s (status %d)
- %s: error: too many @-files encountered
- %s: unknown demangling style `%s'
- %s: option `%s' is ambiguous
- %s: option `--%s' doesn't allow an argument
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/9629a0f09c3d6bf5.
Report an issue: GitHub.