From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 26rcEem1ml9+BgAAWB0awg (envelope-from ) for ; Thu, 29 Oct 2020 08:30:33 -0400 Received: by simark.ca (Postfix, from userid 112) id 3C3781EFC1; Thu, 29 Oct 2020 08:30:33 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 833CB1E58E for ; Thu, 29 Oct 2020 08:30:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AEE2385481B; Thu, 29 Oct 2020 12:30:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AEE2385481B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603974631; bh=hroX13doNi3ynDzmseutJQpK/PLnKHGNa31btKYd9qI=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=LY7SsddJSdBL39Akp+dwZZDiJTbAaO+SkY73qJLVKj5o/mJZKYV7A0yy4LmvXP08i rOk8nfPQ0X32EKksb1UqJinYHWgZoCcpzrQb9lLA/9iQq5ioB2h/RsRK9nzrbgCZl9 YAROzRD/VZ24Y037oJCoW8ePQ/nWILMxNoQVCfKM= Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id 0BAF8385481B for ; Thu, 29 Oct 2020 12:30:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0BAF8385481B Received: by mail-qk1-x730.google.com with SMTP id q199so1760457qke.10 for ; Thu, 29 Oct 2020 05:30:29 -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:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hroX13doNi3ynDzmseutJQpK/PLnKHGNa31btKYd9qI=; b=bJFpv/6m55L41+LsimVzlwp95Avm+/UYY2y/4JRwLbot/r4keEZeTuur6BhtXzY272 kG2IR/1jA3U5gP0KirjgVdl5MS5edv+ao44h2bx8Qs7k7S1aLt7MBWPJyKKYYo3klAtC dhP4Y37YBGDPFeP06D2kt9cSUO0otFJYpqfxoO1tdCPBZfNJBRnoovNc0JKYruPhdqID sCcJUO8EF6+cGhSggl0JSeZYCRuh0RCGS+zsR3BsYxNMQWs82g5+4gvTWKo34gFqoDYe 40pL0sgWNWD7eK+lZ1uTblVx0tz0qP9J09ep4M20anb7PpD4oMI7nVF7/fauDatwl4CB 6a5A== X-Gm-Message-State: AOAM5337jxZxwr4LtE4HzgZTD7sJ6BSjkjnOI1CWJLYVjImrLMEtH+tI fLjaFJ3DcY0LJQ16415feVgrwQZWclB4X1Oxa1tf8YCs/1L1+21l X-Google-Smtp-Source: ABdhPJxDuoj2VR22d9Shgw8tTNxktVgtJHl9iFjMgrl7perV5j8E6sn35AexpBTkcZ6pCCVhc0CzA/FYgPaClx8tHOY= X-Received: by 2002:a05:620a:849:: with SMTP id u9mr3265871qku.419.1603974628351; Thu, 29 Oct 2020 05:30:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 29 Oct 2020 13:29:51 +0100 Message-ID: Subject: Re: [Question] Is there a way to specify an offset to the loaded symbols? To: Marten Ringwelski Content-Type: text/plain; charset="UTF-8" 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: , From: Christian Biesinger via Gdb Reply-To: Christian Biesinger Cc: Reuben Thomas via Gdb Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" On Thu, Oct 29, 2020 at 9:23 AM Marten Ringwelski wrote: > > Hello, > for some reason that is not important here I need to debug a binary that is executed by calling the linker manually. > In my case I do `/lib/ld-musl-x86_64.so.1 binary`. > The problem with this is that gdb now obviously thinks that I want to debug `/lib/ld-musl-x86_64.so.1`. This is not the case. > Loading the symbols from `binary` does not help since the the linker loads the process into memory and the jumps to its main. > > In other words I have the symbols for the binary to be debugged but the binary is loaded into memory with an offset so the symbols are offseted. > Is there any way to get this working? add-symbol-file lets you specify an address but maybe it's easier if you just use patchelf --set-interpreter to make it use /lib/ld-musl-x86_64.so.1 Christian