Sorry for not being clear: when JIT compiling I attach line information to calls. At runtime, when walking the stack, I have the return addresses and hence the instruction *after* the call. So currently, I do some computation magic to find the line number, but I would like the line information to be attached to the next machine instruction after the call.<div>
<br></div><div>If I attach the line number information to another LLVM instruction (say the one next to the call), who knows where that instruction may end up after LLVM optimizations. So this is not an option.</div><div>
<br></div><div>Nicolas<br><br><div class="gmail_quote">On Mon, Aug 23, 2010 at 2:13 PM, Jeffrey Yasskin <span dir="ltr"><<a href="mailto:jyasskin@google.com">jyasskin@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Mon, Aug 23, 2010 at 12:51 PM, nicolas geoffray<br>
<div class="im"><<a href="mailto:nicolas.geoffray@gmail.com">nicolas.geoffray@gmail.com</a>> wrote:<br>
</div><div class="im">> On Mon, Aug 23, 2010 at 1:46 PM, Jeffrey Yasskin <<a href="mailto:jyasskin@google.com">jyasskin@google.com</a>><br>
> wrote:<br>
>><br>
>> What problem are you trying to solve here? This patch looks like it'll<br>
>> assign the wrong line number to first instruction of any line, except<br>
>> when doing a backtrace.<br>
><br>
> The backtrace is exactly what I want to solve here :). Don't think lines,<br>
> but PC.<br>
<br>
</div>processDebugLoc() matches a line to a PC, so I'm not sure how to avoid<br>
thinking about lines. What bad behavior are you seeing? The wrong line<br>
assigned to a backtrace frame? Or something else?<br>
<div class="im"><br>
>> I'm not sure how existing debuggers assign<br>
>> line numbers to backtrace frames, but one simple fix might be to look<br>
>> up the line of the address before the one stored as the return<br>
>> address.<br>
><br>
> This does not work if I want precise information: I don't want the PC before<br>
> or after and then do some kind of magic computation, but the exact one.<br>
<br>
</div>A line number always applies to a range (or several ranges) of<br>
addresses. You can look up any address in that range, and get the<br>
precise line number. I guess I'm missing what information you need to<br>
be precise.<br>
</blockquote></div><br></div>