[PATCH] D51908: [DebugInfo] Do not generate debug info for removed labels.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 00:58:16 PDT 2018


HsiangKai added a comment.

In https://reviews.llvm.org/D51908#1232585, @dblaikie wrote:

> In https://reviews.llvm.org/D51908#1231469, @HsiangKai wrote:
>
> > If it has no DW_AT_low_pc in label debug info, GDB seems to assume it is 0x0.
> >
> >   (gdb) info scope foo
> >   Scope for foo:
> >   Symbol done is a label at address 0x400551, length 8.
> >   Symbol unreach is a label at address 0x0, length 8.
> >
> >
> > llvm-dwarfdump results:
> >
> >   0x00000056:     DW_TAG_label
> >                     DW_AT_abstract_origin (0x00000075 "done")
>
>
> Hmm - what's the test case you're using here? Is there inlining? What about in cases without inlining?


My test case is as follow. I compile it with optimization on, so there is inlining in the result.

  int foo(void)
  {
      goto done;
  unreach:
      printf("hi\n");
  done:
      return rand() % 666;
  }
  
  int main()
  {
    return foo();
  }

I removed the function call as follow:

  int main()
  {
    goto done;
  unreach:
    printf("hi\n");
  done:
    return rand() % 666;
  }

llvm-dwarfdump results:

  0x00000043:     DW_TAG_label
                    DW_AT_name    ("done")
                    DW_AT_decl_file       ("noinline.c")
                    DW_AT_decl_line       (9)
                    DW_AT_low_pc  (0x0000000000400541)
  
  0x00000052:     DW_TAG_label
                    DW_AT_name    ("unreach")
                    DW_AT_decl_file       ("noinline.c")
                    DW_AT_decl_line       (7)
  
  0x00000059:     NULL

It still caused GDB to crash if set breakpoint on `unreach`


Repository:
  rL LLVM

https://reviews.llvm.org/D51908





More information about the llvm-commits mailing list