[llvm-commits] [PATCH] Debug info utilities and printer pass

Evan Cheng evan.cheng at apple.com
Mon Dec 15 10:37:40 PST 2008


On Dec 11, 2008, at 3:55 AM, Török Edwin wrote:

> On 2008-12-11 04:13, Chris Lattner wrote:
>> On Dec 10, 2008, at 1:13 PM, Devang Patel wrote:
>>>> 02-intrin.patch:
>>>> Introduce DbgFuncStart::getDisplayName() (which refers to  
>>>> unmangled C
>>>> ++
>>>> name!), and DbgDeclareInst::getVariableName()
>>>> Introduce include/llvm/Support/DebugInfo.h:
>>>
>>> We already have include/llvm/Analysis/DebugInfo.h, so I suggest that
>>> you use another name for this new header.
>>
>> More strongly, why do we need this new code when we have
>> llvm/Analysis/Debuginfo.h?  What does this do that
>> llvm/Analysis/DebugInfo doesn't, or shouldn't do?
>
> llvm/Analysis/DebugInfo.h doesn't search for the debug info, you  
> have to
> give it that as a parameter to the constructor.
> My functions search for the llvm.dbg.stoppoint given an
> Instruction*/BasicBlock*, and for llvm.dbg.declare given a Value*.
>> I'd really rather make Analysis/DebugInfo.h better rather than
>> introduce a new parallel way to analyze debug info.
>
> I moved the functions to include/llvm/Analysis/DebugInfo.h, see
> 02-dbginfo-utils.patch.
>
> Attachments:
> 01-dbginfo.patch:
> -  fix getFieldAs(), it was always looking at field 6, instead of Elt!
> -  DIVariable.getType() was leading to linker error: undefined  
> reference
> to DIType::DIType(GlobalVariable *GV), define the constructor

I don't quite understand this:

+// needed by DIVariable::getType()
+DIType::DIType(GlobalVariable *GV) : DIDescriptor(GV)
+{
+  if (GV) {
+    unsigned tag = getTag();
+    if (tag != dwarf::DW_TAG_base_type && ! 
DIDerivedType::isDerivedType(tag) &&
+        !DICompositeType::isCompositeType(tag))
+      GV = 0;
+  }
+}

What exactly is it trying to accomplish by changing the parameter GV  
to 0?


>
>
> 02-dbginfo-utils.patch:
> - in my previous patch this was include/llvm/Support/DebugInfo.h, it
> introduces:
> - findStopPoint
> - findBBStopPoint
> - findDbgDeclare

+      // a BB consisting only of a terminator, can't have a stoppoint

Please start with a capital 'A' and don't forget periods.

+      // this BB didn't have a stoppoint, if there is only one
+      // predecessor, look for a stoppoint there
+      // we could use getIDom(), but that would require dominator info

Here as well.

+  const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts)
+  {
+    if (stripCasts) {
+      V = V->stripPointerCasts();
+      // look for the bitcast
+      for (Value::use_const_iterator I = V->use_begin(), E =V- 
 >use_end(); I != E; ++I) {

80 column?

>
>
> 03-pass.patch:
> - the -print-dbginfo pass from my previous email, now it uses
> llvm/Analysis/DebugInfo.h
> - caveats: derived types are printed as "", no testcase (should I  
> add one?)
>
+    // a dbgstoppoint's information is valid until we encounter a new  
one
+    const DbgStopPointInst *LastDSP = DSI;
+    bool printed = !!DSI;

Why the "!!"?


+        } else if (const DbgFuncStartInst *FS =  
dyn_cast<DbgFuncStartInst>(i)) {
+
+          printFuncStart(FS);
+
+        }

Why the blank lines?

Thanks,

Evan

> Best regards,
> --Edwin
> <01-dbginfo.patch><02-dbginfo-utils.patch><03- 
> pass.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list