demangler/gcc3+: when the parameter isn't found, return a useful error.

after the last argument, get_next_argument() would call get_next_argument_gcc3(),
see a failure, then call get_next_argument_gcc2(). Ideally we could make
different cookies for gcc2 and gcc3+ demanglers, thus avoiding this issue.

Change-Id: I3904e008a0b6ba627940fb9bca1d44ddbafbcbd0
Reviewed-on: https://review.haiku-os.org/742
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2018-12-02 21:35:09 +00:00
committed by waddlesplash
parent c9e6afb2af
commit 4bba0571c6
2 changed files with 4 additions and 2 deletions
@@ -46,8 +46,8 @@ get_next_argument(uint32* _cookie, const char* mangledName, char* name,
if (looks_like_gcc3_symbol(mangledName)) {
status_t error = get_next_argument_gcc3(_cookie, mangledName, name,
nameSize, _type, _argumentLength);
if (error == B_OK)
return B_OK;
if (error == B_OK || error == B_BAD_INDEX)
return error;
}
// fallback is gcc2
@@ -3726,6 +3726,8 @@ get_next_argument_gcc3(uint32* _cookie, const char* mangledName, char* name,
return B_BUFFER_OVERFLOW;
case ERROR_NO_MEMORY:
return B_NO_MEMORY;
case ERROR_INVALID_PARAMETER_INDEX:
return B_BAD_INDEX;
case ERROR_INTERNAL:
default:
return B_ERROR;