[LLVMdev] Null address pointer in llvm.dbg.declare

Jacob Zimmermann jacob.zimmermann at oracle.com
Wed Jan 5 23:27:31 PST 2011


Hi,

I'm encountering a problem with llvm.dbg.declare. My code looks
basically like this:

if(DbgDeclareInst *dbg = dyn_cast<DbgDeclareInst>(&inst)) {
	const Value* addr = dbg->getAddress();
       	const MDNode* mvar = dbg->getVariable();
	...
}

While the MDNode (mvar) contains the correct information (name of the
variable, etc...), getAddress always returns NULL. Am I missing
something, or is there some other way to access the variable being
declared?

NB: this happens when processing the following bitcode:

define i32 @fun(i32 %a, float %b) nounwind {
entry:
  %a_addr = alloca i32, align 4
  %b_addr = alloca float, align 4
  %retval = alloca i32
  %0 = alloca i32
  %"alloca point" = bitcast i32 0 to i32
  call void @llvm.dbg.declare(metadata !{i32* %a_addr}, metadata !8), !
dbg !9
  ...
!8 = metadata !{i32 524545, metadata !4, metadata !"a", metadata !1, i32
3, metadata !3} ; [ DW_TAG_arg_variable ]
  ....


Best regards,
Jacob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110106/868d8a4a/attachment.sig>


More information about the llvm-dev mailing list