From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0UvnJDdW2moSWgwAWB0awg (envelope-from ) for ; Thu, 22 Oct 2026 14:30:15 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fYohE6i6; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8A10F378002; Thu, 22 Oct 2026 14:30:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9E2411E007 for ; Thu, 22 Oct 2026 14:30:13 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C6DAF4BA2E30 for ; Thu, 22 Oct 2026 18:30:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6DAF4BA2E30 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fYohE6i6 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 54A9C4BA2E0B for ; Thu, 22 Oct 2026 18:28:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54A9C4BA2E0B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 54A9C4BA2E0B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792693714; cv=none; b=h/DR70RD1kjit6bnRV6WUZcrNvzMRrjuc9dbrIR9p/JSF5VAI2F5GWnQ93ofwB5la41jqXq4fl4gL45jDmKzqbEsS0dts9F4V+/EUIXwasZXL4Cjvvp4ZFwS8ZYjPMk1ZawprYcpHwQUhKRy+fS265KII9HuSBmq/6dqmTVKQ6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792693714; c=relaxed/simple; bh=g+KVVTm89PMVcruyQORMXQPGI8+FMhNqLZ4SvJKlVdk=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=b9mEaMGNw/lvy8TeVotvq5fr+XE5kcdyORb6G1EPh5GWmdXjeVHgwJtTOGAk0omgREq/8kQ0fH7qk4usdb5LD7T8Qj3smnP1iX9jyT5SKAXZ1pkwsGAhIEmZkymhZCokFJxJ+VzUUehND4P9xuq4+skigzfeKu6etLvImGP0+EA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fYohE6i6 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54A9C4BA2E0B Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-8470d7d430fso17010a34.3 for ; Thu, 22 Oct 2026 11:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1792693699; x=1793298499; darn=sourceware.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Weg+tKiEI3BBbVC6HjnHtlU4PfKGhgl5MjwKX3wS780=; b=fYohE6i6TIovhql+nyvxnE67C7l7THMXDGsruUgooGIg95VpeT/p8J6Kn9/k+Y1spf kq4sm2X7LttsPQ1/Vc+oPRq3jI/ZSaCzdZtEIKBK/+wwd6m5XVzD3sdDDLZ80ut+oKoo d2wWXQzRbzmTSD6EbOfWY57okuVo1FlmdTEQYoe8tMRyT1CMmrqpk+FsJvb2tZ5I5D3X /u1dK+LkD3RIO7sR1/BPECJE2AT1H7nq/OHfnet3d6wN8n+YiMtmVATj4gnBcKZNe7Z3 NUdf3SIlBLY6xrPVNa2p//aJKEJoGwAGQZJ1CQ/YrG7CNrFdGWJdLABsJ/pDzhP99lH/ Pwhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792693699; x=1793298499; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Weg+tKiEI3BBbVC6HjnHtlU4PfKGhgl5MjwKX3wS780=; b=BoR3L87xHvhm8ZXEm9VP4M1UQeAaz4yMTTidGSMLSPUtgR1Ix/PHeDLXGmsG79ClX4 +7hvO2VeexiDK4D7rO7joI8qNP9UsbeYgD1/du0Py387/SFPvz+2psW3gpH1vX9o4utA /7Kk++vRJ6OjMBPTCdzY17D+qJ90tOPNwQgmsVOtxSWsucdf+GEy3sVbGH/Su0c6DpOV indU+8rBy5hey12NZWq9Dxu7QjVxlSgp8HLVbvhrxFh3HM1+dODt7qVVcXp4sueMNHYj BID5gdUQgPacWfSi07U/KGjAMQxXffxzBCEs0JEVwH2nrVZ2PQhySk8vNAYTcuZ2cuHe /HCQ== X-Gm-Message-State: AFq9FYL5ZPci0L7sSd9BefshwUDawN0FtzYn75kHZFqoSS9QC7m+Zxxd 4fARaRq15sHHH8Abn1FXjivph8Q9kSO2nQ2US+2rlE7/FJdfaPmyC9SwLRg8MMOO9n7xpnkBeD6 PjSHySg== X-Gm-Gg: AYBFou2GlYiRnROi8nhLEL3oE4NXIgRs16Mc8a+89CM06O0W7v+AVrjlf8x6dMW2BzV 8bF6Ezn954FFUWul5mdw0BWj/z73hHbTHwm72yb+Rtn2H+oTQNh5qZRwq5EOa9NAUoj3RI7aeBj uDQplxF5jnehGrK+HekFDw/c6VQOcDLa8u2jI30h8PBz1nFz5JCWJ+gOcQOcIjw2nWmtd2Oh5Jg pMpQyURwHihLdewvxFR50bPSbkH6jUEX71pxo0VdJH7ixQWUfy86Xn1ITHA+VKjFp12SZHTAE+q j9eW7t4utZgKvQSPxrpj6Gpxalb1zGe+8yWkdb1cHjnfiGH0V3MMH4xN5E+lc+T6qgKQqmaeQ1n J4cPvO5O5zJj63Ni8REvGWyFSxD+vcEvREVR6W8PnlAj7GWXR6RyVv7DpF2XDnG69NIXaNGKhd0 FRWaz2Q4bYczkPoxvUu7NuLs9XHPe3cTXN0TigsnKqRjx0NF+kO++tsvM+nN9oGMeqe1xv0JEGL NplL30Mq5lXZMxxG32dBJ4dooEaUJr5sGNZwLgdnC2JyrfyUrkEs0AA4Yc7+VCaI1pmhkxMxDiX uBQCMmzaCWmHfw== X-Received: by 2002:a05:6830:81d4:b0:81c:b9c6:16cc with SMTP id 46e09a7af769-84d08105767mr5119953a34.6.1792693699637; Thu, 22 Oct 2026 11:28:19 -0700 (PDT) Received: from [192.168.0.26] (97-122-110-129.hlrn.qwest.net. [97.122.110.129]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-84f784f3c50sm419557a34.21.2026.10.22.11.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 11:28:19 -0700 (PDT) From: Tom Tromey Subject: [PATCH RFC 0/6] Handle Android APK files Date: Thu, 22 Oct 2026 12:28:10 -0600 Message-Id: <20261022-android-apk-file-v1-0-8444bb5f832a@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x2MywrCMBAAf6Xs2cVmfYFXwQ/wKh62yaZd1KRsp BRK/93ocQZmFihiKgXOzQImkxbNqYLbNOAHTr2ghspALR3bAznkFCxrQB6fGPUlSFHcidxuT9F DzUaTqPN/eYfb9QKPKjsugp1x8sPvlk17Tds3l48YrOsX9AI0lIcAAAA= X-Change-ID: 20260521-android-apk-file-2fe1721342fc To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.15.2 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org While working on an Android port, we noticed that the Android gdbserver could report a shared library coming from an APK, like /some/path/file.apk!/inner/path/libwhatever.so This "!/" syntax presumably came from Java as the same thing was typical there for referring to files inside of jars. This series adds this capability. I considered a few ways of doing this, including writing a zip (an APK, like a jar, is really just a zip file) reader. In the end I thought it was better to rely on Python, first because the zip reader there is already debugged, and secondly because it doesn't involve any new dependencies (Python's zip reader is part of the standard library). I'm sending this first as an RFC. Here I chose to extend the missing objfile handler code to allow the scenario where a missing objfile does not have a build-id. This seemed like a straightforward extension to me, but I thought it would be best to run this past everyone before writing up the documentation and tests. Another question is what to do with the Android handler. I've unconditionally enabled it here, because I don't think there's currently a way for gdb to know it is targeting Android; but also because TBH this seems reasaonbly safe, in the sense that nobody is really going to name a file "/usr/lib/haha.apk!/youlose.so". Still, this is worth some discussion. Finally, I wrote most of this before starting on the Python safety API. So, while this series uses the old-style approach, if this seems generally acceptable, I'll update it after writing the tests. Signed-off-by: Tom Tromey --- Tom Tromey (6): Add py-file.c Add py-iovec.c Allow missing build-id when finding an objfile Allow missing objfile handler to return a file Call ext_lang_find_objfile_from_buildid from solib_bfd_fopen Add gdb.handler.android module gdb/Makefile.in | 2 + gdb/build-id.c | 4 +- gdb/data-directory/Makefile.in | 2 + gdb/extension.c | 2 +- gdb/extension.h | 21 +++ gdb/python/lib/gdb/__init__.py | 21 ++- gdb/python/lib/gdb/handler/__init__.py | 14 ++ gdb/python/lib/gdb/handler/android.py | 43 +++++ gdb/python/lib/gdb/missing_objfile.py | 28 ++++ gdb/python/py-file.c | 298 +++++++++++++++++++++++++++++++++ gdb/python/py-iovec.c | 130 ++++++++++++++ gdb/python/python-internal.h | 2 + gdb/python/python.c | 45 +++-- gdb/solib.c | 18 +- gdb/symfile-debug.c | 20 ++- 15 files changed, 617 insertions(+), 33 deletions(-) --- base-commit: 638f6237867858a849f3d6ffa1a1f8d6cd669636 change-id: 20260521-android-apk-file-2fe1721342fc Best regards, -- Tom Tromey