From patchwork Sun May 15 20:00:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 53994 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8F1B3857430 for ; Sun, 15 May 2022 20:01:06 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 8FF783858D32 for ; Sun, 15 May 2022 20:00:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8FF783858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x07.wildebeest.org [172.31.17.137]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 47640302BBEC; Sun, 15 May 2022 22:00:58 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 9C0C12E831BB; Sun, 15 May 2022 22:00:41 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: [PATCH] libdwfl: Update docs and nonnull attributes for dwfl_module_addrinfo Date: Sun, 15 May 2022 22:00:30 +0200 Message-Id: <20220515200030.343101-1-mark@klomp.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Cc: William Cohen , Mark Wielaard Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Make clear that both the offset and sym arguments cannot be NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1986555 Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 +++++ libdwfl/libdwfl.h | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 76053039..b3ca56cb 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2022-05-15 Mark Wielaard + + * libdwfl.h (dwfl_module_addrinfo): Update docs and nonnull + attribute to make clear offset and sym cannot be NULL. + 2022-04-22 Mark Wielaard * debuginfod-client.c (init_control): New static pthread_once_t. diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h index f98f1d52..c55a8eaa 100644 --- a/libdwfl/libdwfl.h +++ b/libdwfl/libdwfl.h @@ -473,26 +473,26 @@ extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address); when nothing was found. If the architecture uses function descriptors, and symbol st_value points to one, ADDRESS will be matched against either the adjusted st_value or the associated - function entry value as described in dwfl_module_getsym_info. If - OFFSET is not NULL it will be filled in with the difference from - the start of the symbol (or function entry). If SYM is not NULL it - is filled in with the symbol associated with the matched ADDRESS. - The SYM->ST_VALUE itself isn't adjusted in any way. Fills in ELFP, - if not NULL, with the ELF file the symbol originally came from. - Note that symbols can come from either the main, debug or auxiliary - ELF symbol file (either dynsym or symtab). If SHNDXP is non-null, - it's set with the section index (whether from st_shndx or extended - index table). Fills in BIAS, if not NULL, with the difference - between addresses within the loaded module and those in symbol - table of the ELF file. Note that the address matched against the - symbol might be in a different section than the returned symbol. - The section in the main elf file in ADDRESS falls can be found with - dwfl_module_address_section. */ + function entry value as described in dwfl_module_getsym_info. + OFFSET will be filled in with the difference from the start of the + symbol (or function entry), OFFSET cannot be NULL. SYM is filled + in with the symbol associated with the matched ADDRESS, SYM cannot + be NULL. The SYM->ST_VALUE itself isn't adjusted in any way. + Fills in ELFP, if not NULL, with the ELF file the symbol originally + came from. Note that symbols can come from either the main, debug + or auxiliary ELF symbol file (either dynsym or symtab). If SHNDXP + is non-null, it's set with the section index (whether from st_shndx + or extended index table). Fills in BIAS, if not NULL, with the + difference between addresses within the loaded module and those in + symbol table of the ELF file. Note that the address matched + against the symbol might be in a different section than the + returned symbol. The section in the main elf file in ADDRESS falls + can be found with dwfl_module_address_section. */ extern const char *dwfl_module_addrinfo (Dwfl_Module *mod, GElf_Addr address, GElf_Off *offset, GElf_Sym *sym, GElf_Word *shndxp, Elf **elfp, Dwarf_Addr *bias) - __nonnull_attribute__ (3); + __nonnull_attribute__ (3, 4); /* Find the symbol that ADDRESS lies inside, and return detailed information as for dwfl_module_getsym (above). Note that like