Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3516741ybg; Mon, 28 Oct 2019 14:11:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWiNmE3sj/AlqGSZ4Ajx7uKSYFmPwGedZvW3WnghFk2aQ3Z9T1weMUVkJUIbt/s+ZRGSjb X-Received: by 2002:a17:906:3199:: with SMTP id 25mr5893298ejy.284.1572297115827; Mon, 28 Oct 2019 14:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572297115; cv=none; d=google.com; s=arc-20160816; b=XXiCWOSQZD1Eeu64csFqd1ZHrKcQZpUxzNYk0zCwqyvdsRUcZFPPDa7dnd4b0vvGVB hmoFxkE2dTjVodp6RHTPNc4fX202D+E+onJ45GpnfaD6r57QR8VP1Z+1I8uD0HvEuHYa 5fmpUTNjqviX81RENRBmYo1giGyCTbQkbaSvMxoQGwMHQ9TfFnKGHqM/ZH8p8/xPHNVi 2uXFnhauNDkvNaFW18fkRklimJOCsJrndGJpvYBsvnxwPxFyArTYGhje617r3k5Yk01S LtRkkZlquBZV2HMC9UmPYxM/m4xotttx0knCGng+atw80uTupeUZalE/UN+9NlCp8Mj6 UJJA== 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=d4Z59dRotA3FckkB3Y2p4kzOMr4pSLP0bYXTAgrcbRM=; b=DH6oLfmLfh71xvxs5uYhjdgGIBNms8cd4OWJO94xcgkbGMvgEmoOnyA/bXMxOBYFoa K3ZpV4YCz0+IxO6KPueiDF94ZzA3QkVYcWQ2vAc/LdMN6YqdB3KtZsglgdN1NCBNuEnq 94RK+DssziAlSnWn5uIQKLaq8YnVaVzlxO+f3j1sjtPmYzqVa9RtR2fTmePB3NjQ2xSD FWFq2C1Ro2BfsZ2WgyirogbU67ymQ/horzvs59zsoE7yg3NCoT21HVPyOuq9aeJyCAvx JoLvLveEmlUkSKwkNnp7Cdlr02vVzpNGI3g4R6gHRbi/sVbQhf50ixb9ws265Krmnjko LYbQ== 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 i33si4213014edc.279.2019.10.28.14.11.32; Mon, 28 Oct 2019 14:11:55 -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 S1730273AbfJ1P1v (ORCPT + 99 others); Mon, 28 Oct 2019 11:27:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64526 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726934AbfJ1P1v (ORCPT ); Mon, 28 Oct 2019 11:27:51 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9SFNQca136811 for ; Mon, 28 Oct 2019 11:27:49 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vx2bv1xr7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 28 Oct 2019 11:27:49 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Oct 2019 15:27:47 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 28 Oct 2019 15:27:44 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9SFRgJQ36569474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2019 15:27:42 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6C87A4060; Mon, 28 Oct 2019 15:27:42 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56D41A405B; Mon, 28 Oct 2019 15:27:42 +0000 (GMT) Received: from white.boeblingen.de.ibm.com (unknown [9.152.97.44]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 28 Oct 2019 15:27:42 +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 compiled with hot/cold partitioning Date: Mon, 28 Oct 2019 16:27:34 +0100 X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19102815-4275-0000-0000-000003787DD0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19102815-4276-0000-0000-0000388BB142 Message-Id: <20191028152734.13065-1-iii@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-28_06:,, 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=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910280156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc's -freorder-blocks-and-partition option makes it group frequently and infrequently used code in .text.hot and .text.unlikely sections respectively. At least when building modules on s390, this option is used by default. gdb assumes that all code is located in .text section, and that .text section is located at module load address. With such modules this is no longer the case: there is code in .text.hot and .text.unlikely, and either of them might precede .text. Fix by explicitly telling gdb the addresses of code sections. It might be tempting to do this for all sections, not only the ones in the white list. Unfortunately, gdb appears to have an issue, when telling it about e.g. loadable .note.gnu.build-id section causes it to think that non-loadable .note.Linux section is loaded at address 0, which in turn causes NULL pointers to be resolved to bogus symbols. So keep using the white list approach for the time being. Signed-off-by: Ilya Leoshkevich --- scripts/gdb/linux/symbols.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 7b7c2fafbc68..be984aa29b75 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -99,7 +99,8 @@ lx-symbols command.""" attrs[n]['name'].string(): attrs[n]['address'] for n in range(int(sect_attrs['nsections']))} args = [] - for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]: + for section_name in [".data", ".data..read_mostly", ".rodata", ".bss", + ".text", ".text.hot", ".text.unlikely"]: address = section_name_to_address.get(section_name) if address: args.append(" -s {name} {addr}".format( -- 2.23.0