Don Cragun wrote:
>>     int backtrace(void **buffer, int size);
>>     char **backtrace_symbols(void *const *buffer, int size);
>>     void backtrace_symbols_fd(void *const *buffer, int size, int fd);
>>     int addrtosymstr(uintptr_t addr, char *buffer, int len);
> 
> Shouldn't the "int"s here that refer to buffer sizes be "size_t"s or
> "ssize_t"s instead?  Or is there really an intent here to limit these
> buffer sizes to 32 bits on 64-bit architectures?

The first three interfaces come from glibc; I'm copying them verbatim.
I seriously doubt the restriction of having less than 2GB separate
stack frames  in a stack trace will prove limiting anytime soon.
In the last interface the length of the returned string is limited
by len; I expect 2GB should be adequate to represent the filename,
library name and symbol + offsets for some time to come.

> 
> Do any of these functions ever fail?  I see no mention of error returns
> nor of errno settings.  If would seem like attempts to backtrace
> through a corrupted stack could lead to failures.
> 
>       Cheers,
>       Don

Errno isn't set to any useful value by these functions.
Our implementation attempts to protect against corrupted
stacks; there is no defined error semantics for these
functions.  Our addrtosymstr function does a best effort
job of printing the address; at worstit simply
prints the hex address in square brackets.

- Bart



-- 
Bart Smaalders                  Solaris Kernel Performance
barts at cyber.eng.sun.com              http://blogs.sun.com/barts

Reply via email to