[llvm] r176882 - Debug Info: use DW_FORM_ref_addr instead of DW_FORM_ref4 if the referenced DIE

Manman Ren mren at apple.com
Wed Mar 13 12:50:35 PDT 2013


On Mar 13, 2013, at 1:23 AM, Eric Christopher <echristo at gmail.com> wrote:

> 
> 
> 
> +/// Climb up the parent chain to get the compile unit DIE this DIE belongs to.
> +DIE *DIE::getCompileUnit() const{
> +  DIE *p = getParent();
> +  while (p) {
> +    if (p->getTag() == dwarf::DW_TAG_compile_unit)
> +      return p;
> +    p = p->getParent();
> +  }
> +  return NULL;
> +}
> +
> 
> Shouldn't this be unreachable or is there some case where we have orphaned DIEs?
In r176962.
>  
> +/// For a given compile unit DIE, returns offset from beginning of debug info.
> +unsigned DwarfUnits::getCUOffset(DIE *Die) {
> +  for (SmallVector<CompileUnit *, 1>::iterator I = CUs.begin(),
> +       E = CUs.end(); I != E; ++I) {
> +    CompileUnit *TheCU = *I;
> +    if (TheCU->getCUDie() == Die)
> +      return TheCU->getDebugInfoOffset();
> +  }
> +  return 0;
> +}
> +
> 
> Can you make this a little more safe? Assert that it's a compile unit on entry and that'd hopefully make the return 0 also be unreachable?
In r176963.

-Manman
>  
> Also can you show at least some of the debug info for how you made your determination? This seems odd (at least the abstract origin part) and I'd like to understand how we lto'd something together and got this.
> 
> Thanks!
> 
> -eric
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130313/3da6c964/attachment.html>


More information about the llvm-commits mailing list