From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by sourceware.org (Postfix) with ESMTPS id DA4343858402 for ; Thu, 26 Aug 2021 13:34:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA4343858402 Received: by mail-io1-xd31.google.com with SMTP id b10so3725791ioq.9 for ; Thu, 26 Aug 2021 06:34:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BDD+lxA+PGjq3+DMkuEeZmStSSRqr+h8b/yrTrVoPco=; b=bBcifhhZXhLrJjIzPnnsS/jqc51AjYDJe/4a8SjVunbOsGvuK1OQf4ygT7t3ju/MHW o6x6FgwddKI+DSbA9pYSUh3hdj7FFP93wAeNjKzu3oEIWkJ9nV3SI9L2A7gBy4t3oN4x ZBLvkcEzsD5u7zxeN/KxFTZjfBEwJZnDUgA2QeaaRIwEiYRSdxRxx2yQbuWYDnnu4p5v wX5zeRM3ijk1YeXY+5s/GpBEngrmmol6+j7lZy8wWLE4vreeFhybd477f4yvM1ZdofQV lN1wL9qvOqOxzJ7/zdNyya+tcvIHXC2puEMVv8fPKiki14WjDEYdR8mvcm0sPmpuUDO0 Pl8A== X-Gm-Message-State: AOAM533ZMqFS3nZXdLoKgZQcdRTxH4lfVUx3DZTizgvyEtjDgsuvar7w 0XNLvpG/ECXTwhwO5ZlKlwFA7l4RcM80a0EHWhNXqQOlbNTxkU3u X-Google-Smtp-Source: ABdhPJxa/Dn3ELWuLE+gn3VUz+jIS2MP0gf/EopUiKJiaY2uxzDx124fSu0hIHKqCMk2UFLfNtAL54rKrAQDcJv5pvA= X-Received: by 2002:a5e:9e44:: with SMTP id j4mr2936941ioq.171.1629984852005; Thu, 26 Aug 2021 06:34:12 -0700 (PDT) MIME-Version: 1.0 From: himanshu gaur Date: Thu, 26 Aug 2021 08:34:00 -0500 Message-ID: Subject: Shared libraries will not load when trying to debug a cross compiled executable in gdb To: gdb@sourceware.org X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2021 13:34:23 -0000 Hello All, Downloaded the core dump locally(core dump was generated by systemd-coredump on the original target and then downloaded to a different location) and using a local copy of GDB to debug, the shared libraries will not load. (gdb) bt #0 0x0000007f83148560 in ?? () =E2=80=98info shared=E2=80=99 gives the following output: (gdb) info shared No shared libraries loaded at this time. However, when debugging on the original target with *'coredumpctl debug'*, all shared libraries load without any issues. The 'info shared' output there is (gdb) info shared >From To Syms Read Shared Object Library 0x0000007f854cb070 0x0000007f854cd748 Yes (*) /lib/libcap.so.2 0x0000007f85474fb0 0x0000007f854a20e8 Yes (*) /usr/lib/libdbus-1.so.3 0x0000007f85439070 0x0000007f8544aff0 Yes (*) /lib/libpthread.so.0 and so on =E2=80=A6=E2=80=A6 *Things tried to manually load the shared libraries* 1. Tried setting the *solib-search-path* to point to the shared libraries using *'set solib-search-path /usr/lib/foo.so'* and setting the *solib-absolute-prefix to /usr/lib*. No acknowledgement was given that foo.so was loaded. 2. Tried running *objdump* on the executable, got the list .so libraries, and tried to link them individually by setting the path. That did not lo= ad the libraries as well. 3. Tried running '*sharedlibrary foo*' after '*set auto-solib-add off*'. Sharedlibrary foo was not loaded. 4. Tried changing sysroot using the *'set sysroot'* command to point to a directory containing the shared libraries in lib/ and usr/lib subdirectories. Since not able to load the shared libraries manually, the assumption is that the mechanism that provides a way to identify what libraries to load might be broken somehow. Has anyone seen similar before and what can be done to ensure that the shared libraries load? Any help is appreciated. Thanks! --=20 Thanks & Regards, Himanshu Gaur.