[LLVMdev] How much memory clang llvm needs for debug compiling?

Nancy nancydreaming at gmail.com
Wed Jun 4 07:42:01 PDT 2014


On Wed, Jun 4, 2014 at 5:16 AM, Eric Christopher <echristo at gmail.com> wrote:
> On Tue, Jun 3, 2014 at 7:59 AM, Nancy <nancydreaming at gmail.com> wrote:
>>> First, you could switch to ld.gold instead of ld.bfd. It uses much
>>  $ln -s `which gold` /usr/local/bin/ld
>>
>>> the idea. I think for autoconf you need ".../configure
>>> --enable-split-dwarf" to use this.
>>>
>>  $.../configure --enable-targets=x86 --enable-split-dwarf
>>  $ make -j2
>>  $ sudo make install
>>
>> It works for me. Thanks a lot!
>>
>> I want to use emacs+gdb to trace the code work flow.
>> M-x gdb
>> Run like gdb --annotate=3 clang
>> (gdb) set args test.c
>> (gdb) b main
>> (gdb) b /home/nancy/work/llvm/tools/clang/lib/Lex/Lexer.cpp:57
>> (gdb) r
>>  It block at llvm/tools/clang/tools/driver/driver.cpp  main() fucntion.
>> (gdb) c
>>  program exit normally
>>  why? why it not call Lexer.cpp:InitLexer()? And I really can't find
>> any entry point to clang/lib/*.cpp files within help of SourceInsight
>> code view start from llvm/tools/clang/tools/driver/driver.cpp  main()
>> function.
>>
>> What's wrong with me?
>>
>
> You need to use the -cc1 option that clang is being reinvoked with,
> use the -v option on your original command line to take a look at it.
>
> Also, if you're just doing development you don't need to install the
> binary. The clang in build/Debug+Asserts/bin/clang will work just
> fine.
>
> -eric

Hi, eric

   Thank you for your -v advice

$clang -v test.c
....

Selected GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Candidate multilib: .;@m32
Selected multilib: .;@m32
 "/usr/local/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj
-mrelax-all -disable-free -main-file-name test.c -mrelocation-model
static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.24 -v -resource-dir
/usr/local/bin/../lib/clang/3.5.0 -internal-isystem /usr/local/include
-internal-isystem /usr/local/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /usr/include/i386-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem
/usr/include -fdebug-compilation-dir /home/nancy/work/test
-ferror-limit 19 -fmessage-length 80 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -o /tmp/test-85913a.o -x c test.c

clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target
i386-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/bin/../lib/clang/3.5.0/include
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
......

I use
"-cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name test.c -mrelocation-model static -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array
-target-cpu pentium4 -target-linker-version 2.24 -v -resource-dir
/usr/local/bin/../lib/clang/3.5.0 -internal-isystem /usr/local/include
-internal-isystem /usr/local/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /usr/include/i386-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem
/usr/include -fdebug-compilation-dir /home/nancy/work/test
-ferror-limit 19 -fmessage-length 80 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -o /tmp/test-85913a.o -x c
/home/nancy/work/test/test.c"

as (gdb)set args parameters and setup those breakpoins and run, it
still normally exist without stopping at breakpoint I set in
Lexer.cpp.

Could you please tell me the specific steps?

-- 
Best Regards,
Yu Rong Tan



More information about the llvm-dev mailing list