[PATCH] D83468: [Debuginfo] Fix for PR46653

Jaydeep Chauhan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 11:13:34 PDT 2020


Jac1494 added a comment.

In D83468#2221792 <https://reviews.llvm.org/D83468#2221792>, @aprantl wrote:

> If the problem that you want to solve is that the prologue ends at line 0, then massaging earlier passes until the right result happens to come up in one testcase is not going to be very effective. Yes, it may fix the testcase, but that won't last long, and the patch is introducing questionable behavior that will end up causing other problems.

Please consider below testcase for further discussion:

   1 /* demo testcase */
   2 int garr[2];
   3 int main() {
   4
   5         if((garr[0] && garr[1])==0){
   6                 garr[0]=1;
   7                 garr[1]=1;
   8         }
   9         else {
  10                 garr[0]=2;
  11                 garr[1]=2;
  12         }
  13         printf("%d %d\n",garr[0], garr[1]);
  14         return 0;
  15 }

Currently there are two problem is there and both are because of line number zero

1. prologue_end with line zero (Because of this when we set brackpoint on function control goes to line zero)

  (gdb) b main
  Breakpoint 1 at 0x800005ec: file test.c, line 0.



  When we try to set break point in main than it is showing breakpoint is set at line zero because of prologue_end is at line zero


2. Other debug line zero also creating debugging problem,which mentioned in below case.In this case  because of line number zero , control is going to line 1

  Breakpoint 1, main () at test.c:0
  1       /* demo testcase */
  (gdb) n
  5               if((garr[0] && garr[1])==0){
  (gdb)
  1       /* demo testcase */
  (gdb)
  5               if((garr[0] && garr[1])==0){
  (gdb)
  1       /* demo testcase */
  (gdb)
  6                       garr[0]=1;
  (gdb)
  7                       garr[1]=1;
  (gdb)
  8               }
  (gdb)
  1       /* demo testcase */
  (gdb)
  13              printf("%d %d\n",garr[0], garr[1]);
  (gdb)
  1       /* demo testcase */
  (gdb)
  13              printf("%d %d\n",garr[0], garr[1]);
  (gdb)
  1 1
  14              return 0;
  (gdb)
  
  Address            Line   Column File   ISA Discriminator Flags
  ------------------ ------ ------ ------ --- ------------- -------------
  0x0000000000000000      3      0      1   0             0  is_stmt
  0x000000000000000c      0      0      1   0             0  is_stmt prologue_end
  0x000000000000001c      5     13      1   0             0  is_stmt
  0x000000000000002c      5     21      1   0             0
  0x0000000000000030      0     21      1   0             0
  0x0000000000000034      5     24      1   0             0
  0x0000000000000038      5     21      1   0             0
  0x0000000000000044      0     21      1   0             0
  0x0000000000000048      5     12      1   0             0
  0x000000000000004c      0     12      1   0             0
  0x0000000000000054      6     24      1   0             0  is_stmt
  0x000000000000005c      7     24      1   0             0  is_stmt
  0x0000000000000060      8      9      1   0             0  is_stmt
  0x0000000000000064      0      9      1   0             0
  0x000000000000006c     10     24      1   0             0  is_stmt
  0x0000000000000074     11     24      1   0             0  is_stmt
  0x0000000000000078      0      0      1   0             0
  0x000000000000007c     13     26      1   0             0  is_stmt
  0x0000000000000084     13     35      1   0             0
  0x0000000000000088      0      0      1   0             0
  0x0000000000000090     13      9      1   0             0
  0x0000000000000098     14      9      1   0             0  is_stmt
  0x00000000000000a8     14      9      1   0             0  is_stmt end_sequence

This issue is with Global-isel and this line number is set in IRTranslator and Legalizer also.And I have suggested fix in IRTranslator and Legalizer pass previously but it was rejected.

Is above understanding of the issue matches with your understanding ..?

@aprantl , @arsenm Could you please suggest where this should be fixed ?? if this is not correct place to fix this issue , In other common passes of Global-isel and Selection-DAG or AsmPrinter...?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83468/new/

https://reviews.llvm.org/D83468



More information about the llvm-commits mailing list