Thomas Klausner
2014-05-01 00:12:45 UTC
Hi!
I found out that the prototypes for backtrace() and backtrace_symbol()
differ on some operating systems.
These are the same:
Linux:
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);
Mac OS X:
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void* const* array, int size, int fd);
SunOS:
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);
This one's different:
NetBSD:
size_t backtrace(void **addrlist, size_t len);
char **backtrace_symbols(void * const *addrlist, size_t len);
int backtrace_symbols_fd(void * const *addrlist, size_t len, int fd);
The main difference is that on NetBSD, size_t is used for most
arguments that are int on the other systems; also,
backtrace_symbols_fd returns an int.
I'd like to test for the difference int <-> size_t in a configure
script so I can get integer type/sign conversion-warnings free code on
all these operating systems.
I'm however not sure how to do this. Does anyone have a suggestion?
Thanks,
Thomas
I found out that the prototypes for backtrace() and backtrace_symbol()
differ on some operating systems.
These are the same:
Linux:
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);
Mac OS X:
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void* const* array, int size, int fd);
SunOS:
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);
This one's different:
NetBSD:
size_t backtrace(void **addrlist, size_t len);
char **backtrace_symbols(void * const *addrlist, size_t len);
int backtrace_symbols_fd(void * const *addrlist, size_t len, int fd);
The main difference is that on NetBSD, size_t is used for most
arguments that are int on the other systems; also,
backtrace_symbols_fd returns an int.
I'd like to test for the difference int <-> size_t in a configure
script so I can get integer type/sign conversion-warnings free code on
all these operating systems.
I'm however not sure how to do this. Does anyone have a suggestion?
Thanks,
Thomas