[lldb-dev] Dealing with executable libraries

Stefan Kratochwil via lldb-dev lldb-dev at lists.llvm.org
Mon Oct 5 03:43:08 PDT 2015


I am wondering how to deal with binaries that are both executable and
dynamic objects, such as many executables under /usr/sbin.

When I try to attach to a process (e.g. apache2) using the method
lldb::SBTarget::AttachToProcessWithID() (C++ flavor of the LLDB
ScriptingBridge), the method ObjectFileELF::CalculateType() returns
eTypeSharedLibrary, which results in an error in my application.

The error object, which is given by
lldb::SBTarget::AttachToProcessWithID() has the Fail() flag set, but no
CString() with an actual cause. The lldb::SBProcess::IsValid() method
returns false.

Right now I am short circuiting CalculateType() by returning
eTypeExecutable when LLDB detects a dynamically linked object, but there
must be a less intrusive solution. Is there a way to force LLDB to
recognize such executables as "real" executables, without tampering LLDB

Thanks in advance!


More information about the lldb-dev mailing list