[PATCH] PR19864: Revert r209764 in favor of the fix in r215766 (loop backedge jump attributed to confusing location when the last source line of a loop is inside a conditional)

Adrian Prantl aprantl at apple.com
Mon Aug 18 14:23:20 PDT 2014


I tested the patch with LLDB, and it takes the line table literally:

```
void body() { printf("body\n"); }
foo::operator bool() throw() { return false; }
foo::~foo() { printf("~foo\n"); }

* thread #1: tid = 0x2a38e9, 0x0000000100000d8d debug-info-line-if`main + 221 at debug-info-line-if.cpp:51, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000d8d debug-info-line-if`main + 221 at debug-info-line-if.cpp:51
   48  	  // CHECK: call void @_ZN3fooD1Ev{{.*}}, !dbg [[DBG3:!.*]]
   49  	
   50  	  //#line 400
-> 51  	  if (foo f = foo())
   52  	    body(); // this might throw
   53  	
   54  	  // GDB currently steps from the 'foo f' line to the 'body()' line, even if 'f'
(lldb) 
Process 10528 stopped
* thread #1: tid = 0x2a38e9, 0x0000000100000dc9 debug-info-line-if`main + 281 at debug-info-line-if.cpp:52, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000dc9 debug-info-line-if`main + 281 at debug-info-line-if.cpp:52
   49  	
   50  	  //#line 400
   51  	  if (foo f = foo())
-> 52  	    body(); // this might throw
   53  	
   54  	  // GDB currently steps from the 'foo f' line to the 'body()' line, even if 'f'
   55  	  // is false, because the call to 'f's dtor is attribute to the 'body()' line.
(lldb) 
~foo
Process 10528 stopped
* thread #1: tid = 0x2a38e9, 0x0000000100000dce debug-info-line-if`main + 286 at debug-info-line-if.cpp:78, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000dce debug-info-line-if`main + 286 at debug-info-line-if.cpp:78
   75  	  // CHECK: [[DBG5]] = metadata !{i32 401, i32 0, metadata !{{.*}}, null}
   76  	
   77  	  //#line 404
-> 78  	}
(lldb) 
```
I know there is no satisfying line number for the call to ~foo, but putting it on a line that may not even get executed feels wrong to me. If necessary, I'd rather associate it with line 0, which is what the standard "no such location" location for the debugger to ignore.

http://reviews.llvm.org/D4956






More information about the cfe-commits mailing list