[LLVMdev] eclipse and gdb

Stefan Hepp stefan at stefant.org
Wed Jul 17 06:08:24 PDT 2013


Hi,

I am using Eclipse to edit the files, and I used it to debug with gdb as 
well (but I went back to gdb on the command line, Eclipse GDB UI is just 
too slow and buggy for me ..).

You need to exclude the clang preprocessor/.. stress tests from the 
sources, otherwise the indexer will freeze Eclipse. You should also 
remove some autogenerated CMake project subdirectories, otherwise your 
files will be opened multiple times when navigating the sources, which 
*will* cause you to loose/overwrite changes when you save.

Be aware that building the project will rerun CMake if you make any 
changes to the CMake files, which will regenerate your Eclipse project 
files, i.e., your Resource Exclusion settings will be lost, i.e., the 
indexer will get stuck the next time again. You could maybe save the 
project files to a different directory, I personally just disabled 
building the project in Eclipse (I use a build directory separate from 
the Eclipse cmake build dir).

Here is basically how I set up my Eclipse project:

- Use File->Import->General->Import Existing Project. Do not check Copy 
Sources.
- Setup Resource->Resource Filters in Project settings on project root,
   - Exclude */clang/test and */clang/INPUTS project relative paths 
(recursive)
   - Do not use 'Location', causes nullpointer exception on file save
   Make sure Indexer does not run before you create the filters!

   - Delete the [Targets] and [Subprojects] directories (or whatever
     they are called)
   - Setup project settings:
     - Setup coding style to new derivative from GNU, edit line-breaks 
settings
     - Setup Project Include-path settings: add following paths and defines:
       - /usr/include
       - /usr/include/c++/4.6
       - /usr/include/c++/4.6/x86_64-linux-gnu
       - /usr/include/x86_64-linux-gnu
       - GET_REGINFO_MC_DESC, GET_REGINFO_HEADER,
         GET_REGINFO_TARGET_DESC, GET_ASSEMBLER_HEADER,
         GET_MATCHER_IMPLEMENTATION
     - Setup Texteditor Font to Deja Sans Mono or any other font that
       has same character width for normal and bold text!
     - Setup dictionary for 'C++ Spell Checker'
       General spell checker dictionary does not remember words.


For debugging, you might want to consider the 'GDB (DSF)' launcher, 
which supports pretty printing. However, I found this way of running GDB 
a bit unstable (You may need to restart Eclipse if your Variable view 
stays empty during debugging), and back then I had some problems when 
compiling LLVM/clang as shared libraries.

I made some initial efforts to create GDB pretty printing python scripts 
similar to STL pretty printing for the LLVM containers. It is far from 
complete, but it has initial support for some of the most common 
containers. I had some problems with pretty printing for STL in the past 
when I compiled LLVM with clang, but I think it works now with the 
latest clang/LLVM/gdb versions.

You can find my code for pretty printing for GDB for LLVM together with 
some infos on how to setup Eclipse for debugging here, if you want to 
give it a go:

https://github.com/t-crest/patmos-llvm/tree/master/utils/gdb

Basically, you need to check out the 'python' folder somewhere, check 
out the 'gdbinit' file, modify the paths to your system and make your 
gdb load the gdbinit file (beware, the Eclipse Standard Process launcher 
and the GDB (DSF) launcher seem to behave differently regarding whether 
they load the ~/.gdbinit file by default or not).


Cheers,
  Stefan

On 07/17/2013 10:43 AM, Tilmann Scheller wrote:
> Hi Reed,
>
> On Jul 17, 2013, at 3:19 AM, Reed Kotler <rkotler at mips.com
> <mailto:rkotler at mips.com>> wrote:
>
>> On 07/16/2013 06:01 PM, Reed Kotler wrote:
>>> The Eclipse indexer seems to get stuck in the Clang unittests/AST
>>>
>>
>> In Eclipse you can tell it that a given directory is derived, and then
>> it won't try and index it.
>>
>> Probably the more complex clang tests are too involved for the indexer.
> Yeah, I vaguely remember having to exclude some clang tests from
> indexing because they take way too long/way too much memory to index.
>
> Regards,
>
> Tilmann
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list