Tuesday, 2 August 2016

OpenWRT Enable the CoreDump

Run these commands from your target system

1. Remove the limitation of dump
 ulimit -c unlimited

2. Indicate system to dump a core
touch /.init_enable_core

3. Set the path of dumped core
sysctl -w "kernel.core_pattern=/tmp/%e.%p.%s.%t.core"


These message would show on crash of process:

Segmentation fault (core dumped) root@XXX:~# ls /tmp/*.core demo_crash.5486.11.1470130615.core

2 comments:

  1. is it possible to analyse on a host machine a coredump produced on the target machine? I could not build an image with gdb in it that fits the space available on the flash of the target.

    ReplyDelete
  2. No need to build gdb for the router.
    Just copy the binary onto your build-computer and run gdb from the existing toolchain:
    ./staging_dir/toolchain-mips_24kc_gcc-8.3.0_musl/bin/mips-openwrt-linux-gdb build_dir/target-mips_24kc_musl/resolveip/resolveip /tmp/resolveip.6536.11.1573199523.core

    ReplyDelete