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.129.124]) by sourceware.org (Postfix) with ESMTPS id 969BF3858C56 for ; Fri, 19 Jan 2024 22:24:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 969BF3858C56 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 969BF3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705703047; cv=none; b=sLlsY92INaSoYODp1iea5hrMwjxoD2g/R0uhkBZ1738ApOsZxeGhUGQkWc8P3Dps8s5h4fYOcpI//sdK4m30jBI01VTsbyV9G3msV73voTpcW4VBuq0lJnPvN6dvLmfMGc4cdNnthOQgVebk3GGZArFejAmZiMBlnlzW7r8+Nlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705703047; c=relaxed/simple; bh=Axjg5BhKzIS0EAIoslFM2dq1oeQttpUu5/RxVZ/S44k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DTzjPs4HMUmowJEKGIYy2P7oUu6bgZUes8jNZY2UMaLh18ntXYl/Nlaw51xkJqaNNxB31NiQjkDd90k/PF7Mm+3gHBN/EneKFfNNDFGs/klTs1Gj5EWhcDvKDbX/em9OBqvgIKCrF9R2dOhuuey7PkSE+d26gLutujQRNg8cXtc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705703043; 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=X+eqvpLEADefi1J1FXgf/Xr+Js0ZaH3coVpWdKd0l6o=; b=Of8WAD7EfVSh2z2zTUCJ0gA8dinu8+Zdvihqp2LYprPBUc2ZOldZTafT/HYdKS636ifZCj cTuPnq+nsOgIIIZNeaTL1f4M5vn85yLpu/NSMwnaLRfInZHWLYKhu8RmJ2Qj3lpbUm38NG rK9AnueuJbVuvnb94efVRYxsT1ow1rk= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-n5Y-mECxOjWAeRvMkhB9Ig-1; Fri, 19 Jan 2024 17:24:01 -0500 X-MC-Unique: n5Y-mECxOjWAeRvMkhB9Ig-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-42996d4e949so12767501cf.1 for ; Fri, 19 Jan 2024 14:24:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705703040; x=1706307840; 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=VaWwSMEDKczEPnh9ov/G8j9GG4uO5gJtW4AQIO50BTE=; b=rZPyUyqsp7cdBDNUsmGVh2Po8urFVvczvNTdvD99tKPaeRR9fPVz1h0ulAzVK8Hd6f zoyoNPo2MzaYpxJGOqkns6hWHk16aL6MsU9jojyFp5aBdSQXd6ANHTt+BbM4nEtG4q1k Dhp3GttIzCJvIKul8+cJSxWAw8F733+cje+BVHLQ7hCT1nkoCM54WeotnAB3ohoOxlVb QbcJ0sei4uRDFwlkG9tjwrtzdtsvnzs298GAXaFM/oWi0UracvTp1RkhU57gdYSQxcZ8 R2SY/Xy1WdJYD/DE3zeRgqX0gfTIH62RFplP4Oianp88+x1YF6s3bLo96LbugNXxZ4Bu TMBQ== X-Gm-Message-State: AOJu0YySfzcue1PhBCprzF2fbRlO7Mbf8J0pue8Xg+RCJKQOYmu1pvxB 250i0+L1TXgi0/xMKSPXFb5kcy5Nb5XKEaV8XOmh7mMpKmpk5ffsVCLRaf478ythM0GNaPtU3W2 zd2Iz99cE932/0ogeGX+2Y/+9yIksiFLG/j0FtmP8qwn55pnv627QEBP48r+lqICSOaI= X-Received: by 2002:a05:622a:508:b0:429:c595:4a33 with SMTP id l8-20020a05622a050800b00429c5954a33mr559110qtx.119.1705703040451; Fri, 19 Jan 2024 14:24:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqwibnRFhH7FCXdtMG7tknJ4lrJXcRGin8k2M2MVrW1rOJH3g3UJ+16ZW07xNxMqgQ3fY52A== X-Received: by 2002:a05:622a:508:b0:429:c595:4a33 with SMTP id l8-20020a05622a050800b00429c5954a33mr559102qtx.119.1705703040101; Fri, 19 Jan 2024 14:24:00 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id kg2-20020a05622a760200b0042a109265d5sm81843qtb.20.2024.01.19.14.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 14:23:59 -0800 (PST) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: remove deprecated_exec_file_display_hook and associated code In-Reply-To: <87r0iqv9wb.fsf@tromey.com> References: <87r0iqv9wb.fsf@tromey.com> Date: Fri, 19 Jan 2024 22:23:57 +0000 Message-ID: <87eded55du.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=-11.8 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> This commit removes deprecated_exec_file_display_hook and the > Andrew> associated specify_exec_file_hook. > > Thank you for doing this. > > Approved-By: Tom Tromey Pushed. I updated the commit message to reflect that the insight patch has now been merged. Final version is below. Thanks, Andrew --- commit 81b6f191f71fe0af5dd7b1c7c5b7737c3d249a66 Author: Andrew Burgess Date: Fri Dec 29 09:50:10 2023 +0000 gdb: remove deprecated_exec_file_display_hook and associated code This commit removes deprecated_exec_file_display_hook and the associated specify_exec_file_hook. The specify_exec_file_hook is used to add a new hook function to deprecated_exec_file_display_hook, but is only used from the insight debugger. I posted a patch to remove the use of specify_exec_file_hook from insight, and instead use gdb::observers::executable_changed, this patch can be found here (it has now been merged): https://inbox.sourceware.org/insight/6abeb45e97d9004ec331e94cf2089af00553de76.1702379379.git.aburgess@redhat.com/T/#u With this merged we can now cleanup the GDB side as this code is now unused. There should be no user visible changes after this commit. Approved-By: Tom Tromey diff --git a/gdb/corefile.c b/gdb/corefile.c index d033a82e427..bb07ef992a9 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -35,73 +35,6 @@ #include "gdbarch.h" #include "interps.h" -/* You can have any number of hooks for `exec_file_command' command to - call. If there's only one hook, it is set in exec_file_display - hook. If there are two or more hooks, they are set in - exec_file_extra_hooks[], and deprecated_exec_file_display_hook is - set to a function that calls all of them. This extra complexity is - needed to preserve compatibility with old code that assumed that - only one hook could be set, and which called - deprecated_exec_file_display_hook directly. */ - -typedef void (*hook_type) (const char *); - -hook_type deprecated_exec_file_display_hook; /* The original hook. */ -static hook_type *exec_file_extra_hooks; /* Array of additional - hooks. */ -static int exec_file_hook_count = 0; /* Size of array. */ - - - -/* If there are two or more functions that wish to hook into - exec_file_command, this function will call all of the hook - functions. */ - -static void -call_extra_exec_file_hooks (const char *filename) -{ - int i; - - for (i = 0; i < exec_file_hook_count; i++) - (*exec_file_extra_hooks[i]) (filename); -} - -/* Call this to specify the hook for exec_file_command to call back. - This is called from the x-window display code. */ - -void -specify_exec_file_hook (void (*hook) (const char *)) -{ - hook_type *new_array; - - if (deprecated_exec_file_display_hook != NULL) - { - /* There's already a hook installed. Arrange to have both it - and the subsequent hooks called. */ - if (exec_file_hook_count == 0) - { - /* If this is the first extra hook, initialize the hook - array. */ - exec_file_extra_hooks = XNEW (hook_type); - exec_file_extra_hooks[0] = deprecated_exec_file_display_hook; - deprecated_exec_file_display_hook = call_extra_exec_file_hooks; - exec_file_hook_count = 1; - } - - /* Grow the hook array by one and add the new hook to the end. - Yes, it's inefficient to grow it by one each time but since - this is hardly ever called it's not a big deal. */ - exec_file_hook_count++; - new_array = (hook_type *) - xrealloc (exec_file_extra_hooks, - exec_file_hook_count * sizeof (hook_type)); - exec_file_extra_hooks = new_array; - exec_file_extra_hooks[exec_file_hook_count - 1] = hook; - } - else - deprecated_exec_file_display_hook = hook; -} - void reopen_exec_file (void) { diff --git a/gdb/exec.c b/gdb/exec.c index f72f2eba38a..f17040a7a1b 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -494,10 +494,6 @@ exec_file_attach (const char *filename, int from_tty) target. */ current_program_space->add_target_sections (current_program_space->ebfd.get (), sections); - - /* Tell display code (if any) about the changed file name. */ - if (deprecated_exec_file_display_hook) - (*deprecated_exec_file_display_hook) (filename); } /* Are are loading the same executable? */ diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index a88ae65e786..3b7eeba63aa 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -114,17 +114,12 @@ extern void write_memory_signed_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order, LONGEST value); -/* Hook for `exec_file_command' command to call. */ - -extern void (*deprecated_exec_file_display_hook) (const char *filename); /* Hook for "file_command", which is more useful than above (because it is invoked AFTER symbols are read, not before). */ extern void (*deprecated_file_changed_hook) (const char *filename); -extern void specify_exec_file_hook (void (*hook) (const char *filename)); - /* Binary File Diddler for the core file. */ #define core_bfd (current_program_space->cbfd.get ())