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 0006B384A06B for ; Fri, 10 May 2024 10:19:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0006B384A06B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0006B384A06B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715336371; cv=none; b=J3EJAaJaI0Z315Iu/SzHNrE4zdmuE2UUpKAtoes15eIG8d/cqaKEvIO6qOEK1UYemaz2fLs2kJ86jAsDCS6sJW5leYLdN70bDdy/WxOzhKgGXUxaMKMdRVbFFAe3qLvwV42kxtMpPf8zak8/17uCKM7J07Dnt4J/FvuUe6mTjoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715336371; c=relaxed/simple; bh=iv66zYRASTa0Ah6o0+ibjUz7elWc+AonBXrm+95kcbo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pvVTBq7Xkkmf6KK8wOP94vJYbKP1UbzI14/Ry86I8uoz3MzshYygTEz+WDnqLqLXYRdaUck1e1ejFTnT7GMP8BiXlKp70zRrknJVDnYLdO57kJFvjRKPr+kBIU+ruCbTLBWNo6xraXtPhf1hkaEszqYA7g4YxkHqW9YOtYJFYf8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715336369; 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: in-reply-to:in-reply-to:references:references; bh=CjWiDj41iEY2NT4fmqlNvyxtm0TSetBUxg7gUUs79ts=; b=cs6msNv8C+5ns/O36kPVpxRKJ8Jqw5ZlO4AxMeqze0NRRySjLWjOW8nqISo6YjDN9O2CSY 7Etzy1ABE8lBsvyhWFsEJQxnxvB1GSMCbRckU4d8KTE8hpQoqewzx4kOJEe8ZFqvOH/0nm /av0Mp/2yx+g+1xi2sEoKNuerZR8TzA= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-tweyaqOAPJSXY6QfNef9Hw-1; Fri, 10 May 2024 06:19:28 -0400 X-MC-Unique: tweyaqOAPJSXY6QfNef9Hw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41fda32e6c0so7062955e9.1 for ; Fri, 10 May 2024 03:19:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715336367; x=1715941167; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CjWiDj41iEY2NT4fmqlNvyxtm0TSetBUxg7gUUs79ts=; b=tXT9HvrDuXko71IW9/QxqHmUWJ21Q/85VrQCaS0BlnLwoKr0FoKaacLj+OPHdsOUoW rBkD4xGqNwK1L7QSm1zxurcgPzBC+BYBcIWqgGAQM1HQhj+FqRCKtbqRtXfqDHWsbNmx 6efSaLAe6IPAw8wrr8an2ac0oDaU/KuhRSh0PA1Jr6/K7Q8kggygo6iC95UbNNwHfmDH 5C/W0NcuKcRf64unrSyhrbCBGdRYuVfqvx6bhJwquPIqVVuBGbTZi4nSA55rw8cZQ8JW 3obRtdN0t36CMDvezZlXugMTZN+pFj1usmlEIIyZsKzWyE9FnUkIZnJiXXIzvvxYzrVr QrPw== X-Gm-Message-State: AOJu0YwxKFCn8bCTMu0T3Vn22JE+sdxxbyGQ9D/tk0DeDGiWJDbYj5FT 6+mcqJZIcUxon9ColsHO4iS1TUq/wU17rknO0wmbDxhcVIgJGo/cwIm2N6XTsAjFHlIUo3+DMEi qnBvIBh5gjiwsvmG8yJbjxDSPz1nISis79rPbiMRF02/3XcIDjybb+h8CwPc= X-Received: by 2002:a05:600c:3c8e:b0:41f:9edf:de50 with SMTP id 5b1f17b1804b1-41fbcea32ddmr46492495e9.15.1715336366923; Fri, 10 May 2024 03:19:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwE+QGzXQne1nbJRJVWpdXhx8XI0xSsjwM9gweDcxtjdv/g/kif67pPd2VAo0NtJ5pbCXk+g== X-Received: by 2002:a05:600c:3c8e:b0:41f:9edf:de50 with SMTP id 5b1f17b1804b1-41fbcea32ddmr46492205e9.15.1715336366291; Fri, 10 May 2024 03:19:26 -0700 (PDT) Received: from localhost ([31.111.84.240]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f88208815sm93203635e9.43.2024.05.10.03.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 03:19:26 -0700 (PDT) From: Andrew Burgess To: Bob Rossi , Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: Optionally print source code to gdb console window In-Reply-To: References: <87ikzpa7k6.fsf@tromey.com> <87y18lunti.fsf@tromey.com> <87a5l05mt3.fsf@tromey.com> Date: Fri, 10 May 2024 11:19:25 +0100 Message-ID: <875xvmrmtu.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,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: Bob Rossi writes: > On Wed, May 08, 2024 at 09:46:16AM -0600, Tom Tromey wrote: >> >>>>> "Bob" == Bob Rossi writes: >> >> >> Perhaps 'set source open' could be extended to have a new value. Or >> >> perhaps some other 'set source' sub-option could be made. I'm afraid >> >> that normally we bikeshed option names a bit. >> >> Bob> I think it's this behavior of gdb i want to suppress, >> Bob> https://sourceware.org/gdb/current/onlinedocs/gdb#Source >> Bob> "When your program stops, GDB spontaneously prints the line where it >> Bob> stopped" >> >> Bob> I'm looking for a way to control printing source lines when printing >> Bob> frame information? (I'm modifying do_print_frame_info) >> >> Bob> Something like 'set frame print_source off' might make sense to me. >> Bob> Just a thought. >> >> How about adding a new value to "set print frame-info"? >> Like "set print frame-info nothing"? > > I saw in the NEWS file, > show print frame-info > This controls what frame information is printed by the commands printing > a frame. This setting will e.g. influence the behaviour of 'backtrace', > 'frame', 'stepi'. The python frame filtering also respect this setting. > The 'backtrace' '-frame-info' option can override this global setting. > > So i tried out how frame-info impacts the bt command, > (gdb) set print frame-info short-location > (gdb) n > main (argc=1, argv=0x7fffffffe098) > (gdb) bt > #0 main (argc=1, argv=0x7fffffffe098) > (gdb) set print frame-info auto > (gdb) bt > #0 main (argc=1, argv=0x7fffffffe098) at test_main.cpp:47 > (gdb) > > The only request i've had, is not to print source lines automatically to > the console, because cgdb already displays them in a source view. > This is how cgdb worked with annotations, so people were familiar > with that behavior in cgdb, until i upgraded to mi. > > I don't think people want gdb's behavior changed under cgdb. > If they prefer special settings for 'print frame-info', they should > probably be allowed to keep them and not have cgdb hijack them. > > A new option, but separate from the existing frame-info command, as to > not impact other areas of gdb. > set print frame-info-source-line off > This is very similar to your approach, however, it lets the user choose > whatever they want with print frame-info, and then it lets cgdb "subtract" the > source-line printing from the console in only that case (and not bt case). Have you tried 'set suppress-cli-notifications on'? This: (a) Stops cli (even in new-ui) printing the location when inferior execution stops, and (b) Stops cli printing the context (stack frame) when the user changes the current stack frame (e.g. up, down, frame N, etc). Now (a) seems like exactly what you want. Not sure if (b) is what you want or not. I don't think you mentioned this, but if you have a GUI which is displaying the source location, you might also be displaying the stack, in which case you might want (b) too. Internally, 'set suppress-cli-notifications on' sets two separate flags, one each for (a) and (b), so you could potentially implement sub-commands of 'set suppress-cli-notifications' to control each component individually, if that is more helpful. Maybe I've not understood the problem requirements though, so feel free to ignore me if this isn't helpful :) Thanks, Andrew