<html><head></head><body bgcolor="#FFFFFF"><div><br></div><div><br>On Jul 14, 2011, at 9:35 PM, Eli Bendersky <<a href="mailto:eliben@gmail.com">eliben@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
> This reflects the compiler's view of things correctly, but is problematic for a debugger. The debugger should know that arg_arr refers to a 42-element array and isn't just a pointer into a buffer of unspecified length. This is something the user would expect.<br>


> On the other hand, the debugger should also get the information that arg_arr is actually a pointer, to be able to get to its values correctly.<br>
><br>
> Is there a way out?<br>
<br>
</div></div>The only way out is to figure out how to distinguish between these two in front-end AST nodes while emitting LLVM IR. The part of front end that emits debug info for an argument is seeing arg_arr as a pointer to int.<br>


<br>
If you manually patch metadata in llvm IR then you'll get debug info as you expect.<br>
-<br></blockquote></div><br>Suppose one would start writing a patch to Clang to rectify this, how would this information be encoded in the debug metadata, given the dual nature of the arg_arr argument? Is there a mechanism to support it, or is an extension required?<br>

<br></div></div></blockquote><div><br></div>Aha.. dual mode. I am not sure there is a straight forward way in dwarf to explicitly say this type is int[42] <div><br></div><div>but treat it is a int*.<div><br></div><div>One possible approach is to use array type in subprogram declaration and use int * in subprogram definition</div><div> and teach debugger to understand what you are trying to say.</div><div><br></div><div>-</div><div>Devang</div></div></body></html>