19 SEGV Debugging

V0.0.2

19.1 Histroy

  • 2014-08-12, rayoslee, release V0.0.2
    • add “strace”
  • 2014-07-03, rayoslee, release V0.0.1

19.2 FAQ

  1. How to debug “SEGV, segmentation fault..” ?
    • Check gcc version in Ubuntu side(NB or PC)

      /usr/local/arm_linux_4.2/bin/arm-none-linux-gnueabi-gcc -v

    • Check dependency library in Ubuntu side(NB or PC)

      /usr/local/arm_linux_4.2/bin/arm-none-linux-gnueabi-readelf -a hcitool | grep "Shared library:"
      or
      /usr/local/arm_linux_4.2/bin/arm-none-linux-gnueabi-objdump -x hcitool | grep "NEEDED"

    • Use “strace” to trace system calls and signals if you’d checked dependency lib.

      NEEDED      libexpat.so.1
      NEEDED      libpthread.so.0
      NEEDED      libc.so.0
      NEEDED      ld-uClibc.so.0
      
      288 /mnt/nand1-1 # dbus-daemon
      289 SEGV
      290 /mnt/nand1-1 # strace dbus-Vin frame rate 3 fps
      291 daemon
      292 execve("/mnt/nand1-1/bluez/bin/dbus-daemon", ["dbus-daemon"], [/* 18 vars */]) = 0
      293 open("/dev/urandom", O_RDONLY)          = 3
      294 read(3, "\361\245\330\301", 4)          = 4
      295 close(3)                                = 0
      296 mmap2(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40005000
      297 mprotect(0x2a000000, 274136, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
      298 stat("/usr/local/arm_linux_4.2/arm-none-linux-gnueabi/etc/ld.so.cache", 0xbedba7d8) = -1 ENOENT (No such file or directory)
      299 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x9f6e696c} ---
      300 +++ killed by SIGSEGV +++
      301 SEGV