It's a pity it isn't possible to set a list of functions for certain functions pointers so wcs.py could print a better result.
I found a nice tool[1] on GitHub.
I run it on one of my embedded projects and after a couple[2] of fixes,
it eventually printed some good output.
There were many unresolved functions, mainly from libc, C runtime, interrupts. I defined all of them in .msu, so now in the final output
there aren't unresolved functions.
Now there's another big problem. Many functions have an unbounded stack
usage and I'm quite sure this depends on function pointers.
For example, I use this[3] printf library. It uses function pointer to
emit characters: sprintf calls _vsnprintf() with _out_buffer() function pointer; printf calls _vsnprintf() with _out_char() function pointer.
So sprintf-like functions have an unbounded stack usage, because the
poor tool wcs.py isn't able to understand that there are only a few possibilities for the first argument (the function pointer) of
_vsnprintf().
It's a pity it isn't possible to set a list of functions for certain functions pointers so wcs.py could print a better result.
On 18/11/21 3:30 am, pozz wrote:
I found a nice tool[1] on GitHub.
I run it on one of my embedded projects and after a couple[2] of
fixes, it eventually printed some good output.
There were many unresolved functions, mainly from libc, C runtime,
interrupts. I defined all of them in .msu, so now in the final output
there aren't unresolved functions.
Now there's another big problem. Many functions have an unbounded
stack usage and I'm quite sure this depends on function pointers.
For example, I use this[3] printf library. It uses function pointer to
emit characters: sprintf calls _vsnprintf() with _out_buffer()
function pointer; printf calls _vsnprintf() with _out_char() function
pointer.
So sprintf-like functions have an unbounded stack usage, because the
poor tool wcs.py isn't able to understand that there are only a few
possibilities for the first argument (the function pointer) of
_vsnprintf().
It's a pity it isn't possible to set a list of functions for certain
functions pointers so wcs.py could print a better result.
It's not just function pointers (in fact the printf thing should be resolvable), it's recursion, alloca(), variable-sized arrays (a gcc extension), and other things. In general it is not a computable problem.
pozz <pozzugno@gmail.com> writes:
It's a pity it isn't possible to set a list of functions for certain
functions pointers so wcs.py could print a better result.
I think MISRA C disallows function pointers, partly for this reason.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 84:14:43 |
Calls: | 6,658 |
Calls today: | 4 |
Files: | 12,203 |
Messages: | 5,333,601 |
Posted today: | 1 |