[cfe-dev] How to debug Clang code

Jean-Daniel Dupas devlists at shadowlab.org
Tue Mar 20 01:47:22 PDT 2012


That, and make sure you are using a debug build of clang (with debug symbols).

If you want to now what the -cc1 command line should be, you can launch clang with the -### argument, It will print the corresponding -cc1 invocation and exit.

Le 20 mars 2012 à 07:58, Nikola Smiljanic a écrit :

> Make sure your argument is "-cc1 test.c" as that will invoke the
> frontend, without it clang acts as a compiler driver and invokes
> another instance of clang.
> 
> On Tue, Mar 20, 2012 at 5:37 AM, srikanth vaindam
> <srikanth.vaindam at gmail.com> wrote:
>> Hi,
>> I am a student and new to Clang. I want to know the development tools that
>> you use.
>> what I exactly wanted to know is, how do you debug the code.
>> 
>> 
>> I am trying to debug Clang using Eclipse. I have put a break point in
>> clang/lib/lex/preprocessor.cpp at the preprocessor's constructor.
>> 
>> I have set a "test.c" file as an argument in the debug configurations.
>> Went to Run-> Debug As-> Local C/C++ Application.
>> It asked "Choose local application to debug". I chose "clang" and clicked
>> OK.
>> It started building the code. build completed.
>> Stopped at main() in the debug window. (No source available for main())
>> After some step overs, it says "terminated: gdb Debugger (Exited. Exit
>> code=255)"
>> 
>> I am not taken to the clang code (preprocessor code). can someone please
>> tell me how to debug the clang code.? I want to see the code flow in clang.
>> and how clang is constructing the AST.
>> 
>> 
>> Best Regards,
>> Srikanth Vaindam
>> 
>> 
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- Jean-Daniel








More information about the cfe-dev mailing list