From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5B3DE3858C2D; Wed, 19 Apr 2023 18:40:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B3DE3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681929608; bh=XmnaE7WRnuVCKhp1SfC6cYPaDACbiTcTxq0GUV0htKo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QwASPMGmbIKKsK+HTQfQNktu4QEhul/uL6W9yrZ+MRSLw0SoTbBSmZnh6mAs1nqTv kHpBN2hxRx4mY3OEC0sJZY2tjFBGWwIYdkBqkrmtt4FeC7ixGtHXJzLRrwkYRfwS2F 3X/calvhTRErmt0xbQuph5KHHcdKCabYJEIrP+FU= From: "tromey at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug ada/25811] [ada] start attempts to set breakpoint on main of previous exec Date: Wed, 19 Apr 2023 18:40:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: ada X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tromey at sourceware dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D25811 Tom Tromey changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tromey at sourceware dot o= rg --- Comment #1 from Tom Tromey --- The bug here is that ada_main_name reads memory to find the name: main_program_name =3D target_read_string (main_program_name_addr, 102= 4); The symbol is correctly found in the new executable: (top-gdb) p msym.objfile.original_name $19 =3D 0x3424020 "/home/tromey/gdb/build/gdb/testsuite/outputs/gdb.ada/exec_changed/./common" ... but the memory comes from the running inferior. If I "kill" the inferior first, it works: (gdb) kill Kill the program being debugged? (y or n) y [Inferior 1 (process 2209503) killed] (gdb) file ./common=20 Load new symbol table from "./common"? (y or n) y Reading symbols from ./common... (gdb) info main _ada_second I'm not really sure what we want to do about this case. Another way to make it work is "set trust-readonly-sections on". Perhaps ada_main_name could do this temporarily. I can't tell if I think that would be a hack or not. Actually... instead of modifying the flag, it might be better to just dig through the BFD section data by hand. (Not sure.) A better solution would be to modify the compiler to emit DW_AT_main_subprogram, but I am not sure how hard that would be. --=20 You are receiving this mail because: You are on the CC list for the bug.=