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 python/16286] New: value.string(length = x) broken for common variable length arrays idiom


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

            Bug ID: 16286
           Summary: value.string(length = x) broken for common variable
                    length arrays idiom
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

The fix for PR 16196 broke reading strings of variable length arrays that use
the common idiom of having a trailing 1 byte array at the end of a struct.

struct str
{
  int length;
  /* Variable length.  */
  char text[1];
};

(gdb) python xstr = gdb.parse_and_eval('xstr')
(gdb) python print xstr['text'].string (length = xstr['length'])
x

What should happen is that the entire string of length "length" is printed.

Patch and testcase to follow.

-- 
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]