From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oJqkBwYli2E8aAAAWB0awg (envelope-from ) for ; Tue, 09 Nov 2021 20:48:54 -0500 Received: by simark.ca (Postfix, from userid 112) id 1CB591F0C1; Tue, 9 Nov 2021 20:48:54 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 7AD921EE14 for ; Tue, 9 Nov 2021 20:48:53 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E05313857C4E for ; Wed, 10 Nov 2021 01:48:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E05313857C4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1636508932; bh=GjTTefY4hq8GOKxExa6CtViU6BGsW/Ax0fJ0Ys90mSw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DqiPX156y3dVbSjH166DCdUU2PmtGZkPws+PmjtPB+wolXvyKSRuNpjUdQUOEQG+I YIDBR8T5Tj0AQUgX8vQwaXM5nYuWZNLAWCKzivpsH8ErmUHXcYoUY7iBPOkwQyTQTH yVQRKGwQrMABSHS7HtLrWinZtoFt9Oj1akvgzpoQ= 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 6809F385842B for ; Wed, 10 Nov 2021 01:48:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6809F385842B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-iSQmrX82ML-v283qOpEFXg-1; Tue, 09 Nov 2021 20:48:03 -0500 X-MC-Unique: iSQmrX82ML-v283qOpEFXg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD4CE8799ED; Wed, 10 Nov 2021 01:48:02 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.22.8.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 099EF5C1C5; Wed, 10 Nov 2021 01:48:01 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 1/3] gdb: Add aliases for read_core_file_mappings callbacks Date: Tue, 9 Nov 2021 20:47:53 -0500 Message-Id: <20211110014755.532490-2-amerey@redhat.com> In-Reply-To: <20211110014755.532490-1-amerey@redhat.com> References: <20211110014755.532490-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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: , From: Aaron Merey via Gdb-patches Reply-To: Aaron Merey Cc: tom@tromey.com, lsix@lancelotsix.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Add aliases read_core_file_mappings_loop_ftype and read_core_file_mappings_pre_loop_ftype. Intended for use with read_core_file_mappings. Also add build_id parameter to read_core_file_mappings_loop_ftype. --- gdb/arch-utils.c | 15 +++++---------- gdb/arch-utils.h | 15 +++++---------- gdb/corelow.c | 2 +- gdb/gdbarch.c | 2 +- gdb/gdbarch.h | 16 ++++++++++++++-- gdb/gdbarch.sh | 14 +++++++++++++- gdb/linux-tdep.c | 19 +++++++------------ 7 files changed, 46 insertions(+), 37 deletions(-) diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 862f26b6cf7..6c6dca22d63 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1075,16 +1075,11 @@ default_get_pc_address_flags (frame_info *frame, CORE_ADDR pc) /* See arch-utils.h. */ void -default_read_core_file_mappings (struct gdbarch *gdbarch, - struct bfd *cbfd, - gdb::function_view - pre_loop_cb, - gdb::function_view - loop_cb) +default_read_core_file_mappings + (struct gdbarch *gdbarch, + struct bfd *cbfd, + read_core_file_mappings_pre_loop_ftype pre_loop_cb, + read_core_file_mappings_loop_ftype loop_cb) { } diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 03e9082f6d7..07cc496a02a 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -295,14 +295,9 @@ extern std::string default_get_pc_address_flags (frame_info *frame, CORE_ADDR pc); /* Default implementation of gdbarch read_core_file_mappings method. */ -extern void default_read_core_file_mappings (struct gdbarch *gdbarch, - struct bfd *cbfd, - gdb::function_view - pre_loop_cb, - gdb::function_view - loop_cb); +extern void default_read_core_file_mappings + (struct gdbarch *gdbarch, + struct bfd *cbfd, + read_core_file_mappings_pre_loop_ftype pre_loop_cb, + read_core_file_mappings_loop_ftype loop_cb); #endif /* ARCH_UTILS_H */ diff --git a/gdb/corelow.c b/gdb/corelow.c index 5f48d96aa12..10942e6af01 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -214,7 +214,7 @@ core_target::build_file_mappings () /* read_core_file_mappings will invoke this lambda for each mapping that it finds. */ [&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, - const char *filename) + const char *filename, const bfd_build_id *build_id) { /* Architecture-specific read_core_mapping methods are expected to weed out non-file-backed mappings. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f89dcc57754..689187f8b1e 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -5411,7 +5411,7 @@ set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, } void -gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, gdb::function_view pre_loop_cb, gdb::function_view loop_cb) +gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->read_core_file_mappings != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 979159ba2f5..f7d624fcfdc 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -129,6 +129,18 @@ enum class memtag_type allocation, }; +/* Callback types for 'read_core_file_mappings' gdbarch method. */ + +using read_core_file_mappings_pre_loop_ftype = + gdb::function_view; + +using read_core_file_mappings_loop_ftype = + gdb::function_view; /* The following are pre-initialized by GDBARCH. */ @@ -1710,8 +1722,8 @@ extern void set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, gdbarch_g /* Read core file mappings */ -typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, gdb::function_view pre_loop_cb, gdb::function_view loop_cb); -extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, gdb::function_view pre_loop_cb, gdb::function_view loop_cb); +typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb); +extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb); extern void set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, gdbarch_read_core_file_mappings_ftype *read_core_file_mappings); extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 39a99d0d5f3..06fd71304ea 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1210,7 +1210,7 @@ m;ULONGEST;type_align;struct type *type;type;;default_type_align;;0 f;std::string;get_pc_address_flags;frame_info *frame, CORE_ADDR pc;frame, pc;;default_get_pc_address_flags;;0 # Read core file mappings -m;void;read_core_file_mappings;struct bfd *cbfd, gdb::function_view pre_loop_cb, gdb::function_view loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0 +m;void;read_core_file_mappings;struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0 EOF } @@ -1400,6 +1400,18 @@ enum class memtag_type allocation, }; +/* Callback types for 'read_core_file_mappings' gdbarch method. */ + +using read_core_file_mappings_pre_loop_ftype = + gdb::function_view; + +using read_core_file_mappings_loop_ftype = + gdb::function_view; EOF # function typedef's diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index ae2f7c14f6d..e2cff83086a 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1097,16 +1097,11 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, for each mapping. */ static void -linux_read_core_file_mappings (struct gdbarch *gdbarch, - struct bfd *cbfd, - gdb::function_view - pre_loop_cb, - gdb::function_view - loop_cb) +linux_read_core_file_mappings + (struct gdbarch *gdbarch, + struct bfd *cbfd, + read_core_file_mappings_pre_loop_ftype pre_loop_cb, + read_core_file_mappings_loop_ftype loop_cb) { /* Ensure that ULONGEST is big enough for reading 64-bit core files. */ gdb_static_assert (sizeof (ULONGEST) >= 8); @@ -1189,7 +1184,7 @@ linux_read_core_file_mappings (struct gdbarch *gdbarch, char * filename = filenames; filenames += strlen ((char *) filenames) + 1; - loop_cb (i, start, end, file_ofs, filename); + loop_cb (i, start, end, file_ofs, filename, nullptr); } } @@ -1218,7 +1213,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args) } }, [=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, - const char *filename) + const char *filename, const bfd_build_id *build_id) { if (gdbarch_addr_bit (gdbarch) == 32) printf_filtered ("\t%10s %10s %10s %10s %s\n", -- 2.31.1