From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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: From: Christian Biesinger 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 Cc: Reuben Thomas via Gdb Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_SBL, URIBL_SBL_A, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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, 29 Oct 2020 12:30:30 -0000 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