public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30347] New: GDB show inconsistent line and function information on corner-cases.
@ 2023-04-13 13:25 hluaw at connect dot ust.hk
  0 siblings, 0 replies; only message in thread
From: hluaw at connect dot ust.hk @ 2023-04-13 13:25 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30347

            Bug ID: 30347
           Summary: GDB show inconsistent line and function information on
                    corner-cases.
           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:
static int a = 209, b;
int *volatile c = &b;
int d[5];
int g;
int func_5(int h) {
  int e[5];
  char l_96 = 82;
  int f = 0;
  for (; f < 5; f++)
    e[f] |= h;
  return 0;
}
int func_1() {
  int f = 0;
  for (; f < 4; f++)
    d[f] = 4;
  *c = a;
  func_5(*c);
  a = 3;
  return 0;
}
int main() {
  int argc = g = 1;
  func_1();
}

Compiled with Clang 15.0.7 -g -O1

Near the entry of func_5(), using `stepi` causes GDB shows inconsistent
information of line and function and shows out-of-scope variables.

Breakpoint 1.2, func_1 () at r.c:18
18        func_5(*c);
(gdb) si
0x0000555555554705      18        func_5(*c);
(gdb) si
0x0000555555554707      18        func_5(*c);
(gdb) si
0x0000555555554709 in func_5 (h=209) at r.c:18
18        func_5(*c);
(gdb) info locals
e = {-7088, 32767, 0, 0, 0}
l_96 = 82 'R'
f = 0

Despite that the line shown by "list" is still line 18 in func_1, it seems GDB
has propogate the frame into func_5, causing an inconsistency between the line
displayed and the frame actually in.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-13 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 13:25 [Bug gdb/30347] New: GDB show inconsistent line and function information on corner-cases hluaw at connect dot ust.hk

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).