Skip to content

Failure to read symbols inside docker-container due to broken /proc/pid/exe link #307

@ppershing

Description

@ppershing

Hi. I encountered this problem while trying to trace binary inside docker-container.
The problem manifests as rather misleading

Cannot select a snapshot symbol because magic-trace can't find that executable's symbol table. Was it built without debug info, or with debug info magic-trace doesn't understand?

message which doesn't indicate failure to open the executable but strace helped here to find the root cause as running the binary outside of container worked well.

The reason is that /proc/<pid>/exe contains a path used to launch the process inside the container which means this path refers to directories inside the container. This symlink is not valid outside of the container

I believe the problem can be fixed by skipping Core_unix.readlink here

|> fun pid -> Core_unix.readlink [%string "/proc/%{pid#Pid}/exe"]
and just directly read the contents of the /proc/<pid>/exe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions