[llvm-bugs] [Bug 32269] New: Optimized debug info of subregisters is overly narrow & verbose

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 14 11:32:47 PDT 2017


            Bug ID: 32269
           Summary: Optimized debug info of subregisters is overly narrow
                    & verbose
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: aprantl at apple.com
          Reporter: dblaikie at gmail.com
                CC: llvm-bugs at lists.llvm.org

void f1(bool b) {

Currently the location description for 'b' (when compiled with optimizations,
-O1 (possibly mem2reg alone) will suffice) is:

  0x55 0x9d 0x01 0x00

  DW_OP_reg5 DW_OP_bit_piece 1 0

Which describes 1 bit at the beginning of reg5.

This causes GCC to print an error when trying to render the variable:

  "error reading variable: access outside bounds of object referenced via
synthetic pointer"

Which seems not unreasonable - the notion that rendering a bool requires access
to all 8 bits of its representation, even if the top 7 bits could be assumed to
be zero. So, yeah, a better debugger might be able to get by - but it seems OK
to try to make this work with GDB as-is.

The fix for this might be in mem2reg, or specifically
llvm::ConvertDEbugDeclareToDebugValue, the special case for ExtendedArgs. If
teh Offset is zero, instead skip the new complex expression and reference the
arg directly.

This gets some of the way, but then LLVM produces:

  DW_OP_reg5 DW_OP_piece 4

Which also seems unnecessary/verbose (& sort of incorrect - describing it as
specifically 4 bytes for a 1 byte thing - though the debugger can choose the
low byte appropriately).

This could be changed in DwarfExpression::setSubRegisterPiece could be a no-op
when the offset is zero? (But this wouldn't be quite right for a case where
that piece was used as part of a larger value, perhaps... (a struct with two
bools, each in a register? Not sure what the right representation for that is))

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/20170314/aedb4ea3/attachment-0001.html>

More information about the llvm-bugs mailing list