From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from imta-38.everyone.net (imta-37.everyone.net [216.200.145.37]) by sourceware.org (Postfix) with ESMTPS id 848DE3857820 for ; Sun, 30 May 2021 17:51:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 848DE3857820 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lcwb.coop Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rodney_bates@lcwb.coop Received: from pps.filterd (m0004962.ppops.net [127.0.0.1]) by imta-38.everyone.net (8.16.0.43/8.16.0.43) with SMTP id 14UHg5pw004376 for ; Sun, 30 May 2021 10:51:40 -0700 X-Eon-Originating-Account: Ktv_x5d7f6eWn8_lM3xX809Fp5Hwo9_-02_VmJamid_znVocCAXqhPKtAnfKlKNN X-Eon-Dm: m0117124.ppops.net Received: by m0117124.mta.everyone.net (EON-AUTHRELAY2 - a248a996) id m0117124.6062c7b8.4d66bd for ; Sun, 30 May 2021 10:51:37 -0700 X-Eon-Sig: AQNpay9gs9CpvCGwVgIAAAAB,c2bd1dae0f550410b2553ca0e9b57ecf X-Eip: 66K__IuoRuyOX80u0lbzSNZJaBTlk5VLq2rXriQMu7A Reply-To: rodney.m.bates@acm.org To: gdb@sourceware.org From: "Rodney M. Bates" Subject: Change in relocation of debug info Message-ID: Date: Sun, 30 May 2021 12:51:31 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: z3WW2-P2rFogQf2immzuxpdd_cyJgGhM X-Proofpoint-GUID: z3WW2-P2rFogQf2immzuxpdd_cyJgGhM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-30_09:2021-05-27, 2021-05-30 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1011 priorityscore=1501 suspectscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 impostorscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105300139 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: Sun, 30 May 2021 17:51:45 -0000 I am maintaining a debugger, derived from gdb-6.4, with additions for Modula-3. A recent change in the way gcc and gdb handle addresses of souce code line numbers in stabs notation has broken breakpoint insertion. I need help understanding what has happened. This could be a gcc problem, but I am starting here, because modern gdb appears to at least partly overcome what has changed in gcc, suggesting at least a coordinated change. In a reduced example, I have an object file SetElem_m.o, with the following: $objdump -g SetElem_m.o: ... /* file ../src/SetElem.m3 line 11 addr 0x11 */ ... When I link using gcc 5.4: $gcc --version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609, giving executable named prog I see: $objdump -g prog ... /* file ../src/SetElem.m3 line 11 addr 0x4008ee */ ... I can set a breakpoint at SetElem.m3:11, and all works as expected using either m3gdb or gdb: $m3gdb prog GNU gdb plus Modula-3 6.4 ... (m3gdb) break SetElem.m3:11 Breakpoint 1 at 0x4008ee: file ../src/SetElem.m3, line 11. (m3gdb) run Breakpoint 1, P (...) at ../src/SetElem.m3:11 11 RETURN SetTyp { Elem } (m3gdb) info reg rip rip 0x4008ee 0x4008ee But when linking with gcc 9.3: $gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 I see: $objdump -g prog ... /* file ../src/SetElem.m3 line 11 addr 0x9b1 */ ... neither unrelocated from the .o file nor where line 11 ends up (I think). m3gdb tries to insert the breakpoint at this address, failing, I presume because it is not a writable address: $m3gdb prog GNU gdb plus Modula-3 6.4 ... (m3gdb) break SetElem.m3:11 Breakpoint 1 at 0x9b1: file ../src/SetElem.m3, line 11. (m3gdb) run Starting program: /home/rodney/proj/m3/exp/setelem/AMD64_LINUX-ig-m3cc/prog Warning: Cannot insert breakpoint 1. Error accessing memory address 0x9b1: Input/output error. In constast, modern gdb inserts the breakpoint and stops, showing the correct source line number, although not all is right here either: $ gdb prog GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2 ... (gdb) break SetElem.m3:11 Breakpoint 1 at 0x9b1: file ../src/SetElem.m3, line 11. (gdb) run Starting program: /home/rodney/proj/m3/exp/setelem/AMD64_LINUX-ig-m3cc/prog ... Breakpoint 1, SetElem__P (M3_AuNps8_Elem=, M3_A6gO1v__result=) at ../src/SetElem.m3:11 11 RETURN SetTyp { Elem } (gdb) info reg rip rip So I can't tell where the actual code was relocated to. But it runs to completion normally, by itself or under either debugger without breakpoints. Any help would be appreciated. -- Rodney Bates rodney.m.bates@acm.org