[LLVMdev] debugging a pass for LTO

jiaqi zhang zation99 at gmail.com
Fri Jan 22 12:04:17 PST 2010


Thank you very much for your suggestions. That's very helpful.

However, since I'm trying to compile several somewhat large projects,
I assume generating bitcode for each single file and linking them
together might be painful (I don't want to modify too much the project
makefiles). So I hope my pass can be used just with simple compilation
command like

"llvm-gcc -use-gold-plugin"

instead of first generating bitcode, linking them, and then applying
the pass with opt.

Sorry I don't know if I‘m correct here. I'm a beginner with llvm.

On Fri, Jan 22, 2010 at 11:50 AM, John Criswell <criswell at uiuc.edu> wrote:
> jiaqi zhang wrote:
>>
>> Hi,
>>
>> I'm trying to write a pass for LTO, and now I want to debug it using
>> gdb. I use ld as my target file, but when I run the program in gdb, it
>> reports
>>
>> [Thread debugging using libthread_db enabled]
>> Cannot find new threads: generic error
>>
>> at
>>
>> Plugin::load()
>> {
>> #ifdef ENABLE_PLUGINS
>>  this->handle_ = dlopen(this->filename_.c_str(), RTLD_NOW);
>>
>> in binutil/src/gold/plugin.cc
>>
>> The gdb version is 7.0.1. I tried it with other multi-threaded
>> programs without any problem. Have I missed something? Or I shouldn't
>> debug my pass this way at all?
>>
>
> Probably the best approach is to use llvm-ld to link the bitcode files
> together and then run your pass using opt or bugpoint to try to debug it.
>
> This approach can be very useful as you can use bugpoint to reduce the test
> case.
>
> -- John T.
>
>> btw, "llvm-gcc -use-gold-plugin" works fine when I compile my program.
>>
>>
>>
>>
>>
>> Thanks very much.
>>
>>
>>
>
>



-- 
Best regards
JiaQi Zhang




More information about the llvm-dev mailing list