# Debugging using lldb

**URL:** <https://forums.swift.org/t/debugging-using-lldb/18046>\
**Category:** LLDB\
**Created:** [November 16, 2018, 12:43pm UTC](https://forums.swift.org/t/debugging-using-lldb/18046 "2018-11-16T12:43:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [November 16, 2018, 12:43pm UTC](https://forums.swift.org/t/debugging-using-lldb/18046/1 "2018-11-16T12:43:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joekiller](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joekiller/32/5271_2.png) [@joekiller](https://forums.swift.org/u/joekiller)\
**Post date:** [November 16, 2018, 8:34pm UTC](https://forums.swift.org/t/debugging-using-lldb/18046/2 "2018-11-16T20:34:32Z")

</div>

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](https://wiki.archlinux.org/index.php/Security#ptrace_scope)

> <https://stackoverflow.com/questions/19215177/how-to-solve-ptrace-operation-not-permitted-when-trying-to-attach-gdb-to-a-pro>

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [November 22, 2018, 11:52am UTC](https://forums.swift.org/t/debugging-using-lldb/18046/3 "2018-11-22T11:52:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [November 27, 2018, 12:05pm UTC](https://forums.swift.org/t/debugging-using-lldb/18046/4 "2018-11-27T12:05:19Z")

</div>

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.
