From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48570 invoked by alias); 26 Sep 2017 07:56:39 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 48416 invoked by uid 89); 26 Sep 2017 07:56:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=stahl, Stahl, H*r:gdb@gnu.org, Hx-languages-length:1903 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Sep 2017 07:56:21 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwkj0-00083l-2g for gdb@sourceware.org; Tue, 26 Sep 2017 03:56:19 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwkj0-00083a-07 for gdb@sourceware.org; Tue, 26 Sep 2017 03:56:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53833) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dwkiz-00041n-Pj for gdb@gnu.org; Tue, 26 Sep 2017 03:56:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwkiu-0007zh-Cp for gdb@gnu.org; Tue, 26 Sep 2017 03:56:13 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:49656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwkiu-0007wl-6Z for gdb@gnu.org; Tue, 26 Sep 2017 03:56:08 -0400 Received: by mail-wm0-f52.google.com with SMTP id r74so4717066wme.4 for ; Tue, 26 Sep 2017 00:56:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l/Gxr0ooohj8bOCCXAN+H76JJY3y/bL4xiMedJ8//3c=; b=KoG5TN9sXq7OCGfOLFWf9x3q/QfaeoXh9k7AfQczy5n/Nem0gCEmFg/l6ZbqOECGF9 g78pNfRcEU25ET/F0gw+KAQA2DIR+YKJC4XYu+89Jr3eyWf5hQQkGIC7h8VDdhznYNSC 5cwb7SmqXGZDHfn89x+wi4X5scTlTGIJAawL9xt5xnTqCW7xaD/2o9tGpfV9afVYwMhB Ji0QuFaUYYvE+/Z+ohFTbfoX6QGxpW6Cpg6JHtAE+HndFH6jFho0S/bGJ9iKodZRxnNo Nm4UUGnIeUeRUJXyzEYckxzEiQBtHVg2OLv4G2IiAfSjxeUJDNbwy+4ylSpVjZPOXDm/ XoIA== X-Gm-Message-State: AHPjjUhL6Lrwg7tLkpQF7BQDs1knFFM+Lh04zPorUfg4vXorxiUt5RLO 9f3zdd8UNAyo0aIdJOCpekj+tw== X-Google-Smtp-Source: AOwi7QCsZwQ5pdfUIjnBlB0sWqkDhEh4pVSdCdDqcpqCKGtVSes2YWHic+4phye+XUPSzkrj/lL4fQ== X-Received: by 10.80.138.2 with SMTP id i2mr1781013edi.279.1506412566154; Tue, 26 Sep 2017 00:56:06 -0700 (PDT) Received: from ?IPv6:2a02:c7f:ae15:7800:4685:ff:fe66:9f4? ([2a02:c7f:ae15:7800:4685:ff:fe66:9f4]) by smtp.gmail.com with ESMTPSA id g30sm5263141edb.63.2017.09.26.00.56.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 00:56:04 -0700 (PDT) Subject: Re: gdb 8.0 "lazy_string" exception "Length is larger than array size" To: Michael Stahl , gdb@gnu.org, Doug Evans , Doug Evans References: From: Phil Muldoon Message-ID: Date: Tue, 26 Sep 2017 07:56:00 -0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00119.txt.bz2 On 25/09/17 18:20, Michael Stahl wrote: > > hi, > > for the following string type: > > /** The implementation of a Unicode string. > */ > typedef struct SAL_DLLPUBLIC_RTTI _rtl_uString > { > oslInterlockedCount refCount; /* opaque */ > sal_Int32 length; > sal_Unicode buffer[1]; > } rtl_uString; > > the gdb python pretty-printer calls: > > return data.lazy_string(encoding, length) > > full python pretty-printer module: > > https://gerrit.libreoffice.org/gitweb?p=core.git;a=blob;f=solenv/gdb/libreoffice/util/string.py;h=32583718f83b2ad5707f75dd6327d9aa62764439;hb=5f210715fe090b4db4c80dcdee5f77dc404cf85c#l56 > > now this results in this exception: > > Traceback (most recent call last): > File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line > 29, in to_string > return self.make_string(data, self.encoding, len) > File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line > 66, in make_string > return data.lazy_string(encoding, length) > gdb.error: Length is larger than array size. > > this is with Fedora 26 "GNU gdb (GDB) Fedora 8.0.1-26.fc26" - in Fedora > 25 this did not throw an exception. > > apparently the problem is that the array is statically declared as > "buffer[1]", however its actual dynamic size is the same as "length". > > is this a bug in gdb or is lazy_string not intended to support this > scenario? > > regards, > michael > Yeah, it's determining the string is an array and finding that the declared length is larger then the array size. This is (as you noted) the initial length of the array is [1] and that array is then modified later. This code was added at 34b433203b5 by Doug Evans and it was noted it was a bug. I've not sure, though, fixing this bug may have had unintended consequences. I've CC'd Doug on the patch and maybe he could comment further. Cheers Phil