Extracting Metadata of Variables


Im new to llvm and I'm using llvm-2.6 and I know how to extract the metadata
in the stoppoints but what I'm interested in is the meta data regarding a
local variable. I know that the @llvm.dgb.declare such as:

call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type*
@llvm.dbg.variable9 to { }*))

links to meta data for @llvm.dbg.variable9 which is:

@llvm.dbg.variable9 = internal constant %llvm.dbg.variable.type { i32
459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to {
}*), i8* getelementptr inbounds ([2 x i8]* @.str8, i32 0, i32 0), { }*
bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32
13, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) },
section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]

now what I'm interested is the line number "i32 13" shown in the metadata of
@llvm.dbg.variable9. I was wondering if there is a way to do so.?

Thank you


Use DIVariable from DebugInfo.h