From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AAFDA388C02A; Wed, 30 Dec 2020 17:02:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAFDA388C02A From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/25528] step will stopped at any "asm volatile" statement Date: Wed, 30 Dec 2020 17:02:58 +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: critical X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2020 17:02:58 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25528 --- Comment #2 from Tom de Vries --- (In reply to Yibiao Yang from comment #1) > In current version of GDB, statement with asm volatile will be skipped. >=20 > I was wondering that this is the default behavior of GDB. >=20 Compiling with gcc 9.3.1, and looking at the line info using readline -wL, I get: ... CU: small.c: Line number Starting address View Stmt 4 0x400492 x 5 0x40049c x 6 0x4004a2 x 6 0x4004a8 x 8 0x4004aa x 9 0x4004b8 x 9 0x4004c5 x 10 0x4004c9 x 6 0x4004c9 1 x 6 0x4004d4 x 12 0x4004db x 14 0x4004df x 14 0x4004e3 x 14 0x4004ed x 14 0x4004f0 x ... while we have: ... $ cat -n small.c 1 const signed char NM[] =3D {-1, 0, 1}; 2 3 __attribute__((noinline)) void f(short delta) 4 { 5 short p =3D 2, s; 6 for (s =3D 0; s < 2; s++) 7 { 8 p +=3D delta; 9 if (NM[p] =3D=3D 0) 10 asm volatile(""); 11 } 12 } 13 14 void main(void) { f(-1); } 15 ... So, the line with the asm stmt does have line info, but shares the address = with another entry with another line number. Using this debugging session, we can see that we do visit the address, but = show line 6 instead of line 10: ... (gdb)=20 9 if (NM[p] =3D=3D 0) (gdb) p /x $pc $1 =3D 0x4004b8 (gdb) s 6 for (s =3D 0; s < 2; s++) (gdb) p /x $pc $2 =3D 0x4004c9 (gdb)=20 ... which I'd say is a valid interpretation of the line number info. --=20 You are receiving this mail because: You are on the CC list for the bug.=