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/13339] type.array(X) creates array of X+1 items


http://sourceware.org/bugzilla/show_bug.cgi?id=13339

--- Comment #1 from Phil Muldoon <pmuldoon at redhat dot com> 2011-10-27 10:58:02 UTC ---
This is a confusion in the API between size, and the range passed to GDB:


(gdb) n
381          n2 = n1;
(gdb) n
382          n1 = 0;
(gdb) p n2
$3 = 2
(gdb) n
385      if (n2 < n1)
(gdb) n
392      TRY_CATCH (except, RETURN_MASK_ALL)
(gdb) 
394          array = lookup_array_range_type (type, n1, n2);

So the user wants an array of size "2"

But lookup_array_range_type wants a "low bound" and a "high bound", so in this
case 0..2, which results in an array size of 3.

My solution is to reduce the size argument provided by Python minus one.  What
do you think?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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]