<div dir="rtl"><div dir="ltr">Thanks,that's very useful!</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2014-12-13 0:39 GMT+02:00 Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I want this.<br>
<br>
-- adrian<br>
<div><div class="h5">> On Dec 12, 2014, at 2:37 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
> It's horrible to inspect `MDNode`s in a debugger. All of their operands<br>
> that are `MDNode`s get dumped as `<badref>`, since we can't assign<br>
> metadata slots in the context of a `Metadata::dump()`. (Why not? Why<br>
> not assign numbers lazily? Because then each time you called `dump()`,<br>
> a given `MDNode` could have a different lazily assigned number.)<br>
><br>
> Fortunately, the C memory model gives us perfectly good identifiers for<br>
> `MDNode`. Add pointer addresses to the dumps, transforming this:<br>
><br>
> (lldb) e N->dump()<br>
> metadata !{i32 662302, i32 26, metadata <badref>, null}<br>
><br>
> (lldb) e ((MDNode*)N->getOperand(2))->dump()<br>
> metadata !{i32 4, metadata !"foo"}<br>
><br>
> into:<br>
><br>
> (lldb) e N->dump()<br>
> metadata !{i32 662302, i32 26, metadata <badref:0x100706ee0>, null}<br>
><br>
> (lldb) e ((MDNode*)0x100706ee0)->dump()<br>
> metadata !{i32 4, metadata !"foo"}<br>
><br>
> and this:<br>
><br>
> (lldb) e N->dump()<br>
> metadata !{metadata <badref>, metadata <badref>, metadata <badref>, metadata <badref>, metadata <badref>}<br>
><br>
> (lldb) e N->getOperand(0)<br>
> (const llvm::MDOperand) $0 = {<br>
> MD = 0x00000001012004e0<br>
> }<br>
> (lldb) e N->getOperand(1)<br>
> (const llvm::MDOperand) $1 = {<br>
> MD = 0x00000001012004e0<br>
> }<br>
> (lldb) e N->getOperand(2)<br>
> (const llvm::MDOperand) $2 = {<br>
> MD = 0x0000000101200058<br>
> }<br>
> (lldb) e N->getOperand(3)<br>
> (const llvm::MDOperand) $3 = {<br>
> MD = 0x00000001012004e0<br>
> }<br>
> (lldb) e N->getOperand(4)<br>
> (const llvm::MDOperand) $4 = {<br>
> MD = 0x0000000101200058<br>
> }<br>
> (lldb) e ((MDNode*)0x00000001012004e0)->dump()<br>
> metadata !{}<br>
><br>
> (lldb) e ((MDNode*)0x0000000101200058)->dump()<br>
> metadata !{null}<br>
><br>
> into:<br>
><br>
> (lldb) e N->dump()<br>
> metadata !{metadata <badref:0x1012004e0>, metadata <badref:0x1012004e0>, metadata <badref:0x101200058>, metadata <badref:0x1012004e0>, metadata <badref:0x101200058>}<br>
><br>
> (lldb) e ((MDNode*)0x1012004e0)->dump()<br>
> metadata !{}<br>
><br>
> (lldb) e ((MDNode*)0x101200058)->dump()<br>
> metadata !{null}<br>
><br>
> I've left `badref` in the operand to keep it `FileCheck`-able, via:<br>
><br>
> CHECK-NOT: badref<br>
><br>
> Another option would be:<br>
><br>
> (lldb) e N->dump()<br>
> metadata !{metadata !0x1012004e0, metadata !0x1012004e0, metadata !0x101200058, metadata !0x1012004e0, metadata !0x101200058}<br>
><br>
> which would allow:<br>
><br>
> CHECK-NOT: !0x<br>
><br>
> but IMO that's too subtle...<br>
><br>
</div></div>> <0001-IR-Make-MDNode-dump-useful-by-adding-addresses.patch><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>