From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D0A04388C002; Fri, 29 May 2020 12:30:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0A04388C002 From: "yangyibiao at hust dot edu.cn" To: gdb-prs@sourceware.org Subject: [Bug symtab/26061] New: Wrong debug info for argc at -O2 Date: Fri, 29 May 2020 12:30:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yangyibiao at hust dot edu.cn 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 attachments.created 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 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: Fri, 29 May 2020 12:30:44 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26061 Bug ID: 26061 Summary: Wrong debug info for argc at -O2 Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: yangyibiao at hust dot edu.cn Target Milestone: --- Created attachment 12577 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D12577&action=3Ded= it a.out $ gcc --version gcc (GCC) 10.0.1 20200419 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. yibiao:~/Debugger$ gdb --version GNU gdb (GDB) 10.0.50.20200517-git Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Consider test-case: ... $ cat small.c #include int main(int argc, char **argv) { char buf[6]; char c[] =3D "abc"; sprintf(buf, (char *)c, 1); return 0; } ... $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401040: file small.c, line 5. (gdb) r Starting program: /home/yibiao/Debugger/a.out=20 Breakpoint 1, main (argc=3D1, argv=3D0x7fffffffdff8) at small.c:5 5 char c[] =3D "abc"; (gdb) info args argc argc =3D 1 (gdb) step 6 sprintf(buf, (char *)c, 1); (gdb) info args argc argc =3D -8454 (gdb)=20 /************************************** We can find that at line 5, the value of argc is 1. When stepping to line 6, the value of argc is changed to -8454. When stepping with stepi, the value = of argc is correct. --=20 You are receiving this mail because: You are on the CC list for the bug.=