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 DF0493858D28 for ; Fri, 8 Apr 2022 13:44:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF0493858D28 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-370-7gvzrhXiOlGOJI-vRgJKhQ-1; Fri, 08 Apr 2022 09:44:34 -0400 X-MC-Unique: 7gvzrhXiOlGOJI-vRgJKhQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2BDD18038E3; Fri, 8 Apr 2022 13:44:34 +0000 (UTC) Received: from redhat.com (unknown [10.2.16.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BC822166B1F; Fri, 8 Apr 2022 13:44:33 +0000 (UTC) Received: from fche by redhat.com with local (Exim 4.94.2) (envelope-from ) id 1ncoue-0000eL-RW; Fri, 08 Apr 2022 09:44:33 -0400 Date: Fri, 8 Apr 2022 09:44:32 -0400 From: "Frank Ch. Eigler" To: Milian Wolff Cc: elfutils-devel@sourceware.org Subject: Re: Questions regarding debuginfod.h API Message-ID: <20220408134432.GA23295@redhat.com> References: <5817622.lOV4Wx5bFT@agathemoarbauer> MIME-Version: 1.0 In-Reply-To: <5817622.lOV4Wx5bFT@agathemoarbauer> User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-List-Received-Date: Fri, 08 Apr 2022 13:44:37 -0000 Hi - > now that archlinux is supporting debuginfod, I have finally tried it > out. It's such a game changer, many thanks for everyone involved in > working on this! Our pleasure! > Now to my question: In applications using elfutils, we will now > automatically download debug information when DEBUGINFOD_URLS is > defined. But doing that can take a very long time. (See also the DEBUGINFOD_MAXTIME and DEBUGINFOD_MAXSIZE env vars that can limit this.) > I would like to give the user feedback about this situation and > ideally provide a means to cancel the download. OK. > Looking at `debuginfod.h` I `debuginfod_set_progressfn` which looks > ideal. But how do I access the default `debuginfod_client *` which > seems to exist without me ever calling `debuginfod_begin` anywhere? > Or do I need to create a new client here via `debuginfod_begin`? You do need to create a new client object. You can reuse it. > Then, how would I cancel an ongoing download job? GDB seems to do > that when I press `CTRL+C`, but I do not see any API I could use for > that purpose? See [man debuginfod_set_progressfn]. The return code from that progressfn callback is the ticket. > Finally, what is the recommended way to check whether debuginfod is > available? Should one rely on the build system to discover the > `debuginfod.h` header file, or is some other compile time check > suggested to detect it? [...] To decide whether or not to compile in support, you'd need a compile-time check such as for the debuginfod.h header. (Alternately, you could opt not to compile in support at all, and instead call out to the debuginfod-find(1) program.) To decide at run time whether or not to use it, you could just use the *_find APIs and get back an error code if things are not set up. Or you can check the DEBUGINFOD_URLS for being set/unset before you call in. - FChE