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 9218A3858C20 for ; Fri, 29 Dec 2023 10:03:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9218A3858C20 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 9218A3858C20 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=1703844235; cv=none; b=wcZb4JhkFVZajnuTbs5sOAUh8ORr5t86+gL+OPjyq2FfkXy4+YPFua8Xh8zB2AQY20eVSpoPFe0TVH/KdmsFIbEXBrlacyrvrcdak14+m18ND42AtVzIRY28ONPgj6e66fPTdfDtSsKJUGsiaBpRDraK6+TSQagOqsFHJqYPEUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703844235; c=relaxed/simple; bh=/aOUCquS39ZnZjvjJB+ugJlGOQh0aG71qJMHQI5KQiY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=li+Cw0xUYP0SAnQgyML0gQdE6JE3LvfTnQEeUWN9iR7Q7mzBnz96jhoYkMfzeDh+th+pxlKnWAjFnUff+IHWg+9PuT5sVIJksdgnb5D8LAXPPqrzDgVazYOoxpV2QSAy4bk2WZkrtl6Kk1FApMQ2UtmTQm+uXAsqF5QpDgBkKak= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703844233; 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; bh=9/jpivx0ZtpZ1SRUuC/MTwqpftcAo6CP9f2OvBqacu0=; b=fVLR5a8lMtxXJ42lusPm4a3ebX3vOqRzSQdAX/V98iFzP4wl9YIxET4OFiwn3pobofN4N8 CEbfoK7xqcqy/DrZh7xyMwd5Qe4i6ErvwzvMulSIifF595BCkRvS+9T3BRCxVqcR69bUmi asF8nu+XX0e7DnN3ddBDGGzgV0BGKKY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-Xqkyo3H4OzyIUsnu9K4j6A-1; Fri, 29 Dec 2023 05:03:51 -0500 X-MC-Unique: Xqkyo3H4OzyIUsnu9K4j6A-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3368250f2a3so4867304f8f.3 for ; Fri, 29 Dec 2023 02:03:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703844229; x=1704449029; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3yJ3Kw7J0yHqUusIccJ9tmtE6Hi0l4WoyJ+KbTNLLKI=; b=f3fveXGN+TVQw3GmYJ9STiTOuNVXPRRimFTD+qWrMzd8OTD7+vzfVLnY16dXpwL5Wl SmrWzRu9kdx3zJ8pIs9tHlpzJ8w1xL996hOAVOMr0Y2ph2wM1EPOC3oTIpXEh0fOp/u+ SMwkuGkTswiKBt9WucoXg/IUlQjPe5Tow3IxiBjuq7NET2CrEUQ+K+uP7liUtohcIUU2 zf7h3UAR07M267AvmDvZQAanX8T6JxqooBkYGt5jjb+EpVsHAyDhNCenXoPikBePRaTG nNt3Mi1M3T/oVbUWkapAmG6DirQJC6TOGTU286d/owmZN/qa1yBEiOpllkBCfMuwMse5 5yww== X-Gm-Message-State: AOJu0YzMnx8pN+oSNahIQWty3sIeFnvgAxJkK2s1QY/ame6wNVSwXN6h bQJReObv+zhHi3DxRTatWXSkVRFHPTiUX12lh4nVpw29Pg0bIGxBqsSOi8MiCU6L+zPWWpumPDs 3a1SzvPK2HzThRXqHmXz3rSXOZmBczleiLJ55MwWMqm2TNW0+VMrllFHsOtCV4tSrDuKlmd5Gay 6PVPZZVJ26rteUnA== X-Received: by 2002:adf:e706:0:b0:336:75ae:4353 with SMTP id c6-20020adfe706000000b0033675ae4353mr2897625wrm.185.1703844229383; Fri, 29 Dec 2023 02:03:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IETLVlmxrtJF44xsPbGF8Ht9dKRzI80chE+HYZl0p4nzqxpJzPNsy0boigO3p9ThkbpR50uQA== X-Received: by 2002:adf:e706:0:b0:336:75ae:4353 with SMTP id c6-20020adfe706000000b0033675ae4353mr2897621wrm.185.1703844228956; Fri, 29 Dec 2023 02:03:48 -0800 (PST) Received: from localhost ([2a00:23c7:c696:e701:85a5:8a0c:1403:2dc]) by smtp.gmail.com with ESMTPSA id a8-20020a5d53c8000000b00336905ad6d4sm16474777wrw.86.2023.12.29.02.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 02:03:48 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: remove deprecated_exec_file_display_hook and associated code Date: Fri, 29 Dec 2023 10:03:44 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 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_H3,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: 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 hasn't been merged yet, but can be found here: https://inbox.sourceware.org/insight/6abeb45e97d9004ec331e94cf2089af00553de76.1702379379.git.aburgess@redhat.com/T/#u Assuming that the proposed insight patch is merged then we should be free to cleanup the GDB side of things, which this patch does. I'm posting this before the insight patch is merged just in case there's any feedback, but I'll hold off merging this until the insight patch lands. For a pure GDB build (no insight) there should be no user visible changes after this commit as this is all dead code. For an insight build with the above patch applied, there should also be no user visible changes. --- gdb/corefile.c | 67 -------------------------------------------------- gdb/exec.c | 4 --- gdb/gdbcore.h | 3 --- 3 files changed, 74 deletions(-) diff --git a/gdb/corefile.c b/gdb/corefile.c index b9c204d18dc..6299f9140e9 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 59965b84d55..3e3e165dad4 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 56ddea65334..5cecb15c47a 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -114,9 +114,6 @@ 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). */ base-commit: 90827b4eefb06f6e0ab6cbac9eb94922e2cc8aee -- 2.25.4