SANGEETA CHOWDHARY via llvm-dev
2020-Jun-15 23:36 UTC
[llvm-dev] Need help in creating clone functions
Hello, I am working on creating a llvm pass which clones a certain function with a different name using CloneFunctionInto. I create a call instruction to call a new cloned function from the old function. In llvm IR and in .s file everything looks as expected, but when I call this program with gdb and set a breakpoint on this new function, gdb shows the name of the original function. I know it has to do something with debug options but I am not sure how should I set the debug options of this new function so that I can see it in gdb. Can someone please help me with this? Regards, Sangeeta -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200615/7072698c/attachment.html>
David Blaikie via llvm-dev
2020-Jun-15 23:43 UTC
[llvm-dev] Need help in creating clone functions
Check the DISubprogram associated with the cloned function (in the LLVM IR the Function definition would have an "!dbg !47" at the end, and that !47 would refer to a !DISubprogram that describes th efunction) - you'd probably need to create a new DISubprogram and set that as the subprogram for the new llvm::Function so it doesn't share the same description/name/etc as the original. On Mon, Jun 15, 2020 at 4:37 PM SANGEETA CHOWDHARY via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hello, > > I am working on creating a llvm pass which clones a certain function with a different name using CloneFunctionInto. I create a call instruction to call a new cloned function from the old function. In llvm IR and in .s file everything looks as expected, but when I call this program with gdb and set a breakpoint on this new function, gdb shows the name of the original function. I know it has to do something with debug options but I am not sure how should I set the debug options of this new function so that I can see it in gdb. > Can someone please help me with this? > > Regards, > Sangeeta > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
SANGEETA CHOWDHARY via llvm-dev
2020-Jun-16 18:50 UTC
[llvm-dev] Need help in creating clone functions
Thanks, David for the quick response. It definitely has solved the problem. Regards, Sangeeta On Mon, Jun 15, 2020 at 7:43 PM David Blaikie <dblaikie at gmail.com> wrote:> Check the DISubprogram associated with the cloned function (in the > LLVM IR the Function definition would have an "!dbg !47" at the end, > and that !47 would refer to a !DISubprogram that describes th > efunction) - you'd probably need to create a new DISubprogram and set > that as the subprogram for the new llvm::Function so it doesn't share > the same description/name/etc as the original. > > On Mon, Jun 15, 2020 at 4:37 PM SANGEETA CHOWDHARY via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Hello, > > > > I am working on creating a llvm pass which clones a certain function > with a different name using CloneFunctionInto. I create a call instruction > to call a new cloned function from the old function. In llvm IR and in .s > file everything looks as expected, but when I call this program with gdb > and set a breakpoint on this new function, gdb shows the name of the > original function. I know it has to do something with debug options but I > am not sure how should I set the debug options of this new function so that > I can see it in gdb. > > Can someone please help me with this? > > > > Regards, > > Sangeeta > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200616/f9c2a46a/attachment.html>