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

Eric Christopher echristo at gmail.com
Wed Mar 13 01:23:06 PDT 2013


> +/// 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?


> +/// 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?

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/1b1e34b7/attachment.html>


More information about the llvm-commits mailing list