[llvm-bugs] [Bug 30553] Debug info generated for arrays is not what GDB expects (not as good as GCC's)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 9 10:32:21 PST 2018


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

Paul Robinson <paul_robinson at playstation.sony.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Paul Robinson <paul_robinson at playstation.sony.com> ---
Reopened on behalf of Carlos Enciso, who made this comment on Phabricator
post-commit:

Hi @sdesmalen!

First of all my apologies for commenting after the issue has been closed, but I
do not have an account to add a comment to the associated bugzilla.

I have found what it seems to be an issue with the current implementation.

For the given test case

  int main() {
    int size = 2;

    int vla_expr[size];
    vla_expr[1] = 1;

    return 0;
  }

and while debugging with LLDB, the following error is generated:

  (lldb) n
  Process 21014 stopped
  * thread #1, name = 'bad.out', stop reason = step over
      frame #0: 0x0000000000400502 bad.out`main at vla_2.cpp:7
     4            int vla_expr[size];
     5            vla_expr[1] = 1;
     6          
  -> 7            return 0;
     8          }

  (lldb) p vla_expr
  (unsigned long) $0 = 2

  (lldb) p vla_expr[1]
  error: subscripted value is not an array, pointer, or vector

  (lldb) 

Looking at the DWARF generated, there are 2 variables with the same name at the
same scope

  DW_TAG_subprogram "main"
    ...
    DW_TAG_variable "size"
    DW_TAG_variable "vla_expr"
    DW_TAG_variable "vla_expr"

I think there are 2 issues:

The compiler generated variable 'vla_expr'

- should be flagged as artificial (DW_AT_artificial)
- its name should start with double underscore to avoid conflicting with
user-defined names.

Thanks,
Carlos

-- 
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/20180209/30d23085/attachment-0001.html>


More information about the llvm-bugs mailing list