<div dir="ltr">Hello,<div><br></div><div>I apologize, I am new to the list-serve (joined on the 25th) and am not quite sure how it works.<div><br></div><div>I didn't reply to Hans because the llvm/ clang distribution I have installed doesn't allow me to use that command line option, I will respond in a bit.  And I asked anther question simply because no one replied to my first question. </div><div><br></div><div>I have been using llvm for about a week, so I am not sure how to ask my question succinctly but I am trying, please bear with me. </div><div><br></div><div>In reply to your response, I will try that out tomorrow and hopefully be able to make some headway.  </div><div><br></div><div>I have been searching previous emails and have found that some people have cast the <span style="font-size:12.800000190734863px">getelementptr in the Instruction i posted in this original email thread to a </span>constantexpr or GEPOperator and have been able to get information that way<span style="font-size:12.800000190734863px">, but I can't quite seem to figure it out.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><span style="font-size:12.800000190734863px"> <b>Ex email thread:</b>  </span><a href="https://groups.google.com/forum/#!topic/llvm-dev/_F-PFACaHbU">https://groups.google.com/forum/#!topic/llvm-dev/_F-PFACaHbU<span style="font-size:12.800000190734863px"> </span></a></div></div></blockquote><div><div><br></div><div>If anyone has tried this approach and could provide some more information going this route, I would appreciate that as well.</div><div><br></div><div>Cheers,</div><div><br></div><div>Dami </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 30, 2017 at 10:37 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On 30 May 2017 at 19:13, Damilola Orikogbo via llvm-dev<br>
<span class=""><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>  store i32 (...)** bitcast (i8** getelementptr inbounds ([5 x i8*], [5 x<br>
> i8*]* @_ZTV9Rectangle, i32 0, i32 2) to i32 (...)**), i32 (...)*** %5, align<br>
> 8<br>
><br>
> and was wondering how to access the indices of the getelementptr. How would<br>
> i print out all pointers stored from index 0 to 5.<br>
<br>
</span>You really need to start replying to your own threads. The one I<br>
noticed this morning was particularly useless compared to your message<br>
from 25th May, and you didn't even clarify your problem for Hans after<br>
he replied.<br>
<br>
That said, if you'd identified a vtable you would insert code to GEP<br>
element N and then pass the result to something like a printf<br>
expecting a %p. Of course you need to know in advance that your vtable<br>
contains 5 entries.<br>
<br>
So you'd create a bunch of instructions looking vaguely like:<br>
<br>
    call void @printf(@WHATEVER_FOR_PERCENT_<wbr>P, bitcast(i8**<br>
getelementptr inbounds([5 x i8*], [5 x i8*]* @_ZTV9Rectangle, i32 0,<br>
i32 N) to i8*)<br>
<br>
The chances are you won't always have a @_ZTV* global as a base though<br>
(that's the entire point of dynamic dispatch). In which case you'd<br>
have to create a bunch of instructions like:<br>
<br>
    %tmp = getelementptr inbounds [5 * i8*], [5 x i8*]* %vtable, i32 0, i32 N<br>
    %tmp1 = bitcast i8** %tmp to i8*<br>
    call void @printf(@WHATEVER_FOR_PERCENT_<wbr>P, %tmp1)<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>