Manoj via llvm-dev
2019-Aug-23 07:20 UTC
[llvm-dev] LLVM-8.0 | Requesting Help : Function->getName() returns empty string
Hello All, I am creating a Module and getting Function pointer as below in some function. Function *fn = module->getFunction(fnName); printf("func Name: %s.\n", fn->getName().str().c_str()); . . return (intptr_t) fn; This prints : "func Name: main." I convert the ptr to int and return it. Later I am receiving this as a Func Handler in other function executeFunction(int funcHandle . .) { . . Function *fn = (Function *) funcHandle; printf("func Name: %s\n",fn->getName().str().c_str()); gv = executionEngine->runFunction(fn, *args); . } Here it prints an empty string and also the executionEngine->runFunction() gives error : Assertion failed! Expression: GV->hasName() && "Global must have name." I am using LLVM-8.0. Please let me know if I am missing out something OR if the procedure is wrong Best regards, Manoj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190823/43e2d121/attachment.html>
Manoj via llvm-dev
2019-Aug-23 08:54 UTC
[llvm-dev] LLVM-8.0 | Requesting Help : Function->getName() returns empty string
Yes, I did. I printed out the one I am returning and the one I am receiving. Both are same. This use to work on LLVM-3.3. Now I am trying to port it to 8.0. Please let me know, I can provide you with more code prior to this, If that would help. Regards, Manoj On Fri, Aug 23, 2019 at 12:42 PM Tim Northover <t.p.northover at gmail.com> wrote:> Hi Manoj, > > > Here it prints an empty string and also the > executionEngine->runFunction() gives error : Assertion failed! Expression: > GV->hasName() && "Global must have name." > > Have you checked that it's definitely the same pointer? Obviously the > code you posted isn't real but it does show funcHandle being passed as > an int rather than an intptr, which could easily truncate the value. > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190823/a85cb129/attachment.html>
Tim Northover via llvm-dev
2019-Aug-23 10:42 UTC
[llvm-dev] LLVM-8.0 | Requesting Help : Function->getName() returns empty string
Hi Manoj,> Here it prints an empty string and also the executionEngine->runFunction() gives error : Assertion failed! Expression: GV->hasName() && "Global must have name."Have you checked that it's definitely the same pointer? Obviously the code you posted isn't real but it does show funcHandle being passed as an int rather than an intptr, which could easily truncate the value. Cheers. Tim.
Possibly Parallel Threads
- [LLVMdev] Problems in removing a cloned instruction.
- [LLVMdev] Problems in removing a cloned instruction.
- [LLVMdev] llvm-installation
- Compile libtheora 1.0beta3 with VS2005
- CentOS DomU on Opensolaris Dom0 - virt-install fails with error in virDomainCreateLinux()