Hello, Thanks to Ted, Pavel and Greg for your reply with suggestion on how to resolve the issue. Greg's comment below help me to resolve the issue.
>I am guessing that maybe your libModel_LLDB_Debugger.so shared >library can't find all the dependencies it requires when being >loaded. Try making a small a.out file that links against this library >and try to run your a.out program. See if you see any errors when the >a.out tries to launch. While I already had an executable linking to the library, I didnot call functions referencing to Clang and XML parsing from the libModel_LLDB_Debugger.so. I simple called a function to print out the size of a map container I have within my lib. Which worked fine. Based on Greg's comment, I then extended this to call more functions which does the XML parsing and AST Parsing, then linking failed with error: undefined reference to `typeinfo for clang::ASTConsumer'. I searched on google and found out that this error has to do with the fact that LLVM and Clang are compiled with -fno-rtti by default and I am not explicitly setting the compile flag -fno-rtti in my project. I then added this to the "ASTConsumer derived class" in my project and it resolved the issue. Thanks once more. 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.kebian...@offis.de URL: http://www.offis.de -----Greg Clayton <clayb...@gmail.com> schrieb: ----- >An: Bewoayia Kebianyor <bewoayia.kebian...@offis.de> >Von: Greg Clayton <clayb...@gmail.com> >Datum: 08.06.2018 18:30 >Kopie: lldb-dev@lists.llvm.org >Betreff: Re: [lldb-dev] LLDB fails to load C++ Plugin (sharedlib) - >error: this file does not represent a loadable dylib > >Comments inlined below. > > >On Jun 8, 2018, at 2:52 AM, Bewoayia Kebianyor via lldb-dev ><lldb-dev@lists.llvm.org> wrote: >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. > >Did you know we have the ability to set breakpoints using source >regular expression? > >(lldb) breakpoint set --source-pattern-regexp "// breakpoint [0-9]+" >--file /path/to/foo.cpp > >This will use a regular expression to search the source file for the >regular expression you specify and have one breakpoint that has >multiple locations. > > 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. > >Do you even need this custom command given what I said above? > > 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/libMod >el_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/libMod >el_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. > >I am guessing that maybe your libModel_LLDB_Debugger.so shared >library can't find all the dependencies it requires when being >loaded. Try making a small a.out file that links against this library >and try to run your a.out program. See if you see any errors when the >a.out tries to launch. > >Greg > > > 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.kebian...@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 > _______________________________________________ >lldb-dev mailing list >lldb-dev@lists.llvm.org >http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev > > _______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev