[llvm-bugs] [Bug 37234] New: Recent regression in -O2 -g debugging quality since change to improve handling of dangling debug info

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 25 05:31:47 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37234

            Bug ID: 37234
           Summary: Recent regression in -O2 -g debugging quality since
                    change to improve handling of dangling debug info
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: greg.bedwell at sony.com
                CC: aprantl at apple.com, bjorn.a.pettersson at ericsson.com,
                    dblaikie at gmail.com, llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Using the tool I've developed "DExTer" (Recently presented at EuroLLVM:
http://llvm.org/devmtg/2018-04/talks.html#Lightning_11 - hopefully open-sourced
very soon so that potentially we can set up a bot to track this over time) I've
noticed a recent regression in the optimized debugging experience quality which
I've bisected to "[llvm] r327303 - [SelectionDAG] Improve handling of dangling
debug info".  

Here's my testcase:

// =========================================================
int main() {
        const char* buffer = "aaa";
        unsigned aa = 0;
        while (char c = *buffer++) {
                if (c == 'a')
                        ++aa;  // DexWatch('aa')
        }
        return aa;
}
// DexExpectWatchValue('aa', 0, 1, 2, on_line=7)
// =========================================================

Here are my before and after DExTer traces, which show the steps taken by the
debugger.  In the before case, the first time we step to line 7, evaluating
expression "aa" returns the value 0, the second time the value 1 and the third
time the value 2.  In the after case, "aa" evaluates to 0 each of the three
times we are on line 7.  Stepping is otherwise unchanged.  This should be
easily reproducible using a debugger manually.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BEFORE:
$
C:\work\public-git\upstream-llvm\build-vs2015-native-ninja\bin_BEFORE\clang++.exe
-v
clang version 7.0.0 (trunk 327294) (llvm/trunk 327302)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir:
C:\work\public-git\upstream-llvm\build-vs2015-native-ninja\bin_BEFORE

$ py dexter.py test --builder clang --debugger lldb --cflags="-O2 -g"
--ldflags="-g" -v --tests-dir=tests\investigation
investigation = 0/21 (0.0000)

## BEGIN ##
[1, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "FUNC", {}]
[2, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "0"}]
[3, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[4, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "1"}]
[5, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[6, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "2"}]
[7, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[8, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 10, 1,
"BREAKPOINT", "FORWARD", {}]
.   [9, null, null, 0, 0, "STEP", "UNKNOWN", {}]
## END (9 steps) ##


  test.cpp:7 [aa] [0/21]
    expected encountered values:
      0
      1
      2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AFTER:
$
C:\work\public-git\upstream-llvm\build-vs2015-native-ninja\bin_AFTER\clang++.exe
-v
clang version 7.0.0 (trunk 327294) (llvm/trunk 327303)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir:
C:\work\public-git\upstream-llvm\build-vs2015-native-ninja\bin_AFTER

$ py dexter.py test --builder clang --debugger lldb --cflags="-O2 -g"
--ldflags="-g" -v --tests-dir=tests\investigation
investigation = 12/21 (0.5714)

## BEGIN ##
[1, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "FUNC", {}]
[2, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "0"}]
[3, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[4, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "0"}]
[5, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[6, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 4,
"BREAKPOINT", "FORWARD", {"aa": "0"}]
[7, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 18,
"BREAKPOINT", "BACKWARD", {}]
[8, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 10, 1,
"BREAKPOINT", "FORWARD", {}]
.   [9, null, null, 0, 0, "STEP", "UNKNOWN", {}]
## END (9 steps) ##


  test.cpp:7 [aa] [12/21]
    expected encountered values:
      0

    missing values:
      1 [+6]
      2 [+6]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've seen this behaviour using both LLDB on my Windows PC and with the PS4
debugger (DWARF-based).

Interestingly, with clang-cl.exe and the Visual Studio 2017 debugger, I get
essentially the same before case, with values of 0, 1 and 2 reported.  In the
after case, I get:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ py dexter.py test --builder clang-cl --debugger vs2017 --cflags="/Ox /Zi"
--ldflags="/Zi" -v --tests-dir=tests\investigation
investigation = 9/21 (0.4286)

## BEGIN ##
[1, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 2, 1,
"BREAKPOINT", "FUNC", {}]
[2, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 1,
"BREAKPOINT", "FORWARD", {}]
[3, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 1,
"BREAKPOINT", "FORWARD", {"aa": "Variable is optimized away and not
available."}]
[4, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 1,
"BREAKPOINT", "BACKWARD", {}]
[5, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 1,
"BREAKPOINT", "FORWARD", {"aa": "Variable is optimized away and not
available."}]
[6, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 1,
"BREAKPOINT", "BACKWARD", {}]
[7, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 7, 1,
"BREAKPOINT", "FORWARD", {"aa": "Variable is optimized away and not
available."}]
[8, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 5, 1,
"BREAKPOINT", "BACKWARD", {}]
[9, "main", "c:\\work\\git\\dexter\\tests\\investigation\\test.cpp", 10, 1,
"BREAKPOINT", "FORWARD", {}]
## END (9 steps) ##


  test.cpp:7 [aa] [9/21]
    result optimized away:
      step 3 (Variable is optimized away and not available.) [+3]
      step 5 (Variable is optimized away and not available.) [+3]
      step 7 (Variable is optimized away and not available.) [+3]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

which is better than the DWARF version, but still a step down from what it
reported with the previous commit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180425/55d822cd/attachment-0001.html>


More information about the llvm-bugs mailing list