public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "hluaw at connect dot ust.hk" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/30315] New: GDB not showing variable that is supposed to be there Date: Wed, 05 Apr 2023 13:39:26 +0000 [thread overview] Message-ID: <bug-30315-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=30315 Bug ID: 30315 Summary: GDB not showing variable that is supposed to be there Product: gdb Version: 13.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: hluaw at connect dot ust.hk Target Milestone: --- Given the following code: #include "stdint.h" #include "string.h" #include <stdio.h> int a, b; char* c; static int func_1() { int i = 0; for (; i < 4; i++) ; for (; a <= 4;) { uint16_t d; b = 0; return b; { int i; } } return b; } int main() { func_1(); printf(c); } Compiled with gcc 12.2.0 and -O1 -g The DWARF says that i persists until func_1 exits Breakpoint 1, func_1 () at r.c:10 10 for (; a <= 4;) { (gdb) info addr i Symbol "i" is multi-location: Range 0x40112a-0x40112a: the constant 0 Range 0x40112a-0x40112a: the constant 1 Range 0x40112a-0x40112a: the constant 2 Range 0x40112a-0x40112a: the constant 3 Range 0x40112a-0x40113d: the constant 4 . (gdb) p i $1 = 4 But GDB says i is <optimized out> prematurely at line 12 with $pc = 0x401133 still in the range of func_1 (gdb) p i $2 = <optimized out> (gdb) p $pc $3 = (void (*)()) 0x401133 <main+13> (gdb) -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2023-04-05 13:39 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-05 13:39 hluaw at connect dot ust.hk [this message] 2023-04-05 14:36 ` [Bug gdb/30315] " tromey at sourceware dot org 2024-01-20 16:19 ` ssbssa at sourceware dot org 2024-01-20 16:34 ` ssbssa at sourceware dot 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-30315-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.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).