Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp917861ybg; Fri, 18 Oct 2019 09:14:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGFhfOcyq00J5nc4ZkSuZXYXl6KukJRchsG1kX0M4Md50GWXc8A8JTHD8sMYFOrk7c6TcI X-Received: by 2002:a05:6402:158f:: with SMTP id c15mr10645860edv.192.1571415287010; Fri, 18 Oct 2019 09:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571415287; cv=none; d=google.com; s=arc-20160816; b=JoN6cH/iAqkMcsR0lqKJT2QUSI2YBzV0CrU0FPBbGSUP+4HUe57TrZK0lNR6fqwJDb rItvkYKdBQzBc0Dfjbmihg5Ptb5JGiC5FrgZJjuQVqOcOkbmSUMot4PRIYt8orOYQEcu 7LiYzuUUPaC5iGGsX/MReRee5hwTAJ6kcRakXNO4RBkuiOnIku98EAkvy2cLFpSCQapz PEj2FMQeHdjB7eTPcQ+03lxjNNtUZqeV081ZFyP4De5AHYz8ldf127Jm8DTj9En7ekOz emDUqZ6JUzVcP5pL+ZHBY/3Lhjr5XcbRaV+AD3+hrIy7LYereZtAwoQmfdkkMsw6KH6Y 0Qnw== 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=4WHFvsomlr7XINtgGJptHXOHRsY3nT6gNOERF+nxT8w=; b=PmXRgqszo5RBHvtWWD+RdzsG/zu9d0HFz8FnN9dconJcNz9NpXCj0jUot4dpVM67X/ d/nYF+xREIzhLkjUukoVTdbsFj211YLlQfrg23G0/rrLbuO2B4w1FlTVkyAFv231uCQc 7XYXqxtqyCJwrvB3AT/nI6JV8F+yQSPAWlKp5Bs3HsUAl44JSEmZ4Bxg47rlE8Ty1KUN ZHa7nR0148KyV+LrITEjiOxylQGk0r4MTiYkY7iOIfQYTPMtsqEwJNu5yR0x8ppFuYTB ANhTIWD4KTt8qNAvdPXtI2XWSASM1a5En7mVA/yq7XDMnRNQ7m7rzK8yqiKL6M47qo0N id6Q== 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 52si4115248edz.413.2019.10.18.09.14.23; Fri, 18 Oct 2019 09:14:46 -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 S2439856AbfJQOLn (ORCPT + 99 others); Thu, 17 Oct 2019 10:11:43 -0400 Received: from goliath.siemens.de ([192.35.17.28]:50691 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbfJQOLm (ORCPT ); Thu, 17 Oct 2019 10:11:42 -0400 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x9HEBKKZ011676 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2019 16:11:20 +0200 Received: from [139.25.68.37] ([139.25.68.37]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x9HEBKiK018505; Thu, 17 Oct 2019 16:11:20 +0200 Subject: Re: [PATCH v2] 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: <20191017085917.81791-1-iii@linux.ibm.com> From: Jan Kiszka Message-ID: Date: Thu, 17 Oct 2019 16:11:20 +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: <20191017085917.81791-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 17.10.19 10:59, 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 > --- > > v1 -> v2: print the adjusted address. > > 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..df4c810de663 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'): > @@ -111,6 +111,12 @@ lx-symbols command.""" > module_file = self._get_module_file(module_name) > > if 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) > gdb.write("loading @{addr}: {filename}\n".format( > addr=module_addr, filename=module_file)) > cmdline = "add-symbol-file {filename} {addr}{sections}".format( > Reviewed-by: Jan Kiszka Thanks, Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux