From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id B7CA13858D28 for ; Sat, 4 Mar 2023 17:31:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7CA13858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x530.google.com with SMTP id g3so22529364eda.1 for ; Sat, 04 Mar 2023 09:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677951096; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/m2tSi2Ev/By3X6+IrfMfYq0V6Mnpgm1hmv/JMJTUhI=; b=WYQ4V5UXCuuHAe4/FGtO/pmPStPBpjOhs5+izadrDSbA26qilfmrhXN8ulCTFJ6OST kRTeRTmmUNZSOvGqBJcy/WtFq/Izf8VS4E8KelC6iy+yRUQvifWhn75Wd6Fb34kAM37f 2PVYY/G3fjeXbsHNb20ba5Jln4G7pCRh9fZ0ukeiuqdCUdanAcgKj1amq/SGuErUa+Py NX4R4heHr1+x+FC7fVGHRsTwlHfHHxN/y+9BDggr1zVr2Yp4LKMCDkGg/EkcJK1dIR9O tH750qnL1EWhSVIp9hw62xJ5UZNfKyZXctQ5DbyI2N6JbQJnMp2DsB1ElDc+LLmgNN92 CgQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677951096; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/m2tSi2Ev/By3X6+IrfMfYq0V6Mnpgm1hmv/JMJTUhI=; b=e5kazUxOM+0O0lQh5UpJ/KSgsNVMfUZasjv8hB+08gCS7/A3lIt3XoAxmKD2sKIItQ dstdFnDKthsnUZdxulqcyhjJGJxkOcV54G7d2d0pYuZzgmiZnH5qw0XQShz9ZWo5YvkO f3SaxhPKdoIdJQQU69ysKTtJf7T4YN2/hIVXPu9OMOWa7a7LwuMG3ne092Tx7FVplERY gOnE2cLtIe8EYK+hS59b8KrST8DEbtWi0szNKoJLicis1yEhhK//3B6QNWABWgIfap9I ckXNrvrZc83QB5320/5QFRzqW6gYio9AegcgMnP1e8RUpD/DVwyoy8C9pAFDwOz3w3/1 I16Q== X-Gm-Message-State: AO0yUKWxiUNrK9qZYO+1brjk2Ys6Y2DIrRKeonuWJGKCq4rYLo9KuTVr cR9cJY5fcT//yd511PYPgAF5FKI4Qw8h0/CqGqdp9q4bbqztDQ== X-Google-Smtp-Source: AK7set+gbApcv/diGYzYNLTNWlq88+0wmj84iDwZjh5tH0ea6GzSL/JoT+N/q/jh/mS100Hf18DaqaDSs9AOhm9fxHc= X-Received: by 2002:a50:c345:0:b0:4be:f5a0:a806 with SMTP id q5-20020a50c345000000b004bef5a0a806mr3192668edb.0.1677951096027; Sat, 04 Mar 2023 09:31:36 -0800 (PST) MIME-Version: 1.0 From: Dominik Czarnota Date: Sat, 4 Mar 2023 13:30:59 -0400 Message-ID: Subject: Python API equivalent of 'info sharedlibrary' To: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, Is there any Python API equivalent of getting information about shared libraries through the `info sharedlibrary` command? If not, is there any chance that this gets added? I know there is `gdb.objfiles()` but it seems it goes over all object files [0] and does not really provide as much information as the `info sharedlibrary` command [1]. In our plugin we try to figure out the exact path of the glibc library and we want to support all possible use cases (gdb, gdbserver, LD_PRELOAD, gdbstub from QEMU-user etc.). Of course this will always be a heuristic since we can never know if a libc.so is actually a libc and so on. We are currently parsing the output of the `info sharedlibrary` command but this gets more and more complicated which is not great... [2]. [0] https://github.com/bminor/binutils-gdb/blob/d1702fea87aa62dff7de465464097dba63cc8c0f/gdb/python/py-progspace.c#L343-L369 [1] https://github.com/bminor/binutils-gdb/blob/d1702fea87aa62dff7de465464097dba63cc8c0f/gdb/solib.c#L1062-L1163 [2] https://github.com/pwndbg/pwndbg/pull/1602/files Best regards Dominik 'Disconnect3d' Czarnota