Docker Community Forums

Share and learn in the Docker community.

GDB breakpoints don't work, "Error disabling address space randomization"


(Andyfischer) #1

Expected behavior

Within the container, debug a program using GDB, and try to use breakpoints.

Actual behavior

Setting a breakpoint has no effect (the program doesn’t pause at the breakpoint). Also, when running in GDB, this error shows up:

warning: Error disabling address space randomization: Operation not permitted

pinata diagnose -u

~/bugrepro $ pinata diagnose -u
OS X: version 10.11.1 (build: 15B42)
Docker.app: version v1.11.1-beta13.1
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160601-152646.tar.gz
Most specific failure is: No error was detected
Your unique id is: FFADB664-0E7F-4FAD-BF27-912F604562AE
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. Build and run this self-contained Dockerfile:
from ubuntu:14.04

run apt-get update && apt-get upgrade -y
run apt-get install -y build-essential gdb

run mkdir /workspace
workdir /workspace
run echo "int main() { return 0; }" > main.c
run gcc main.c -g -o main
run echo "br main\nrun" > gdb-commands

cmd gdb main --command gdb-commands

(Gaijin03) #2

Try adding --security-opt seccomp=unconfined to your docker run command. This solved it for me.
Credit goes to @CameronTaggart on SO: http://stackoverflow.com/questions/35860527/warning-error-disabling-address-space-randomization-operation-not-permitted#comment62818827_35860527