This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/17320] New: printing of array in structures with "set print array on" is odd


https://sourceware.org/bugzilla/show_bug.cgi?id=17320

            Bug ID: 17320
           Summary: printing of array in structures with "set print array
                    on" is odd
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: minor
          Priority: P3
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

The printing of an array in a structure if oddly formatted if "set print array
on" is set.

---array.c---
int foo[3] = { 1, 2, 3 };

struct s
{
  int a[3];
};

struct s bar = { { 1, 2, 3 } };

int
main ()
{
  return 0;
}
---

bash$ ./gdb -D ./data-directory -nx
(gdb) file array.x64
(gdb) start
(gdb) p bar
$1 = {a = {1, 2, 3}}
(gdb) set print pretty on
(gdb) p bar
$2 = {
  a = {1, 2, 3}
}
(gdb) set print array on
(gdb) p bar
$3 = {
  a =     {1,
    2,
    3}
}
(gdb) set print array-indexes on
(gdb) p bar
$4 = {
  a =     {[0] = 1,
    [1] = 2,
    [2] = 3}
}
(gdb) set print pretty off
(gdb) p bar
$5 = {a =     {[0] = 1,
    [1] = 2,
    [2] = 3}}
(gdb) set print array-indexes off
(gdb) p bar
$6 = {a =     {1,
    2,
    3}}
(gdb) 

The output for $3,4,5,6 is oddly formatted.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]