Hello Duncan, Thank you for your quick answer. I use the standard Makefile from a pass, that is calling Makefile.common. I saw only the make -d option, that "*print lots of debugging information*", as mentioned by LLVM. Using this, valgrind don't tell me extra info. It is a very good idea ti use -g, but where to insert? If I am trying to use clang++, I have to fix a lot of things. Should I make the changes for to use clang++ or I can debug using the Makefile.common? On Thu, May 30, 2013 at 1:57 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Alexandru, > > > /*==5134== Invalid write of size 4 > >> ==5134== at 0x4039280: (anonymous >> namespace)::Hello::**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+**Asserts/lib/Hello.so) >> ==5134== by 0x8E33DE3: llvm::MPPassManager::**runOnModule(llvm::Module&) >> (in >> /home/alex/llvm/Release+**Asserts/bin/opt) >> ==5134== by 0x8E3726F: llvm::PassManagerImpl::run(**llvm::Module&) (in >> /home/alex/llvm/Release+**Asserts/bin/opt) >> ==5134== by 0x8E37385: llvm::PassManager::run(llvm::**Module&) (in >> /home/alex/llvm/Release+**Asserts/bin/opt) >> ==5134== by 0x41AE4D2: (below main) (libc-start.c:226) >> ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 alloc'd >> ==5134== at 0x402C454: operator new[](unsigned int) (in >> /usr/lib/valgrind/vgpreload_**memcheck-x86-linux.so) >> ==5134== by 0x4037AE0: (anonymous >> namespace)::Hello::**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+**Asserts/lib/Hello.so)*/ >> >> ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 alloc'd >> ==5134== at 0x402C454: operator new[](unsigned int) (in >> /usr/lib/valgrind/vgpreload_**memcheck-x86-linux.so) >> ==5134== by 0x4037AE0: (anonymous namespace)::Hello::**runOnModule(llvm::Module&) >> (in /home/alex/llvm/Release+**Asserts/lib/Hello.so) >> > > you are writing of the end of an array that you allocated with "new". If > you > compile your program with debug info (-g) then valgrind should give you > the line > number at which the allocation occurred and the line number at which the > bad > write occurred. > > Ciao, Duncan. > >-- Best regards, Alexandru Ionut Diaconescu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130530/fa7e8ca4/attachment.html>
Hi Alexandru, if these are LLVM Makefiles, then I suggest you configure and build LLVM with the options: --disable-optimized --enable-assertions This will make debugging much easier. It enables debug info too, which you can also turn on directly by configuring with --enable-debug-symbols. Ciao, Duncan. On 30/05/13 14:21, Alexandru Ionut Diaconescu wrote:> Hello Duncan, > > Thank you for your quick answer. I use the standard Makefile from a pass, that > is calling Makefile.common. I saw only the make -d option, that "*/print lots of > debugging information/*", as mentioned by LLVM. > > Using this, valgrind don't tell me extra info. It is a very good idea ti use -g, > but where to insert? If I am trying to use clang++, I have to fix a lot of > things. Should I make the changes for to use clang++ or I can debug using the > Makefile.common? > > > On Thu, May 30, 2013 at 1:57 PM, Duncan Sands <baldrick at free.fr > <mailto:baldrick at free.fr>> wrote: > > Hi Alexandru, > > > /*==5134== Invalid write of size 4 > > ==5134== at 0x4039280: (anonymous > namespace)::Hello::__runOnModule(llvm::Module&) (in > /home/alex/llvm/Release+__Asserts/lib/Hello.so) > ==5134== by 0x8E33DE3: > llvm::MPPassManager::__runOnModule(llvm::Module&) (in > /home/alex/llvm/Release+__Asserts/bin/opt) > ==5134== by 0x8E3726F: llvm::PassManagerImpl::run(__llvm::Module&) (in > /home/alex/llvm/Release+__Asserts/bin/opt) > ==5134== by 0x8E37385: llvm::PassManager::run(llvm::__Module&) (in > /home/alex/llvm/Release+__Asserts/bin/opt) > ==5134== by 0x41AE4D2: (below main) (libc-start.c:226) > ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 alloc'd > ==5134== at 0x402C454: operator new[](unsigned int) (in > /usr/lib/valgrind/vgpreload___memcheck-x86-linux.so) > ==5134== by 0x4037AE0: (anonymous > namespace)::Hello::__runOnModule(llvm::Module&) (in > /home/alex/llvm/Release+__Asserts/lib/Hello.so)*/ > > ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 alloc'd > ==5134== at 0x402C454: operator new[](unsigned int) (in > /usr/lib/valgrind/vgpreload___memcheck-x86-linux.so) > ==5134== by 0x4037AE0: (anonymous > namespace)::Hello::__runOnModule(llvm::Module&) (in > /home/alex/llvm/Release+__Asserts/lib/Hello.so) > > > you are writing of the end of an array that you allocated with "new". If you > compile your program with debug info (-g) then valgrind should give you the line > number at which the allocation occurred and the line number at which the bad > write occurred. > > Ciao, Duncan. > > > > > -- > Best regards, > Alexandru Ionut Diaconescu
Hello Duncan, I will try this alternative (I think that I already have enable-debug-symbols). However, it is not an easier way to add to an instruction an array of integers? Every element linked to one distinct operand. PS: I am afraid of rebuild LLVM since problems arose when I was trying to do that. Thanks you for the answer ! On Thu, May 30, 2013 at 3:05 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Alexandru, if these are LLVM Makefiles, then I suggest you configure and > build LLVM with the options: > > --disable-optimized --enable-assertions > > This will make debugging much easier. It enables debug info too, which > you can > also turn on directly by configuring with --enable-debug-symbols. > > Ciao, Duncan. > > > On 30/05/13 14:21, Alexandru Ionut Diaconescu wrote: > >> Hello Duncan, >> >> Thank you for your quick answer. I use the standard Makefile from a pass, >> that >> is calling Makefile.common. I saw only the make -d option, that "*/print >> lots of >> debugging information/*", as mentioned by LLVM. >> >> >> Using this, valgrind don't tell me extra info. It is a very good idea ti >> use -g, >> but where to insert? If I am trying to use clang++, I have to fix a lot of >> things. Should I make the changes for to use clang++ or I can debug using >> the >> Makefile.common? >> >> >> On Thu, May 30, 2013 at 1:57 PM, Duncan Sands <baldrick at free.fr >> <mailto:baldrick at free.fr>> wrote: >> >> Hi Alexandru, >> >> > /*==5134== Invalid write of size 4 >> >> ==5134== at 0x4039280: (anonymous >> namespace)::Hello::__**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+__**Asserts/lib/Hello.so) >> ==5134== by 0x8E33DE3: >> llvm::MPPassManager::__**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+__**Asserts/bin/opt) >> ==5134== by 0x8E3726F: llvm::PassManagerImpl::run(__**llvm::Module&) >> (in >> /home/alex/llvm/Release+__**Asserts/bin/opt) >> ==5134== by 0x8E37385: llvm::PassManager::run(llvm::_**_Module&) >> (in >> /home/alex/llvm/Release+__**Asserts/bin/opt) >> >> ==5134== by 0x41AE4D2: (below main) (libc-start.c:226) >> ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 >> alloc'd >> ==5134== at 0x402C454: operator new[](unsigned int) (in >> /usr/lib/valgrind/vgpreload___**memcheck-x86-linux.so) >> ==5134== by 0x4037AE0: (anonymous >> namespace)::Hello::__**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+__**Asserts/lib/Hello.so)*/ >> >> >> ==5134== Address 0x46cfa40 is 0 bytes after a block of size 200 >> alloc'd >> ==5134== at 0x402C454: operator new[](unsigned int) (in >> /usr/lib/valgrind/vgpreload___**memcheck-x86-linux.so) >> ==5134== by 0x4037AE0: (anonymous >> namespace)::Hello::__**runOnModule(llvm::Module&) (in >> /home/alex/llvm/Release+__**Asserts/lib/Hello.so) >> >> >> >> you are writing of the end of an array that you allocated with "new". >> If you >> compile your program with debug info (-g) then valgrind should give >> you the line >> number at which the allocation occurred and the line number at which >> the bad >> write occurred. >> >> Ciao, Duncan. >> >> >> >> >> -- >> Best regards, >> Alexandru Ionut Diaconescu >> > >-- Best regards, Alexandru Ionut Diaconescu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130530/128e6a77/attachment.html>