From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SFMEFWSU5WAkXQAAWB0awg (envelope-from ) for ; Wed, 07 Jul 2021 07:47:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 53B0F1F1F2; Wed, 7 Jul 2021 07:47:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B95671E01F for ; Wed, 7 Jul 2021 07:47:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 405CE39518B1 for ; Wed, 7 Jul 2021 11:47:47 +0000 (GMT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id 156EC394FC19 for ; Wed, 7 Jul 2021 11:46:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 156EC394FC19 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id u8so2686255wrq.8 for ; Wed, 07 Jul 2021 04:46:50 -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:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Lj2HmiAiJzSiL2wc2wLxfJLcBHYDi1dlw5Sc11eqkWU=; b=Sa6xVZVYGj6daqBQnkk61MEefVXz4gk5rvWEHulsHcKnrc11704Gd5HVNhYf49TG84 mIgN9ZEMlZXFFVvMf3yt9Tvhr3O8OilHw7oDnylpJVWZyvIQ6MOGHWuOYwL1YMKka+xw nY1YnBkdy6pI3nRyul0L9gkrsIkMmUHF3wuV8tQE78c/2TdKYlP8B7sLaRGsEj62FaXN /QX/FG1bCfEw85jOD97K49WTv/9gav4KFRTqW+m77r7yk+0wL+O6c46qp1oNQYwiu6YE 25c0Jv9afX3OaeNMnEzeQ3InnLOo/qGsZ9Ia9cq1rK4lhkUigvnBeQdmQPpHzyHyfIQ4 zm3w== X-Gm-Message-State: AOAM53215y4J/24Qfq1UEAXKhqsLAVbU9a+BqQ5AzMwKMwTZJ9nkcRBs NZmA/rFMPb/MgXeb4juXBnE= X-Google-Smtp-Source: ABdhPJz0Vv7A5HCzLwA87UHZz8sKSPl4bLPjOw5v+b/+NAeJ7AiAaubXCFSG5AWCfj4zsf7rRx51zw== X-Received: by 2002:adf:e40e:: with SMTP id g14mr8719861wrm.413.1625658409051; Wed, 07 Jul 2021 04:46:49 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:46bc:d03b:7b3a:2227? ([2001:8a0:f932:6a00:46bc:d03b:7b3a:2227]) by smtp.gmail.com with ESMTPSA id h14sm22916087wro.32.2021.07.07.04.46.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Jul 2021 04:46:48 -0700 (PDT) Subject: Re: [PATCH 02/11] gdb: introduce intrusive_list, make thread_info use it From: Pedro Alves To: Simon Marchi , gdb-patches@sourceware.org References: <20210622165704.2404007-1-simon.marchi@polymtl.ca> <20210622165704.2404007-3-simon.marchi@polymtl.ca> <2466c5e0-36f4-ce47-f05f-022cda04bb04@palves.net> <3707d3e0-3166-cee1-dabd-cb101807c01e@polymtl.ca> Message-ID: <00b850dc-6d17-1651-e8d2-4712d03950b8@palves.net> Date: Wed, 7 Jul 2021 12:46:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <3707d3e0-3166-cee1-dabd-cb101807c01e@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-07-06 10:45 p.m., Simon Marchi wrote: > On 2021-07-06 5:02 p.m., Pedro Alves wrote: >> On 2021-07-06 8:38 p.m., Simon Marchi wrote: >>> On 2021-07-05 11:44 a.m., Pedro Alves wrote: >>>>>> $1 = intrusive list of thread_info = { >>>> {id = 1.1, ptid = 1000.1000.0, state = THREAD_RUNNING}, >>>> {id = 1.3, ptid = 1000.1002.0, state = THREAD_STOPPED}, >>>> {id = 1.5, ptid = 1000.3672.0, state = THREAD_STOPPED} >>>> } >>> >>> How would you accomplish this, with a struct thread_info >>> pretty-printer? This means that printing a single thread like this: >>> >>> (gdb) print *tp >>> >>> would also produce the short output, I don't think we want that. When >>> we print a single thread_info structure, I think it's good to have all >>> the fields shown. >> >> I don't have a great answer. It feels to me like the pretty printer code >> should ask the container if it has a custom printer for the element, and only >> if it doesn't would it look up the printer for the element's type. > > That would be a new feature that doesn't exist today, I think: a > different printer for a type when it's printed as a container element > than when it's printed standalone. Yeah. > I think these are all good ideas for improvements, but I'd rather keep > them for later (if someone wants to implement them, I'm not sure I > will). We could bike-shed for a while on how to display a thread_info, > what to include / what to exclude, etc. I think that my original > proposal is strictly better than what we have today, in the sense that > today you just can't print the whole list of threads, so we don't lose > anything. The discussion about the thread_info pretty printer, yes, agreed. However, the discussion on the list printer itself, one point that we should settle discuss a bit more is whether it is really the right approach to make it show children as pointers. Showing pointers really looks not useful to me. The only thing I think I get out of it is that there are elements in the list. I mean, AFAICT, even the std::list printer shows objects, not pointers, for instance: (gdb) p my_list $1 = std::__cxx11::list = {[0] = 1, [1] = 2, [2] = 3} Hmm, funny, it shows the indexes, even though I don't have array-indexes off. Guess it must be using "map", but I haven't checked. Imagine we were using std::list for thread_info objects. But I don't think that that discussion should block the main change from going in. I'd support moving the printer out to a separate patch, even.