From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6CC513875DED for ; Fri, 29 Sep 2023 10:30:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CC513875DED Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695983425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEEdWpQAOwmMPxiGpXY6lheE5nE8L7866vADQCQ2B2w=; b=ZG7jeNXFNdp1D+bGaxXRlpSRaAJsS26y4L/RFo1qen/g21HegfpwAkGd5OK+6SOVkgbk9o sOgnlQ3Z4pkcVytzNStfu/Ht16bYjh6iPz3Mu3Oiviirh8keqp56uj0QWwfWvhB3Z+LEDh KtacuNRdbYjne5+Nenr3yTD+X8BEYKQ= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-2oiXOEf_MNe5CXNp1178lA-1; Fri, 29 Sep 2023 06:30:23 -0400 X-MC-Unique: 2oiXOEf_MNe5CXNp1178lA-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-531373ea109so11388013a12.3 for ; Fri, 29 Sep 2023 03:30:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695983422; x=1696588222; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MEEdWpQAOwmMPxiGpXY6lheE5nE8L7866vADQCQ2B2w=; b=XAfxFzapQ7t/KamL36Fvt+vYXFvF4am0SJuQASgc2TuHA/Ysw0kxkCTp8o0muSpPQa 0QJAONsbfT5W4H5TCtdxH/u20V1jHld14LO4BV42mDN3n5YKPXIe1+4C3o75aha1jcp4 Bmd+nvTFVyhjy76QLiGXcqBL+A9wy8ZuCE1tqlUwcllCrir/mfRVG5t+Ni4C1wMa3gkR HS7xYpdHDOHLxS27+d30KakITE7TDOWGg1FRo8dp9/rDO+oX1Zm9Bir+FpEzNpPAFE4Y jGGajrcrcYl1+gbtwaG0UhdaKurTKj+vV5oJqUTaaYNARyQ8H4SboJ5o79CHOxVGCEEu p4jw== X-Gm-Message-State: AOJu0Yyf0LDsE0xHg1P/93Sd414Rq7SuEJsWJ1T/2Hy3glUmxAvAaQxv 5i8+Azhs15645T1v5udqoG0mEOz1DoJQvYTHSg9hI0hcaJctwgG4EAy9KKzpWtbJYXFJx7N+/JP I0311wj4jFFfiGrzXZNA= X-Received: by 2002:a05:6402:d51:b0:536:e5f7:b329 with SMTP id ec17-20020a0564020d5100b00536e5f7b329mr1601513edb.33.1695983422298; Fri, 29 Sep 2023 03:30:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE47hgltV3pGHXp36NzUxIzRpRkyhU1Ipeqq3HDtRb4Gy3rWzduDLdKRwaD8TM63gkRcs0dZA== X-Received: by 2002:a05:6402:d51:b0:536:e5f7:b329 with SMTP id ec17-20020a0564020d5100b00536e5f7b329mr1601502edb.33.1695983421932; Fri, 29 Sep 2023 03:30:21 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-227-180.bb.vodafone.cz. [94.112.227.180]) by smtp.gmail.com with ESMTPSA id e23-20020a056402089700b00530bc7cf377sm10894135edy.12.2023.09.29.03.30.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Sep 2023 03:30:21 -0700 (PDT) Message-ID: <9440ee6a-ae85-453b-8129-e8674281d4f4@redhat.com> Date: Fri, 29 Sep 2023 12:30:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: Turn history saving on by default? (Re: GDB BoF notes - GNU Cauldron 2023) To: Pedro Alves , Lancelot SIX Cc: gdb@sourceware.org References: <1e26c71e-e242-de11-a687-46e05586e608@palves.net> <19c57e96-288e-1954-c211-93fc4b22b43e@redhat.com> <20230929092410.u4j5i73bpg5ictyw@octopus> <636abef0-7d22-e294-7f31-21f98ad3eb2a@palves.net> From: Guinevere Larsen In-Reply-To: <636abef0-7d22-e294-7f31-21f98ad3eb2a@palves.net> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 29/09/2023 11:52, Pedro Alves wrote: > On 2023-09-29 10:24, Lancelot SIX wrote: >>>> - Revisiting defaults >>>> >>>> - Can we turn history saving on by default? Maybe default to >>>> history on home dir by default, too (~/.gdb_history). That would >>>> align us with bash. Some in the room have had this enabled in >>>> their gdbinits for so long they no longer remembered this wasn't >>>> on by default. Others weren't even aware you can turn this on. >>> One issue I find with the bash approach is that you end up mixing history >>> between multiple unrelated sessions. Bash can't solve this but GDB possibly >>> could. >>> >>> My suggestion would be to use an approach similar to vim's swap files. As an >>> example, editing the maintainers file, I have the file ~/.local/state/nvim/swap/%home%blarsen%Documents%binutils-gdb%gdb%MAINTAINERS.swp; >>> This way you can have histories specific to any binary you're debugging >>> without mixing sessions. >>> >> Hi, >> >> With such approach, I am not really sure how to name/identify a session. >> Is that based on the name of the binary you're debugging? If so what >> happens if you use `file another_bin`? Either you switch to another >> "session", but really you never left GDB so that would seem odd to me, >> or you end up having history about another_bin in your first apparently >> unrelated session. > Of what happens if you start GDB without a binary at all? Yeah, those are good points. Any way to fix this is way over-engineering compared to just "local histories in each folder". > >> Similarly, when dealing with multiple inferiors, would running `inferior >> N` switch from session to session? >> >> I can see cases where such behavior could be helpful, but there seems >> to be a lot of edge cases where it could become strange. >> >> My feeling for now is that the best way to achieve this is to save the >> gdb history in the current directory, with the "risk" of having plenty >> of history files left all-over the place (as you mentioned already). >> >> I feel that having the default somewhere under $HOME / $XDG_STATE_HOME >> (as suggested by Tom) seems an "easier" default. >> > My thoughts exactly. +1. > > On my bash for example, I got recently annoyed with > all my ssh shells overwriting the same history file, so I came up with a way to > have easy separate bash history sessions. But, I still think that the bash default > is OK. > > The only viable options that I can think of for gdb are: > > #1 - don't save history (current default) > #2 - save history in current dir > #3 - save history in $HOME (or somewhere XDG if it makes system for the system) > > #1 is of course the current default. > > #2 is what I do in my .gdbinit: > > set history save on > set history filename .gdb_history > set history size unlimited > > This works well enough for me. It does have the downside of sprinkling .gdb_history files all > over the place, which gets a bit annoying at times. E.g., sometimes I'll spawn gdb in a random > directory because I often use gdb as my calculator :-) ("(gdb) p 1 + 2 * 3", etc.), > which ends up with a .gdb_history file in that dir. Still, it's my choice, and > I am aware of the consequences. > > #3 seems like a reasonable default to me, which doesn't have that "sprinkle files > throughout the filesystem" issue. > Yeah, I think I agree. This can still be over-written by a user that wants separate histories, and having mixed ones is better than nothing at all. +1 for making 3 the default -- Cheers, Guinevere Larsen She/Her/Hers