<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - String formatter regex wrongly catching multi-dimensional types as well."
   href="https://bugs.llvm.org/show_bug.cgi?id=47766">47766</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>String formatter regex wrongly catching multi-dimensional types as well.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chirag@raincode.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For a simple C program,
struct b {
        char i[2][4];
};

int main() {
        struct b z;
        z.i[0][0] = 'F';
        z.i[0][1] = 'O';
        z.i[0][2] = 'O';
        z.i[0][3] = 0;
        z.i[1][0] = 'B';
        z.i[1][1] = 'A';
        z.i[1][2] = 'R';
        z.i[1][3] = 0;
        return 0;
}

while printing variable z, the type summary finder finds the summary provider
because it matches the regex "char [[0-9]+]" while looking for char [2][4] and
failing while printing due to not knowing how to handle the datatype.

(As per conversation on lldb-dev mail thread)The regex should be "char
[[0-9]+]$" with string terminator anchor to start matching at end to avoid
trying to print multi-dimensional data.

============================================================================
LLDB

currently,
(lldb) target create "/home/chirag/a.out"
Current executable set to '/home/chirag/a.out' (x86_64).
(lldb) b 15
Breakpoint 1: where = a.out`main + 36 at struct.c:15, address =
0x0000000000400511
(lldb) r
Process 57100 launched: '/home/chirag/a.out' (x86_64)
Process 57100 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400511 a.out`main at struct.c:15
   12           z.i[1][1] = 'A';
   13           z.i[1][2] = 'R';
   14           z.i[1][3] = 0;
-> 15           return 0;
   16   }
(lldb) p z
(b) $0 = (i = char [2][4] @ 0x0000000001fe3ca0)
(lldb) q


============================================================================
GDB

while gdb prints as expected,
Reading symbols from /home/chirag/a.out...done.
(gdb) b 15
Breakpoint 1 at 0x400511: file Desktop/test/struct.c, line 15.
(gdb) r
Starting program: /home/chirag/./a.out

Breakpoint 1, main () at Desktop/test/struct.c:15
15              return 0;
Missing separate debuginfos, use: debuginfo-install glibc-2.17-307.el7.1.x86_64
(gdb) p z
$1 = {i = {"FOO", "BAR"}}
(gdb) q
A debugging session is active.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>