[lldb-dev] LLDB fails to load C++ Plugin (sharedlib) - error: this file does not represent a loadable dylib

Bewoayia Kebianyor via lldb-dev lldb-dev at lists.llvm.org
Fri Jun 8 02:52:14 PDT 2018


Hello Everyone,

I started looking into the LLDB with the intention of adding custom 
commands for my SW debugging purpose. For a better Understanding let me 
explain what I intend to do. I have an source file generated automatically 
from a Model with certain anotations added as comments in the code. This 
code will would be compiled and in error cases debugged. When debugging I 
may have to set breakpoints at certain statements in the code based on the 
anotations incerted by the code generator. This is done by specifying the 
source file and the line number. I Use CLANG to get the line number and 
source file for the comments. 

I would like to have custom commands for this and internally map the to 
already existing commands  e.g. "breakpoint set -f -l". I found some 
examples for python, and for c++ I only found the example 
"lldb/examples/plugins/commands/fooplugin.cpp" for writing C++ plugin 
(dynLib) shipped with the LLDB source. In this example adding a new 
commands was straight forward and in the DoExecute function, I call the 
interpreter to handle a breakpoint command. I intend to use C++ rather 
than Python.

This works fine for a simple shared lib (Simple modification of the 
Example provided in LLDB. In Do execute call interpreter to handle a 
breakpoint command). However if I add other C++ sources which does XML 
parsing, CLANG RecursiveASTVisitor etc to the Library, creating the shared 
library with eclipse is sucessful. I can link the created library to an 
application and it works well. However when I load this in lldb with the 
command ==> plugin load 
"/home/bkebianyor/eclipse-workspace/Model_LLDB_Debugger/Debug/libModel_LLDB_Debugger.so", 
I get the error message: "error: this file does not represent a loadable 
dylib".


#Loading the shared lib that is linked just to the liblldb.so - SUCESSFUL
(lldb) 
(lldb) plugin load 
/home/bkebianyor/eclipse-workspace/DynLib/Debug/libDynLib.so
(lldb)

#Loading the shared lib that is linked just to the liblldb.so + 
libxerces-c-3.2.so - FAILS

(lldb) plugin load 
"/home/bkebianyor/eclipse-workspace/Model_LLDB_Debugger/Debug/libModel_LLDB_Debugger.so"
error: this file does not represent a loadable dylib

I have searched for this error on google, but could not find out how to 
resolve this error. Most answers pointed to a mismatch of the lldb version 
in the shared lib to be loaded and that linked to lldb, but that is not my 
case. I am using lldb-5.0.2 and LLVM/CLANG 5.0.2 toolcahin on Linux 
16.04.1-Ubuntu and Eclipse IDE. LLVM was built with SHARED_LIBS set to ON.

Would be grateful for an answer.


Thanks and Regards,

Bewoayia

-------------
Dipl.- Ing. Bewoayia Kebianyor
Researcher - Hardware/Software Design Methodology Group

OFFIS e.V. - Institut für Informatik
FuE Bereich Verkehr | R&D Division Transportation
Escherweg 2 - 26121 Oldenburg - Germany
Phone/Fax.: +49 441 9722 237/-278
E-Mail: bewoayia.kebianyor at offis.de
URL: http://www.offis.de

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender), Prof. Dr. 
techn. Susanne Boll-Westermann, Prof. Dr. Werner Damm, Prof. Dr.-Ing. Axel 
Hahn, Prof. Dr.-Ing. Andreas Hein, Prof. Dr. Sebastian Lehnhoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180608/720c4898/attachment.html>


More information about the lldb-dev mailing list