Irini Stavrakantonaki via llvm-dev
2015-Dec-15 10:28 UTC
[llvm-dev] Line number without -Debug ?
Hi Eric and thanks for your answer, What I mean is that I want to find the number of line on the IR code of a specific instruction. I found out that I can use: DebugLoc Loc = CurrentInstruction->getDebugLoc(); unsigned Line = Loc.getLine(); But this works only if DEBUGFLAG is True. I'd like to be able to get the Line number without being on a 'Debug' mode. Is this possible? Thanks again, -irini On 15/12/2015 09:37, Eric Christopher wrote:> Not sure what you mean, but the answer is likely "no" as there's > nothing for anything to retrieve. Diagnostics inside the compiler can > usually get it from certain IR constructs that have line information, > but I'm not sure if that's what you mean. > > -eric > > On Mon, Dec 14, 2015 at 5:54 PM Irini Stavrakantonaki via llvm-dev > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > Hi list, > > Is it possible to retrieve the source/IR line number > without being on a debug mode? > > Thank you in advance, > > -- > irini > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- irini -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151215/9caabadb/attachment.html>
Since there is extra "work" required to store that sort of infromation, I wouldn't want my compiler to do that unless I have specifically asked for it. What is the actual problem you are trying to solve? I feel that you are asking an XY question (in other words, "I have problem X, I think solution is Y, so I ask how to do Y", rather than asking "how do I do X"). -- Mats On 15 December 2015 at 10:28, Irini Stavrakantonaki via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Eric and thanks for your answer, > > What I mean is that I want to find the number of line on the IR code of a > specific instruction. > I found out that I can use: > > DebugLoc Loc = CurrentInstruction->getDebugLoc(); > unsigned Line = Loc.getLine(); > > But this works only if DEBUGFLAG is True. > I'd like to be able to get the Line number without being on a 'Debug' > mode. Is this possible? > > Thanks again, > > -irini > > > On 15/12/2015 09:37, Eric Christopher wrote: > > Not sure what you mean, but the answer is likely "no" as there's nothing > for anything to retrieve. Diagnostics inside the compiler can usually get > it from certain IR constructs that have line information, but I'm not sure > if that's what you mean. > > -eric > > On Mon, Dec 14, 2015 at 5:54 PM Irini Stavrakantonaki via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi list, >> >> Is it possible to retrieve the source/IR line number >> without being on a debug mode? >> >> Thank you in advance, >> >> -- >> irini >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > -- > irini > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20151215/357d14b6/attachment.html>
Irini Stavrakantonaki via llvm-dev
2015-Dec-15 16:06 UTC
[llvm-dev] Line number without -Debug ?
Is this "work" heavier than enabling the debug mode? Nop. No XY question here. In fact it is just be more useful for me to have the information of line number but still be in release mode. (if this is possible or in other words less "painful" for my pass) Thanks --irini On 15/12/15 17:07, mats petersson wrote:> Since there is extra "work" required to store that sort of > infromation, I wouldn't want my compiler to do that unless I have > specifically asked for it. > > What is the actual problem you are trying to solve? I feel that you > are asking an XY question (in other words, "I have problem X, I think > solution is Y, so I ask how to do Y", rather than asking "how do I do > X"). > > -- > Mats > > On 15 December 2015 at 10:28, Irini Stavrakantonaki via llvm-dev > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > Hi Eric and thanks for your answer, > > What I mean is that I want to find the number of line on the IR > code of a specific instruction. > I found out that I can use: > > DebugLoc Loc = CurrentInstruction->getDebugLoc(); > unsigned Line = Loc.getLine(); > > But this works only if DEBUGFLAG is True. > I'd like to be able to get the Line number without being on a > 'Debug' mode. Is this possible? > > Thanks again, > > -irini > > > On 15/12/2015 09:37, Eric Christopher wrote: >> Not sure what you mean, but the answer is likely "no" as there's >> nothing for anything to retrieve. Diagnostics inside the compiler >> can usually get it from certain IR constructs that have line >> information, but I'm not sure if that's what you mean. >> >> -eric >> >> On Mon, Dec 14, 2015 at 5:54 PM Irini Stavrakantonaki via >> llvm-dev <llvm-dev at lists.llvm.org >> <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hi list, >> >> Is it possible to retrieve the source/IR line number >> without being on a debug mode? >> >> Thank you in advance, >> >> -- >> irini >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > -- > irini > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://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/20151215/5b1f926e/attachment.html>
Irini Stavrakantonaki via llvm-dev
2015-Dec-15 17:07 UTC
[llvm-dev] Line number without -Debug ?
I see your point. But my issue here is just to have this #Line information (nothing more) Since, as you said, there is a way to do it and still not enable debug mode ...I would like to try it and see if I can get any benefit -- irini On 15/12/15 18:21, mats petersson wrote:> My point as enabling debug mode is what causes this data to be > collected and stored. Since there is more work than "nothing", it is > not enabled when doing release builds of the compiler. Debug mode may > enable a few other things too, but essentially, it's purpse in life > [as far as I understand] is to provide store and allow retrieval of > debug information. > > And my point was "why do you need to know line-number information", > when you are compiling in release? Seems like you need something that > you shouldn't need, hence me (still) thinking it's an XY question. > > -- > Mats > > On 15 December 2015 at 16:06, Irini Stavrakantonaki > <istavrak at ics.forth.gr <mailto:istavrak at ics.forth.gr>> wrote: > > Is this "work" heavier than enabling the debug mode? > > Nop. No XY question here. In fact it is just be more useful for me > to have the information of line number but still be in release mode. > (if this is possible or in other words less "painful" for my pass) > > Thanks > > --irini > > > On 15/12/15 17:07, mats petersson wrote: >> Since there is extra "work" required to store that sort of >> infromation, I wouldn't want my compiler to do that unless I have >> specifically asked for it. >> >> What is the actual problem you are trying to solve? I feel that >> you are asking an XY question (in other words, "I have problem X, >> I think solution is Y, so I ask how to do Y", rather than asking >> "how do I do X"). >> >> -- >> Mats >> >> On 15 December 2015 at 10:28, Irini Stavrakantonaki via llvm-dev >> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hi Eric and thanks for your answer, >> >> What I mean is that I want to find the number of line on the >> IR code of a specific instruction. >> I found out that I can use: >> >> DebugLoc Loc = CurrentInstruction->getDebugLoc(); >> unsigned Line = Loc.getLine(); >> >> But this works only if DEBUGFLAG is True. >> I'd like to be able to get the Line number without being on a >> 'Debug' mode. Is this possible? >> >> Thanks again, >> >> -irini >> >> >> On 15/12/2015 09:37, Eric Christopher wrote: >>> Not sure what you mean, but the answer is likely "no" as >>> there's nothing for anything to retrieve. Diagnostics inside >>> the compiler can usually get it from certain IR constructs >>> that have line information, but I'm not sure if that's what >>> you mean. >>> >>> -eric >>> >>> On Mon, Dec 14, 2015 at 5:54 PM Irini Stavrakantonaki via >>> llvm-dev <llvm-dev at lists.llvm.org >>> <mailto:llvm-dev at lists.llvm.org>> wrote: >>> >>> Hi list, >>> >>> Is it possible to retrieve the source/IR line number >>> without being on a debug mode? >>> >>> Thank you in advance, >>> >>> -- >>> irini >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >> >> -- >> irini >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://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/20151215/5fa56ca7/attachment.html>
Eric Christopher via llvm-dev
2015-Dec-16 02:37 UTC
[llvm-dev] Line number without -Debug ?
Whatever frontend you're using needs to annotate the instructions with the source level locations. With clang some instructions have it by default and for others you'll need to enable -g for debug output to get source information (or -gline-tables-only for a minimum of metadata). -eric On Tue, Dec 15, 2015 at 2:28 AM Irini Stavrakantonaki <istavrak at ics.forth.gr> wrote:> Hi Eric and thanks for your answer, > > What I mean is that I want to find the number of line on the IR code of a > specific instruction. > I found out that I can use: > > DebugLoc Loc = CurrentInstruction->getDebugLoc(); > unsigned Line = Loc.getLine(); > > But this works only if DEBUGFLAG is True. > I'd like to be able to get the Line number without being on a 'Debug' > mode. Is this possible? > > Thanks again, > > -irini > > > On 15/12/2015 09:37, Eric Christopher wrote: > > Not sure what you mean, but the answer is likely "no" as there's nothing > for anything to retrieve. Diagnostics inside the compiler can usually get > it from certain IR constructs that have line information, but I'm not sure > if that's what you mean. > > -eric > > On Mon, Dec 14, 2015 at 5:54 PM Irini Stavrakantonaki via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi list, >> >> Is it possible to retrieve the source/IR line number >> without being on a debug mode? >> >> Thank you in advance, >> >> -- >> irini >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > -- > irini > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151216/966a6103/attachment.html>