Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report symEach errors in OS_SymbolTableDump_Impl #888

Closed
skliper opened this issue Mar 11, 2021 · 3 comments · Fixed by #915 or #927
Closed

Report symEach errors in OS_SymbolTableDump_Impl #888

skliper opened this issue Mar 11, 2021 · 3 comments · Fixed by #915 or #927
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Mar 11, 2021

Is your feature request related to a problem? Please describe.
Errors not reported:

(void)symEach(sysSymTbl, OS_SymTableIterator_Impl, 0);

Describe the solution you'd like
Check for non-NULL, report error (write to file?), return error.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review

@jphickey
Copy link
Contributor

Looked up the VxWorks docs for symEach .... This function is defined a little oddly. It returns NULL on success and on an error it returns a pointer to the symbol it last visited. However as far as I can tell the only way for this to happen is for the user callback function to return false.

With the way the callback is currently implemented, all errors are currently reported at least via OS_DEBUG() and also possibly translated to an OS_ERROR response already.

It looks like this function can also return NULL if the symbol table ID itself was invalid - but this is getting the value direct from vxWorks (sysSymTbl global) and therefore cannot be bad. It's also not clear now this is differentiated from the success case, since both return NULL.

My recommendation is that we leave the call to symEach() as it is. The VxWorks API here is not ideal - return value is ambiguous (NULL can mean success or error, and also non-NULL does not necessarily mean an error). It is being handled as well as can be done with the limitations of this underlying API design.

The only question I can see is whether exceeding the size_limit should be treated as an error or not. Currently it just stops at the size limit - there is a debug statement to say the limit was reached, but the overall function will still return OS_SUCCESS. A case could be made that this should be an error.

@skliper
Copy link
Contributor Author

skliper commented Mar 17, 2021

Ping @klystron78 - is this response sufficient to close the issue?

@jphickey
Copy link
Contributor

After reviewing the function here -- there are some better return codes we could propagate up the stack. In particular I think if the size limit was insufficient we should not be returning OS_SUCCESS.

I will submit a PR to address that shortly.

jphickey added a commit to jphickey/osal that referenced this issue Mar 17, 2021
Improve the error codes from this function.

- Introduces a new error "OS_ERR_OUTPUT_TOO_LARGE" if the size
limit was insufficient (instead of OS_SUCCESS).
- Return OS_ERROR if an empty file was written - this likely
indicates some fundamental issue with the VxWorks symbol table.
- Return OS_ERR_NAME_TOO_LONG if one of the symbol names was
too long, (instead of generic OS_ERROR).

Improve unit test to check for/verify these responses.
jphickey added a commit to jphickey/osal that referenced this issue Mar 17, 2021
Improve the error codes from this function.

- Introduces a new error "OS_ERR_OUTPUT_TOO_LARGE" if the size
limit was insufficient (instead of OS_SUCCESS).
- Return OS_ERROR if an empty file was written - this likely
indicates some fundamental issue with the VxWorks symbol table.
- Return OS_ERR_NAME_TOO_LONG if one of the symbol names was
too long, (instead of generic OS_ERROR).

Improve unit test to check for/verify these responses.
astrogeco added a commit that referenced this issue Mar 29, 2021
Fix #888, better return codes from OS_SymbolTableDump_Impl
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#888, Add typedef for function return status codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants