sms daemon segfaults on execution like this e.g. (also fails with file as opposed to pg driver:
root@OpenWrt:~# /usr/sbin/smsd -t 1 -u postgres -p postgres -c 192.168.122.165 -d api_dev -s sms -m pq -b IN
smsd - version 1.5.3 from gnokii 0.6.32git
Segmentation fault
A first crude debugging using this command to start gdbserver on the Router
gdbserver :9000 /usr/sbin/smsd -u postgres -p postgres -c 192.168.122.165 -d api_dev -s sms -m pq -0 -b IN
and this command in paul@opwnwrt-build:~/openwrt, after having compiled the source like described here:
./scripts/remote-gdb 192.168.1.187:9000 ./build_dir/target-*/busybox-*/busybox
(gdb) run
Starting program: /home/paul/openwrt/build_dir/target-mips_34kc_musl-1.1.15/busybox-1.24.2/busybox
[New Thread 7881.7882]
[New Thread 7881.7883]
[New Thread 7881.7884]
Thread 2 "smsd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7881.7882]
memset (dest=0x77d04780, c=<optimized out>, n=174440) at src/string/memset.c:76
76 *(u64 *)(s+8) = c64;
(gdb) where
#0 memset (dest=0x77d04780, c=<optimized out>, n=174440) at src/string/memset.c:76
#1 0x77ee969f in memset (__n=262624, __c=0, __d=<optimized out>) at /home/paul/openwrt/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/include/fortify/string.h:70
#2 gn_data_clear (data=<optimized out>) at gsm-common.c:703
#3 0x77ef4913 in NK6510_Initialise (state=0x77c97010) at nk6510.c:641
#4 0x77efe46f in NK6510_Functions (op=<optimized out>, data=0x0, state=0x77c97010) at nk6510.c:397
#5 0x77ed3aed in register_driver (driver=0x77f42ff0 <driver_nokia_6510>, model=0x77c97014 "6510", setupmodel=0x0, sm=0x77c97010) at gsm-api.c:91
#6 0x77ed3c99 in gn_gsm_initialise (sm=0x77c97010) at gsm-api.c:132
#7 0x77ed32bd in gn_lib_phone_open (state=0x77c97010) at libfunctions.c:175
warning: GDB can't find the start of the function at 0x4024c8.
GDB is unable to find the start of the function at 0x4024c8
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x4024c8 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
#8 0x004024c9 in ?? ()
(gdb)
Further investigations
- Apply knowledge from this article to compile & use libc and the other libraries with debugging symbols on the router.
- After enabling debugging symbols use valgrind to print memory allocation problems.
sms daemon segfaults on execution like this e.g. (also fails with
fileas opposed topgdriver:A first crude debugging using this command to start
gdbserver on theRouterand this command in
paul@opwnwrt-build:~/openwrt, after having compiled the source like described here:Further investigations