From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D2361385C407 for ; Thu, 29 Sep 2022 20:44:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D2361385C407 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 28TKhub7009556 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Sep 2022 16:44:00 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 28TKhub7009556 Received: from simark.localdomain (unknown [217.28.27.60]) (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 ESMTPSA id 32F321E11A; Thu, 29 Sep 2022 16:43:56 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Subject: [PATCH 3/3] gdb: make target_auxv_parse static and rename Date: Thu, 29 Sep 2022 16:43:54 -0400 Message-Id: <20220929204354.751741-4-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220929204354.751741-1-simon.marchi@polymtl.ca> References: <20220929204354.751741-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 29 Sep 2022 20:43:56 +0000 X-Spam-Status: No, score=-3189.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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 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: , X-List-Received-Date: Thu, 29 Sep 2022 20:44:05 -0000 It is only used in auxv.c. Also, given it is not strictly a wrapper around target_ops::auxv (since 27a48a9223d0 "Add auxv parsing to the architecture vector."), I think that the name prefixed with target is a bit misleading. Rename to just parse_auxv. Change-Id: I41cca055b92c8ede37c258ba6583746a07d8f77e --- gdb/auxv.c | 14 +++++++++----- gdb/auxv.h | 7 ------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/gdb/auxv.c b/gdb/auxv.c index a9337d9f7ff4..76fc821c07c3 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -306,12 +306,16 @@ svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, } /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. + + Use the auxv_parse method from the current inferior's gdbarch, if defined, + else use the current inferior's target stack's auxv_parse. + Return 0 if *READPTR is already at the end of the buffer. Return -1 if there is insufficient buffer for a whole entry. Return 1 if an entry was read into *TYPEP and *VALP. */ -int -target_auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr, - CORE_ADDR *typep, CORE_ADDR *valp) +static int +parse_auxv (const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, + CORE_ADDR *valp) { struct gdbarch *gdbarch = target_gdbarch(); @@ -388,7 +392,7 @@ target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp) size_t len = info->data->size (); while (1) - switch (target_auxv_parse (&ptr, data + len, &type, &val)) + switch (parse_auxv (&ptr, data + len, &type, &val)) { case 1: /* Here's an entry, check it. */ if (type == match) @@ -561,7 +565,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops) const gdb_byte *ptr = data; size_t len = info->data->size (); - while (target_auxv_parse (&ptr, data + len, &type, &val) > 0) + while (parse_auxv (&ptr, data + len, &type, &val) > 0) { gdbarch_print_auxv_entry (gdbarch, file, type, val); ++ents; diff --git a/gdb/auxv.h b/gdb/auxv.h index 2e8b2ab33fc6..ab2a5dee5f74 100644 --- a/gdb/auxv.h +++ b/gdb/auxv.h @@ -46,13 +46,6 @@ extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp); -/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. - Return 0 if *READPTR is already at the end of the buffer. - Return -1 if there is insufficient buffer for a whole entry. - Return 1 if an entry was read into *TYPEP and *VALP. */ -extern int target_auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr, - CORE_ADDR *typep, CORE_ADDR *valp); - /* Extract the auxiliary vector entry with a_type matching MATCH. Return zero if no such entry was found, or -1 if there was an error getting the information. On success, return 1 after -- 2.37.3