How to debug segmentation fault?


I'm trying to get nodejs and node-npm working on my ZBT - WG1608 router.
I manged to get node (V16.19.0 V16.18.0 V16.17.1) running but when I request the npm version (npm -v) I get a "Segmentation fault". I have no clue how to get more information about that is causing this error so I tried multiple things (different versions, compiler settings, libraries) but I'm just guessing and get the same error every time. I hope someone can assist or point me to some documentation. I would like to get this to work or at least get more information on why it is not working.

The mipsel CPU does not have a FPU (floating Point Unit) which is a dependency according to the make file.
To get around this issue I modified the make file: Added '+' before @HAS_FPU, so it gets defined and node can be selected in the menuconfig for compilation.
I disabled SOFT_FLOAT in the target options of the menuconfig and inside the kernel_menuconfig I enabled floating point emulation + support for 64-bit floats. Floating point emulation was verified to be working on the target hardware.

ZBT - WG1608
Dual band WiFi router, 1x WAN, 4x LAN, 1x USB 3.0, 1x SIM, 1x microSDXC, 1x M-PCIE, 1x M.2
Flash: 32MB (SPI Flash)
CPU: MT7621A - MediaTek: MIPS 1004Kc @880MHz 2C/4T (Dual Core/Quad Thread)
Aliexpress product page (9-12-2022 €85.00 inc shipping to The Netherlands)