From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90873 invoked by alias); 13 Dec 2019 19:42:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 90848 invoked by uid 89); 13 Dec 2019 19:42:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1125 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 19:42:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576266143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TBMKr7XMR86Q+D/KGQFdKVJzJvlyZqqdRp7hkutQH3Q=; b=E5jr9VBSdzKHn7WeROOb/Nnz9Mq/4V41+R7qmFcYlQwTPg+3gdbscBz6aNmSIhCcTbc56x cAmLVGuSbAs4sSJoRFDOdvtOk1zCsMRDgq/eAb7U6n6MOsyyTfM9mlxG814dEou8YAeGys AaW8kUieBRvyTBEhuZykQk4I/0KQDT8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-130-WK0pF5Y_PXysPxjPyhKVoQ-1; Fri, 13 Dec 2019 14:42:21 -0500 Received: by mail-wr1-f69.google.com with SMTP id i9so154632wru.1 for ; Fri, 13 Dec 2019 11:42:21 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id c17sm10816568wrr.87.2019.12.13.11.42.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Dec 2019 11:42:19 -0800 (PST) Subject: Re: [PATCH 5/7] jit: make gdb_object::symtabs a vector of unique_ptr To: Simon Marchi , gdb-patches@sourceware.org References: <20191213060323.1799590-1-simon.marchi@polymtl.ca> <20191213060323.1799590-6-simon.marchi@polymtl.ca> From: Pedro Alves Message-ID: Date: Fri, 13 Dec 2019 19:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-12/txt/msg00609.txt.bz2 On 12/13/19 6:51 PM, Simon Marchi wrote: > On 2019-12-13 1:45 p.m., Simon Marchi wrote: >> I don't think so. We return these pointers to the JIT debug readers, which then pass >> it back to the block_open and symtab_close callbacks. It's important that the objects >> don't move during their lifetime. If we had a vector of objects, the pointers we return >> to the user would get invalidated the moment the vector is resized. > > Actually, it would be good to document this, so we don't change it to a vector of > objects, out of good intention. I would add this to document the gdb_object::symtabs > field: > > /* Symtabs of this object. > > This is a vector of pointers, rather than a vector of objects, because the > pointers are returned to the user's debug info reader, so it's important > that the objects don't change location during their lifetime (which would > happen with a vector of objects getting resized. */ > > I would add a similar comment later in the series to document gdb_symtab::blocks. That looks good to me. Thanks, Pedro Alves