Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6014840ybp; Tue, 15 Oct 2019 08:22:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLs5BSwNaY3HKiZWLaX/YEQ5B3JG9+NRgdsTD/d9ToMkyLetnDocRT/K0wb2bjbTDVZZBr X-Received: by 2002:a17:906:6a09:: with SMTP id o9mr34296707ejr.289.1571152950851; Tue, 15 Oct 2019 08:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571152950; cv=none; d=google.com; s=arc-20160816; b=gTSNODSJUH0DdPiHT4Ze83fLUuYOYaXk7iDw9o1JtCR4H4cgjo7DWWjzuF6r+zekFI vmeSCFyAlpwo6zZsDID1L+zN5IfM/VNsjJNBawQsOHaurjMdU3BY8/4U7SgQiAGvBOFD AOvoOy4RloIz4ic+zkBYIoO5L+UxLPaC/oYB1CvoCjt3vHOFsgRc/UjPF2RP0LC4BHRA VkWg4oJUuFPTXWvl29kxTUnw5bmwc7qD6Q1YdBfiYddnn+L42k1mOGeK8WTlWlo3GgqW 77Ra+1U+Hlqdxu9tpv1IUiYbcOlXPKESH1UmVpaX1GV7JK6b2GYjxJrPKLax6plJk+vf ZVjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=jL54+9Yho0e/TDHZnu5HawawahF3C+mAo0HEGYa9xPc=; b=Evt7cV/2HLMubjOb7WccNKcXIc4guvYEx5YOfhyw2hYGk2MH8u04rAsBssfrhCgJpe jlyYIog/8ZOEnKhJSdp2l45O5oStV0Q+kUKfxCy3TwvLI0kkg5TE9F2HRHvh1s/tB99/ 7f0VhQjPaTp1VMxskLvgsU5Eoug/7ivSFBRS+Pl+Inw4CV3+S7auo21O881obc/fpzTD QmJD0sA3Q0AMOnZgX8GIfeTU+U5IQKqPmJ24ugHxTpij/cLsSuEvVvYEWmqvUTbqUnJG fTd6ZOZU6z3N/ImlweES8lKKmOAIHiK+VGjUGe8DfueP0WEfYlTANewYqsVq/uwlN1OE rahQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca4si14139033ejb.39.2019.10.15.08.22.07; Tue, 15 Oct 2019 08:22:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733299AbfJOPVp (ORCPT + 99 others); Tue, 15 Oct 2019 11:21:45 -0400 Received: from gecko.sbs.de ([194.138.37.40]:57804 "EHLO gecko.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732991AbfJOPVp (ORCPT ); Tue, 15 Oct 2019 11:21:45 -0400 Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id x9FFLZtr004347 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2019 17:21:35 +0200 Received: from [139.25.68.37] ([139.25.68.37]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x9FFLHkl014570; Tue, 15 Oct 2019 17:21:17 +0200 Subject: Re: [PATCH] scripts/gdb: fix debugging modules on s390 To: Ilya Leoshkevich , Kieran Bingham , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Heiko Carstens , Vasily Gorbik References: <20191015105313.12663-1-iii@linux.ibm.com> From: Jan Kiszka Message-ID: <356384d7-d14f-2c9d-1c13-3d96e75e1727@siemens.com> Date: Tue, 15 Oct 2019 17:21:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191015105313.12663-1-iii@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.10.19 12:53, Ilya Leoshkevich wrote: > Currently lx-symbols assumes that module text is always located at > module->core_layout->base, but s390 uses the following layout: > > +------+ <- module->core_layout->base > | GOT | > +------+ <- module->core_layout->base + module->arch->plt_offset > | PLT | > +------+ <- module->core_layout->base + module->arch->plt_offset + > | TEXT | module->arch->plt_size > +------+ > > Therefore, when trying to debug modules on s390, all the symbol > addresses are skewed by plt_offset + plt_size. > > Fix by adding plt_offset + plt_size to module_addr in > load_module_symbols(). > > Signed-off-by: Ilya Leoshkevich > --- > scripts/gdb/linux/symbols.py | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py > index f0d8f2ecfde7..41c6d1a55b03 100644 > --- a/scripts/gdb/linux/symbols.py > +++ b/scripts/gdb/linux/symbols.py > @@ -15,7 +15,7 @@ import gdb > import os > import re > > -from linux import modules > +from linux import modules, utils > > > if hasattr(gdb, 'Breakpoint'): > @@ -113,6 +113,12 @@ lx-symbols command.""" > if module_file: > gdb.write("loading @{addr}: {filename}\n".format( > addr=module_addr, filename=module_file)) > + if utils.is_target_arch('s390'): > + # Module text is preceded by PLT stubs on s390. > + module_arch = module['arch'] > + plt_offset = int(module_arch['plt_offset']) > + plt_size = int(module_arch['plt_size']) > + module_addr = hex(int(module_addr, 0) + plt_offset + plt_size) Shouldn't we report the actual address above, ie. reorder this tuning with the gdb.write? > cmdline = "add-symbol-file {filename} {addr}{sections}".format( > filename=module_file, > addr=module_addr, > Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux