Hey Tim, Sadly I have currently only a release build of LLVM7 with no assertions turned on... So I just know that the line of code I posted is crashing. No output, no anything....just...Crash... Kind greetings Björn -----Original Message----- From: Tim Northover <t.p.northover at gmail.com> Sent: Dienstag, 15. Januar 2019 13:28 To: Gaier, Bjoern <Bjoern.Gaier at horiba.com> Cc: Stefan Gränitz <stefan.graenitz at gmail.com>; Mehdi AMINI <joker.eph at gmail.com>; llvm-dev <llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] Function - replaceAllUsesWith On Tue, 15 Jan 2019 at 12:25, Gaier, Bjoern via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I wondered if I can do the external symbol resolution without using > the JIT and RuntimeDyld (for now). For me it sounds like something > that could be possible…I'm virtually certain it is. I think lldb does it, in fact. You mentioned the pointercast didn't work, but didn't give any details on how or what actually crashed. Do you have more you can tell us? Also, hopefully you're using a build of LLVM with assertions enabled, that'll catch errors much earlier. Cheers. Tim. Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
On Tue, 15 Jan 2019 at 12:35, Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:> Sadly I have currently only a release build of LLVM7 with no assertions turned on...That's definitely the first thing you should fix. Preferably a debug build too. The only reason you should ever be debugging against a release build of LLVM is if you have a Heisenbug that doesn't happen otherwise. It's a horrible experience.> So I just know that the line of code I posted is crashing. > No output, no anything....just...Crash...Even a release build can give you a backtrace if you attach a debugger, though as I've said I wouldn't normally bother. Cheers. Tim.
I could actually track down the cause of the problem: mainModue->getFunction("puts")->replaceAllUsesWith( llvm::ConstantExpr::getPointerCast( llvm::ConstantInt::get(llvm::IntegerType::get(context, 64), 0xF), mainModue->getFunction("puts")->getType() ) ); The problem is the line where I receive the type of the function "puts", it will crash the application - when used as the parameter for "getPointerCast". I generated a new type, then the function didn't crashed anymore. Is there a way to copy the value? I want to ensure to use the correct type... Kind greetings Björn -----Original Message----- From: Tim Northover <t.p.northover at gmail.com> Sent: Dienstag, 15. Januar 2019 13:42 To: Gaier, Bjoern <Bjoern.Gaier at horiba.com> Cc: Stefan Gränitz <stefan.graenitz at gmail.com>; Mehdi AMINI <joker.eph at gmail.com>; llvm-dev <llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] Function - replaceAllUsesWith On Tue, 15 Jan 2019 at 12:35, Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:> Sadly I have currently only a release build of LLVM7 with no assertions turned on...That's definitely the first thing you should fix. Preferably a debug build too. The only reason you should ever be debugging against a release build of LLVM is if you have a Heisenbug that doesn't happen otherwise. It's a horrible experience.> So I just know that the line of code I posted is crashing. > No output, no anything....just...Crash...Even a release build can give you a backtrace if you attach a debugger, though as I've said I wouldn't normally bother. Cheers. Tim. Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika