Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5777784ybp; Tue, 15 Oct 2019 05:02:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhgEDyDjpwkIpjsEazeaFvl0wiBnM2TkuLeeVB7SUlqaVNJAmmxSiKOpXEJpPslQcndJWs X-Received: by 2002:a17:906:bfcb:: with SMTP id us11mr6740370ejb.299.1571140944483; Tue, 15 Oct 2019 05:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571140944; cv=none; d=google.com; s=arc-20160816; b=tgJO/3wAUmix4fQMVjOLt7NVowMUphV8Srvab6Ml7k8Zdq9b3UCHeIsONE5VgDiBfB oRDdDyzJv6FAiL52JWAenfWV8WMKqY/qEHF2Gfn2MVQZTt7p1qxYgvHdSd6LJ1Jo6DNc H2M+uSY6gXtCUUlHaJc9CR+Ysa7pxytXNZl/xSKhLbyrAFXmOhL2igIPFUfnl+qpwH+D tRDpsBP+QlYiLPNA0XZXlNiOWnth5LG92YDl7rpeyJIetBupMIHi6yPdY6cJ1ANPQyyp CZxZwbJeV1TnRJoN+P3b2l4/lSpQunE4TSqI9SkkIrei4iKl2yas7YPsmYiQo6ff28wb S3Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=A+qY+41rW0tF2sF6VrT6OYZhyS1icvtx/m6brlRgQHU=; b=MTjZBzGmsH/zxQlLqi4VOR8IgJLPMzHrxonTkxxvQ4d0Uzzo4e3CvGXuDCwXZHiAn7 slFBalUo6l4f8znn0XLZlJ4n7N+MOtaClON7OW0edXwc8lDQ85ulKPQTU8AmH+Y+Y72h 3eSg6svbPAlpX8FyGQrQvVM9b2+nsPUekIn4UQkT8SVP5MQZ6RrLkjPkzXAePFO6yY8D pV7oJUSvvJjyesWDcurCY/L7ZVZ4TUkAJ97yWTwOJtaqJOBr9hD+dnaqbNued2mcNSGD 8KTVXNIGtYqCjo6ORvjSTaDI/6IXeyfs4MN1KI3ksL1Tg2UcnIy8bZ0fkDDm1P/ERfBV V7CA== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si13090031ejb.136.2019.10.15.05.01.55; Tue, 15 Oct 2019 05:02:24 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731441AbfJOKx4 (ORCPT + 99 others); Tue, 15 Oct 2019 06:53:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:63798 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbfJOKx4 (ORCPT ); Tue, 15 Oct 2019 06:53:56 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9FAqN1F011149 for ; Tue, 15 Oct 2019 06:53:55 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vk9n3fmb0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Oct 2019 06:53:53 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Oct 2019 11:53:19 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 15 Oct 2019 11:53:16 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9FArELh49021050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2019 10:53:14 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 875C442049; Tue, 15 Oct 2019 10:53:14 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 450A842042; Tue, 15 Oct 2019 10:53:14 +0000 (GMT) Received: from white.boeblingen.de.ibm.com (unknown [9.152.98.114]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 15 Oct 2019 10:53:14 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich Subject: [PATCH] scripts/gdb: fix debugging modules on s390 Date: Tue, 15 Oct 2019 12:53:13 +0200 X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19101510-0020-0000-0000-0000037938D2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19101510-0021-0000-0000-000021CF56AB Message-Id: <20191015105313.12663-1-iii@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-15_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=852 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910150100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) cmdline = "add-symbol-file {filename} {addr}{sections}".format( filename=module_file, addr=module_addr, -- 2.23.0