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

tests/memdbg.py: NetBSD support #595

Closed
0-wiz-0 opened this issue Jan 28, 2017 · 2 comments
Closed

tests/memdbg.py: NetBSD support #595

0-wiz-0 opened this issue Jan 28, 2017 · 2 comments

Comments

@0-wiz-0
Copy link

0-wiz-0 commented Jan 28, 2017

NetBSD does provide the backtrace set of functions, but they are in libexecinfo and have slightly different API.
Here's a patch that makes a test run not complain about the missing backtrace function.

--- tests/memdbg.py.orig        2016-02-15 10:25:58.000000000 +0000
+++ tests/memdbg.py
@@ -18,16 +18,16 @@ _ffi.cdef(
 
     int  CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
 
-    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);
+    size_t backtrace(void **buffer, size_t size);
+    char **backtrace_symbols(void *const *buffer, size_t size);
+    void backtrace_symbols_fd(void *const *buffer, size_t size, int fd);
     """)  # noqa
 _api = _ffi.verify(
     """
     #include <openssl/crypto.h>
     #include <stdlib.h>
     #include <execinfo.h>
-    """, libraries=["crypto"])
+    """, libraries=["crypto", "execinfo"])
 C = _ffi.dlopen(None)
 
 verbose = False

However, I'm not sure how to make that patch cross-platform. Any suggestions?

@moubctez
Copy link

moubctez commented May 9, 2017

Slightly change the patch:

libraries=["crypto", "execinfo"] if sys.platform.startswith('netbsd') else ["crypto"]

@0-wiz-0
Copy link
Author

0-wiz-0 commented May 14, 2017

@moubctez: thanks, that's a start.
Any suggestions about the differing function prototypes?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants