From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-oln040092255068.outbound.protection.outlook.com [40.92.255.68]) by sourceware.org (Postfix) with ESMTPS id 1DAF53858C27 for ; Wed, 9 Dec 2020 01:14:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DAF53858C27 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZYRRhDeDfIh2voRw7kJtXZlxIAk73FG9MD4Kox4+CZ+RpmKhFNdTJByfqsH1zbIFe0YIJF2GA1xjI6tnvxCS4O17hbZiS7WLCBdl1udnD2Se/pZL9kbPrLhs4+8E3UFE1T2eQEecgjIhlFe0PXa2sCuTNk2egTLsRDMU1Rp6nVsSC4+xxkLtT/828Cmo0NonB91cCLO0RrUQKrA4gkB0T7Akv0Vvxgt6encLWfI8CE+hCXStv8C7QxvrTHz8uQqiPNDJcTKbIw8ZaE1iQvPGUyT/zRAtVphxX1kegswxHrYWetNmKp9M/+xHhFnzw/efbJQxOOGv24q9QzQpXfU+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uyRbC+vZaJ34Ct5mN2bn6oCyytllTpPQ56tcP0kUNZM=; b=IPJFfqigPOjM4mwX0bsR+RICyv0DUkMv1eSHqREzveFf6WD3Lg5oPMrrKxeUGXiKo4C+pxM0c42/8+HJ+mKjxj41v2O+YW67s2HHYAeq6yUFfXFVpfz6UultYBLSVZ8TSsQNjRigR5QoUpuve7g2drGWO4QfBs3Un6AtuKW4KuJjWpLOz2cxAre/WEndhbJpuOEA0xi5CpBVySvxUwEhMmEAaW7Bey00fZ1EYVEqWPRsHkkd+4yFrAu1TLeItQIqwjpMLgJ6JLUmlSvMgdlgpFcddBQ2ZdVKoohdwDCfkIcoDn5rZFtuz0+scDjSjR5biaK/dR6lmz7vOT34p3QA1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from SG2APC01FT005.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebd::42) by SG2APC01HT040.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebd::418) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Wed, 9 Dec 2020 01:14:30 +0000 Received: from SYYP282MB2079.AUSP282.PROD.OUTLOOK.COM (2a01:111:e400:7ebd::41) by SG2APC01FT005.mail.protection.outlook.com (2a01:111:e400:7ebd::147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 9 Dec 2020 01:14:30 +0000 Received: from SYYP282MB2079.AUSP282.PROD.OUTLOOK.COM ([fe80::8003:112b:5950:726c]) by SYYP282MB2079.AUSP282.PROD.OUTLOOK.COM ([fe80::8003:112b:5950:726c%9]) with mapi id 15.20.3632.023; Wed, 9 Dec 2020 01:14:30 +0000 From: Yang Yibiao To: "gdb@sourceware.org" Subject: Is it possible that an address is mapping to more than one source lines of code? Thread-Topic: Is it possible that an address is mapping to more than one source lines of code? Thread-Index: AQHWzceeB1pQPKSvn02eYRE9aIM2QA== Date: Wed, 9 Dec 2020 01:14:30 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:144E3E90CFE860179CDC25A608877F2903D2A24B8365E2D97CDEE21E49B10B3E; UpperCasedChecksum:9BDBC5861BCE3FA421979FD8519A6BB1ABDED6608B4A62F213FE002E2B7D25C1; SizeAsReceived:6696; Count:41 x-tmn: [wqUeUSTU1VPbhHEx9U2B4MA8SeV4jXQZ] x-ms-publictraffictype: Email x-incomingheadercount: 41 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 33f5aec4-57b5-4b6c-b055-08d89bdfc797 x-ms-traffictypediagnostic: SG2APC01HT040: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eQB4fGH6oBrh1w9oBMxgZdEZ0X2f26nBZmcbP20tI7yGrZ0dz6p1+FPSTF2BuieCQn8xyFkMAj0KkvhAGPbRFLPkKymeXKhMIyqz4dpJKjCtsWaw2Cud9BDng6l3AFLfhJEH29c4L3EBg3fadOQ7rnjzl4iy79AP8d86+6lInLOUk0aajlyfeYnVw2V/gprpKxqRmo6s0P+awYAc7SRyf0e6oZvLzrRfVk8LXcW/m2CBIy3jQKeIiFAa8QZ+WoZx x-ms-exchange-antispam-messagedata: d0mz46SdEmcohJOYyCAAtip6IJT38/IfsN1DoUgZnCsmIt52OYLEtXQuvyEHriEkKU+LLgXjZcwoHJ6bxMFJ/pnki/s+SIsQ6Ju9HTYOROHdmB9UTFhho27Qmpui1iYRh95D9g7GnsP0GryWmDn3Qw== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: SG2APC01FT005.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 33f5aec4-57b5-4b6c-b055-08d89bdfc797 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2020 01:14:30.0618 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2APC01HT040 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Wed, 09 Dec 2020 01:14:39 -0000 Hi, Consider the following code: $ cat small.c /* { dg-do run } */ char *pa; char *pb; char *pc; void access (volatile char *ptr) { *ptr =3D 'x'; } int main (int argc, char **argv) { char a; char b; char c; pa =3D &a; pb =3D &b; pc =3D &c; access (pb); access (pc); // access 'b' here access (pa + 32); return 0; } /** Compile with =91-O1=92 optimization **/ $ gcc -O1 -g small.c /** debug under gdb **/ $ gdb a.out (gdb) b main Breakpoint 1 at 0x68e: file small.c, line 13. (gdb) r Starting program: /root/DeVIL/a.out Breakpoint 1, main (argc=3D1, argv=3D0x7fffffffe588) at small.c:13 13 { (gdb) s 18 pa =3D &a; (gdb) s 19 pb =3D &b; (gdb) s 20 pc =3D &c; (gdb) s 22 access (pb); (gdb) where -frame-info location-and-address #0 0x00005555555546c6 in main (argc=3D1, argv=3D0x7fffffffe588) at small.c= :22 (gdb) s access (ptr=3D0x7fffffffe496 "") at small.c:9 9 *ptr =3D 'x'; (gdb) where -frame-info location-and-address #0 0x00005555555546c6 in access (ptr=3D0x7fffffffe496 "") at small.c:9 #1 0x00005555555546c6 in main (argc=3D1, argv=3D0x7fffffffe588) at small.c= :22 ############################################################ We can found that 0x00005555555546c6 not only belongs to source line "small= .c:22" but also belongs to "small.c:9" When compiling "small.c" without optimization, there is no such problem. I was wondering that this might be a bug of gdb, thus I also submitted it a= s a new bug report in Bugzilla of gdb: https://sourceware.org/bugzilla/show_bug.cgi?id=3D27036