Damilola Orikogbo via llvm-dev
2017-May-25 16:00 UTC
[llvm-dev] Get function pointers from VTable
Hello, I am currently in the process of retrieving the virtual function pointers from the vtable though writing a pass and examining the IR. I know that the vtable is represented with names beginning in "_ZTV" and i32 (...)** represents the type of the vptr fields. Where I am stuck and need help with is in getting the vptr addresses from the array being accessed by the getelementptr: store i32 (...)** bitcast (i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @_ZTV9Rectangle, i32 0, i32 2) to i32 (...)**), i32 (...)*** %5, align 8 I am able to get this operand from the store instruction op[0] and know that it is a ConstantExpr, how do i access the individual indices. I know that I need the info from index 2 till 5 in this case. Can anyone help with getting the vptr address from within the table? Thanks, Dami -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170525/e3ef53b1/attachment.html>