svd is the culprit...
gcc ? are you using -g ?
gcc -g -o bestapp bestapp.c
Anything during the build raise errors or warnings ?
-Warn -Wextra -Werror
may help you spot something during the build.
have you enough room for valgrind ?
Name:
valgrind
Version:
3.18.1-1
Description:
Valgrind is an award-winning suite of tools for debugging and\\ profiling Linux programs. With the tools that come with Valgrind,\\ you can automatically detect many memory management and threading\\ bugs, avoiding hours of frustrating bug-hunting, making your\\ programs more stable. You can also perform detailed profiling,\\ to speed up and reduce memory use of your programs.\\ \\
Installed size:
1495kB
Dependencies:
libc, libpthread, librt
Categories:
development
Repositories:
base
Architectures:
aarch64_cortex-a53, aarch64_cortex-a72, aarch64_generic, arm_cortex-a15_neon-vfpv4, arm_cortex-a7, arm_cortex-a7_neon-vfpv4, arm_cortex-a8_vfpv3, arm_cortex-a9, arm_cortex-a9_neon, i386_pentium4, mips_24kc, mips_mips32, mipsel_24kc, mipsel_24kc_24kf, mipsel_74kc, mipsel_mips32, powerpc_464fp, powerpc_8540, x86_64
OpenWrt release:
OpenWrt-22.03.0
File size:
1493kB
License:
GPL-2.0+
Maintainer:
Felix Fietkau
Bug report:
Bug reports
Source code:
Sources
if so, recompile with -g and run it against valgrind ... this will give you the file and line number of the fault.
without -g
==48500== Memcheck, a memory error detector
==48500== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==48500== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==48500== Command: ./crash bang
==48500==
==48500== Use of uninitialised value of size 8
==48500== at 0x10919D: main (in /home/hostle/dbg/crash)
==48500==
==48500== Invalid read of size 4
==48500== at 0x10919D: main (in /home/hostle/dbg/crash)
==48500== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==48500==
==48500==
==48500== Process terminating with default action of signal 11 (SIGSEGV)
==48500== Access not within mapped region at address 0x0
==48500== at 0x10919D: main (in /home/hostle/dbg/crash)
==48500== If you believe this happened as a result of a stack
==48500== overflow in your program's main thread (unlikely but
==48500== possible), you can try to increase the size of the
==48500== main thread stack using the --main-stacksize= flag.
==48500== The main thread stack size used in this run was 8388608.
==48500==
==48500== HEAP SUMMARY:
==48500== in use at exit: 8 bytes in 1 blocks
==48500== total heap usage: 1 allocs, 0 frees, 8 bytes allocated
==48500==
==48500== LEAK SUMMARY:
==48500== definitely lost: 0 bytes in 0 blocks
==48500== indirectly lost: 0 bytes in 0 blocks
==48500== possibly lost: 0 bytes in 0 blocks
==48500== still reachable: 8 bytes in 1 blocks
==48500== suppressed: 0 bytes in 0 blocks
==48500== Rerun with --leak-check=full to see details of leaked memory
==48500==
==48500== Use --track-origins=yes to see where uninitialised values come from
==48500== For lists of detected and suppressed errors, rerun with: -s
==48500== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
with -g
hostle@dani:~/dbg$ valgrind ./crash bang
==48373== Memcheck, a memory error detector
==48373== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==48373== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==48373== Command: ./crash bang
==48373==
==48373== Use of uninitialised value of size 8 <-- 8 bytes ... generally a pointer
==48373== at 0x10919D: main (cb.c:18)
==48373==
==48373== Invalid read of size 4 <-- 4 bytes ..probably an uninitialized integer ptr
==48373== at 0x10919D: main (cb.c:18)
==48373== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==48373==
==48373==
==48373== Process terminating with default action of signal 11 (SIGSEGV)
==48373== Access not within mapped region at address 0x0
==48373== at 0x10919D: main (cb.c:18)
==48373== If you believe this happened as a result of a stack
==48373== overflow in your program's main thread (unlikely but
==48373== possible), you can try to increase the size of the
==48373== main thread stack using the --main-stacksize= flag.
==48373== The main thread stack size used in this run was 8388608.
==48373==
==48373== HEAP SUMMARY:
==48373== in use at exit: 8 bytes in 1 blocks
==48373== total heap usage: 1 allocs, 0 frees, 8 bytes allocated
==48373==
==48373== LEAK SUMMARY:
==48373== definitely lost: 0 bytes in 0 blocks
==48373== indirectly lost: 0 bytes in 0 blocks
==48373== possibly lost: 0 bytes in 0 blocks
==48373== still reachable: 8 bytes in 1 blocks
==48373== suppressed: 0 bytes in 0 blocks
==48373== Rerun with --leak-check=full to see details of leaked memory
==48373==
==48373== Use --track-origins=yes to see where uninitialised values come from
==48373== For lists of detected and suppressed errors, rerun with: -s
==48373== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)