From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 37ED339E1E35; Mon, 19 Dec 2022 06:27:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37ED339E1E35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671431269; bh=agG21nPiRWjWIlZ3hwSefS4AXsoAMKK4wh9BsbkdJdM=; h=From:To:Subject:Date:From; b=jEZTzNvLnCQbZgbrhbt1Sm+4yyBhchamz/TucjDkdfKfaTFTbSIapG6sazlTcdJrf kD33mSdl7CoJ024Midt62xIATQ900oEi6r9EZh0D1hndn+IWtE05b7sF7jWbkrwaUL iREkvMuIl4uKYhfO0H4Kkj+TtFkdcEXeZhtZ0xZo= From: "vimacs.hacks at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug c++/29918] New: GDB cannot step or break into template functions compiled with g++ -Og Date: Mon, 19 Dec 2022 06:27:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vimacs.hacks at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D29918 Bug ID: 29918 Summary: GDB cannot step or break into template functions compiled with g++ -Og Product: gdb Version: 12.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ Assignee: unassigned at sourceware dot org Reporter: vimacs.hacks at gmail dot com Target Milestone: --- This is another issue posted on https://sourceware.org/pipermail/gdb/2022-November/050431.html For the following C++ code, I find that GDB (both 12.1 and gdb-13-branchpoint-5-g2a517ca94d3) cannot step or break into C++ template function t0 compiled with g++ -Og (GCC version 12.2.0), while LLDB from LLVM 14.0.6 can step into this function: template int t0(int n) { int sum =3D 0; for (int i =3D 0; i < n; ++i) { sum +=3D i * i; } return sum; } int t1(int n) { int sum =3D 0; for (int i =3D 0; i < n; ++i) { sum +=3D i * i; } return sum; } int main() { int a =3D t0(5); int b =3D t1(5); return a + b; } The behavior in GDB looks like this: Breakpoint 1, main () at template_func.cc:21 21 { (gdb) n 22 int a =3D t0(5); (gdb) s t0 (n=3Dn@entry=3D5) at template_func.cc:2 2 int t0(int n) (gdb)=20 main () at template_func.cc:23 23 int b =3D t1(5); (gdb)=20 The assembly output of "g++-g -Og" and "g++ -g -O0" are both attached in the attachment of the following comments, which can be assembled and reproduce = this issue. --=20 You are receiving this mail because: You are on the CC list for the bug.=