pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

strange threading behavior with 86Box?



Hello, all!

I just installed NetBSD 10.0 amd64 on real hardware, and tried to compile few  things :0

One of them is 86Box

https://github.com/86Box/86Box

I cloned  git up to  6694c39f857526df8a43362689b4ec443f550e97

Then I run into few problems and make  attached patch

with it 86Box compiles, but fails to run normally.

BUT if I run it under gdb it shows its qt window (btw cmake was failing to find qt5Linguist, so I edited CmakeCache.txt before qt5 build)

https://pasteboard.co/nmjCC0hhNLpZ.png

SDL version also builds, but it does not show SDL window under gdb ... only textual simple monitor.

Unfortunately, core file generated by crashing 86Box is not very interesting - show "??" instead of function names

Any ideas how to debug this?


diff --git a/src/include/86box/bswap.h b/src/include/86box/bswap.h
index 78183d137..ac442db72 100644
--- a/src/include/86box/bswap.h
+++ b/src/include/86box/bswap.h
@@ -60,17 +60,18 @@
 		    (((x) & 0x00ff000000000000ull) >> 40) |		\
 		    (((x) & 0xff00000000000000ull) >> 56)))
 
-static __inline uint16_t
+#ifndef __NetBSD__
+static __inline uint16_t 
 bswap16(uint16_t x)
 {
-#if defined (__GNUC__) || defined (__clang__)
+#if defined (__GNUC__) || defined (__clang__) 
     return __builtin_bswap16(x);
 #else
     return bswap_16(x);
 #endif
 }
 
-static __inline uint32_t
+static __inline uint32_t 
 bswap32(uint32_t x)
 {
 #if defined (__GNUC__) || defined (__clang__)
@@ -80,7 +81,7 @@ bswap32(uint32_t x)
 #endif
 }
 
-static __inline uint64_t
+static __inline uint64_t 
 bswap64(uint64_t x)
 {
 #if defined (__GNUC__) || defined (__clang__)
@@ -89,6 +90,7 @@ bswap64(uint64_t x)
     return bswap_16(x);
 #endif
 }
+#endif
 
 static __inline void
 bswap16s(uint16_t *s)
@@ -238,4 +240,4 @@ cpu_to_be32wu(uint32_t *p, uint32_t v)
 #undef le_bswaps
 #undef be_bswaps
 
-#endif /*BSWAP_H*/
+#endif /*BSWAP_H*/
\ No newline at end of file
diff --git a/src/include/86box/thread.h b/src/include/86box/thread.h
index a71d03913..aa26836bf 100644
--- a/src/include/86box/thread.h
+++ b/src/include/86box/thread.h
@@ -23,7 +23,7 @@
 extern "C" {
 #endif
 
-#ifdef __APPLE__
+#ifdef __APPLE__ 
 #    define thread_t                            plat_thread_t
 #    define event_t                             plat_event_t
 #    define mutex_t                             plat_mutex_t
diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp
index e48cb1f3e..b946f7ba0 100644
--- a/src/qt/qt_platform.cpp
+++ b/src/qt/qt_platform.cpp
@@ -812,7 +812,9 @@ plat_set_thread_name(void *thread, const char *name)
     pthread_setname_np(truncated);
 #    elif defined(Q_OS_OPENBSD)
     pthread_set_name_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
-#    else
+#    elif defined(Q_OS_NETBSD)
+    pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), "%s", truncated);
+#elif
     pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
 #    endif
 #endif
diff --git a/src/unix/unix.c b/src/unix/unix.c
index d4d73817f..7f9311a62 100644
--- a/src/unix/unix.c
+++ b/src/unix/unix.c
@@ -782,7 +782,7 @@ plat_init_rom_paths(void)
 
         strncpy(xdg_rom_path, getenv("XDG_DATA_HOME"), 1024);
         path_slash(xdg_rom_path);
-        strncat(xdg_rom_path, "86Box/", 1024);
+        strncat(xdg_rom_path, "86Box/", 1023);
 
         if (!plat_dir_check(xdg_rom_path))
             plat_dir_create(xdg_rom_path);
@@ -1394,12 +1394,16 @@ plat_set_thread_name(void *thread, const char *name)
     if (thread) /* Apple pthread can only set self's name */
         return;
     char truncated[64];
+#elif defined __NetBSD__
+    char truncated[64];
 #else
     char truncated[16];
 #endif
     strncpy(truncated, name, sizeof(truncated) - 1);
 #ifdef __APPLE__
     pthread_setname_np(truncated);
+#elif defined __NetBSD__
+pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
 #else
     pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
 #endif
diff --git a/src/unix/unix_serial_passthrough.c b/src/unix/unix_serial_passthrough.c
index 0184ebbc0..831648ef6 100644
--- a/src/unix/unix_serial_passthrough.c
+++ b/src/unix/unix_serial_passthrough.c
@@ -146,8 +146,10 @@ plat_serpt_set_params(void *priv)
         BAUDRATE_RANGE(dev->baudrate, 9600, 19200, B9600);
         BAUDRATE_RANGE(dev->baudrate, 19200, 38400, B19200);
         BAUDRATE_RANGE(dev->baudrate, 38400, 57600, B38400);
+#ifndef __NetBSD__
         BAUDRATE_RANGE(dev->baudrate, 57600, 115200, B57600);
         BAUDRATE_RANGE(dev->baudrate, 115200, 0xFFFFFFFF, B115200);
+#endif
 
         term_attr.c_cflag &= ~CSIZE;
         switch (dev->data_bits) {


Home | Main Index | Thread Index | Old Index