From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 09CAD3858CD1; Thu, 1 Feb 2024 03:24:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09CAD3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706757884; bh=lweDbZqoqSRynGQJDh+RTnEiD70kudY4jZYsFIliFYQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PBuO/cBazjKFgPKJdIEL7YJYUJELzzRc4X2DGZaspF4csz28wQLbO4pg7Ztyv4P4U tv0tSJi8VwzhAo0Ffo+h4sYatJXn5NuxpPM03dPXSkZadqPNHLo5nGr46hxd2QfK4H 0EElb7UJE9g7uwFUVUQzNN56U3p2Ou7uWJBnPBJw= From: "thiago.bauermann at linaro dot org" To: gdb-prs@sourceware.org Subject: [Bug gdb/31254] [gdb, arm] FAIL: gdb.threads/staticthreads.exp: up 10 Date: Thu, 01 Feb 2024 03:24:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: thiago.bauermann at linaro 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: attachments.created 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=3D31254 --- Comment #17 from Thiago Jung Bauermann --- Created attachment 15347 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D15347&action=3Ded= it memcheck output of corruption problem Valgrind pointed out what the problem is. I'm attaching the full output (the line numbers may be a bit off due to some debug statements I added), but he= re are the highlights: As I mentioned in the previous comment, arm_find_exidx_entry () returns an entry containing garbage. Then arm_exidx_fill_cache () reads it: =3D=3D3763513=3D=3D Invalid read of size 1 =3D=3D3763513=3D=3D at 0x3DE8CC: arm_exidx_fill_cache(frame_info_ptr, un= signed char*) (arm-tdep.c:2865) =3D=3D3763513=3D=3D by 0x3DFFE1: arm_exidx_unwind_sniffer(frame_unwind c= onst*, frame_info_ptr, void**) (arm-tdep.c:3277) =3D=3D3763513=3D=3D by 0x6317ED: frame_unwind_try_unwinder(frame_info_pt= r, void**, frame_unwind const*) (frame-unwind.c:138) The problem is that arm_exidx_new_objfile () stores the unwind instructions= in the objfile's obstack but it is freed before arm_exidx_fill_cache () has a chance to use it: =3D=3D3763513=3D=3D Address 0xa128e10 is 608 bytes inside a block of size = 4,072 free'd =3D=3D3763513=3D=3D at 0x4867A68: free (vg_replace_malloc.c:872) =3D=3D3763513=3D=3D by 0x374A3F: void xfree(void*) (gdb-xfree.h:37) =3D=3D3763513=3D=3D by 0x518A351: obstack_free (obstack.c:357) =3D=3D3763513=3D=3D by 0x9A3B45: reread_symbols(int) (symfile.c:2587) =3D=3D3763513=3D=3D by 0x6C18CF: run_command_1(char const*, int, run_how) (infcmd.c:398) =3D=3D3763513=3D=3D by 0x6C1CBB: run_command(char const*, int) (infcmd.c= :512) This happens because reread_symbols () detects that the staticthreads executable has changed since it was loaded (I don't know why, though) and t= hus reinitializes the objfile obstacks. I'll see if I can make arm-tdep.c add a hook in objfiles_changed () so that= it can detect that the objfiles where reloaded and re-read the exception table= s. Or perhaps it's cleaner to convert objfiles_changed () into an observer. --=20 You are receiving this mail because: You are on the CC list for the bug.=