Debugging using lldb

#1

Trying to build Swift 4.2 on ubuntu 16.04 on powerpc. However the build fails at swift-build-stage1:-

  • A core dump was generated by executing the swift-build-stage1, further analyzing the core dump and back tracing in gdb, the crash is found in swift based code (AssertCommon.swift).
  • Tried setting breakpoints and debugging in gdb, however the crash occurs but the breakpoints don't get hit. Also the trace flow traverses through some libraries, making debugging bit difficult.
  • Tried debugging using lldb debugger. However the executable doesn't run after setting breakpoint inside lldb. The following error is seen:
    (lldb) process launch
    error: process launch failed: 'A' packet returned an error: 8

Any pointers on how to go about the above issue and debugging using LLDB.

(Joseph Lawson) #2

This likely has to do with the ptrace_scope being tightened down on your system.

Something like the following should allow you to attach.

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

https://wiki.archlinux.org/index.php/Security#ptrace_scope

#3

Hi,

Thanks for the suggestion.

Im trying to debug Swift 4.2 build failures inside an Ubuntu 16.04 based Docker container. I tried the suggestions you mentioned and the ones in the attached link.
However, I am still facing the same issues as in my original post.

The attached link also mentions the following:-

If you are using Docker, you will probably need these options:
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined

Can you confirm that I will need to delete my current docker container and recreate another one using the above option?

#4

Deleted the existing docker container and recreated another docker container with the following options in order to try enable debugging:-

docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined -it --name swift42_debug_sarvesh ubuntu:16.04 bash

After this debugging could be done.

Thanks for the help and inputs. We can close this thread.