public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jay.krell at cornell dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/99457] New: gcc/gdb -gstabs+ is buggy. Date: Mon, 08 Mar 2021 04:49:03 +0000 [thread overview] Message-ID: <bug-99457-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99457 Bug ID: 99457 Summary: gcc/gdb -gstabs+ is buggy. Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: jay.krell at cornell dot edu Target Milestone: --- gcc/gdb -gstabs+ is buggy. Could be either, I didn't investigate. The codegen is correct. That's ok, I didn't really need it, I'll use regular -g. $ cat 1.c #include <stdio.h> int main() { char a[100] = {0}; printf("%d\n", a[0]); } $ gcc --version gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 $ gcc -gstabs+ 1.c # correct output $ ./a.out 0 $ gdb --version GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1 $ gdb ./a.out (gdb) break main (gdb) r Breakpoint 1, main () at 1.c:3 3 { (gdb) n 4 char a[100] = {0}; (gdb) 5 printf("%d\n", a[0]); (gdb) p a $1 = "@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003\000\000@\003", '\000' <repeats 11 times>, "\001", '\000' <repeats 49 times> (gdb) p a[0] $2 = 64 '@' (gdb) disas Dump of assembler code for function main: 0x0000555555555169 <+0>: endbr64 0x000055555555516d <+4>: push %rbp 0x000055555555516e <+5>: mov %rsp,%rbp 0x0000555555555171 <+8>: sub $0x70,%rsp 0x0000555555555175 <+12>: mov %fs:0x28,%rax 0x000055555555517e <+21>: mov %rax,-0x8(%rbp) 0x0000555555555182 <+25>: xor %eax,%eax 0x0000555555555184 <+27>: movq $0x0,-0x70(%rbp) 0x000055555555518c <+35>: movq $0x0,-0x68(%rbp) 0x0000555555555194 <+43>: movq $0x0,-0x60(%rbp) 0x000055555555519c <+51>: movq $0x0,-0x58(%rbp) 0x00005555555551a4 <+59>: movq $0x0,-0x50(%rbp) 0x00005555555551ac <+67>: movq $0x0,-0x48(%rbp) 0x00005555555551b4 <+75>: movq $0x0,-0x40(%rbp) 0x00005555555551bc <+83>: movq $0x0,-0x38(%rbp) 0x00005555555551c4 <+91>: movq $0x0,-0x30(%rbp) 0x00005555555551cc <+99>: movq $0x0,-0x28(%rbp) 0x00005555555551d4 <+107>: movq $0x0,-0x20(%rbp) 0x00005555555551dc <+115>: movq $0x0,-0x18(%rbp) 0x00005555555551e4 <+123>: movl $0x0,-0x10(%rbp) => 0x00005555555551eb <+130>: movzbl -0x70(%rbp),%eax 0x00005555555551ef <+134>: movsbl %al,%eax 0x00005555555551f2 <+137>: mov %eax,%esi 0x00005555555551f4 <+139>: lea 0xe09(%rip),%rdi # 0x555555556004 0x00005555555551fb <+146>: mov $0x0,%eax 0x0000555555555200 <+151>: callq 0x555555555070 <printf@plt> 0x0000555555555205 <+156>: mov $0x0,%eax 0x000055555555520a <+161>: mov -0x8(%rbp),%rdx (gdb) q $ gcc -g 1.c $ gdb ./a.out (gdb) r Breakpoint 1, main () at 1.c:3 3 { (gdb) n 4 char a[100] = {0}; (gdb) 5 printf("%d\n", a[0]); (gdb) p a $1 = '\000' <repeats 99 times>
next reply other threads:[~2021-03-08 4:49 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-08 4:49 jay.krell at cornell dot edu [this message] 2021-03-08 5:27 ` [Bug debug/99457] " pinskia at gcc dot gnu.org 2021-03-08 5:29 ` pinskia at gcc dot gnu.org 2021-03-08 8:52 ` jakub at gcc dot gnu.org 2021-03-08 9:26 ` jay.krell at cornell dot edu 2021-03-08 9:58 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99457-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).