[Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 4 20:43:35 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154
Bug ID: 107154
Summary: GDB jumping to end of block when stepping over
construction of local variable
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <initializer_list>
#include <string>
struct X {
X(std::initializer_list<std::string>, int) { }
};
int main()
{
X x( {"", "", "", ""}, 1|4 );
return 0;
}
tmp$ g++ -g debug.C -o debug
tmp$ gdb -q debug
Reading symbols from debug...
(gdb) start
Temporary breakpoint 1 at 0x40123a: file debug.C, line 12.
Starting program: /tmp/debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Temporary breakpoint 1, main () at debug.C:12
12 }
(gdb) n
10 X x( {"", "", "", ""}, 1|4 );
(gdb)
12 }
(gdb)
11 return 0;
(gdb)
__libc_start_call_main (main=main@entry=0x401226 <main()>, argc=argc@entry=1,
argv=argv@entry=0x7fffffffd7a8) at ../sysdeps/nptl/libc_start_call_main.h:74
74 exit (result);
(gdb)
[Inferior 1 (process 577012) exited normally]
Why does "start" break on the closing brace of main(), and then the
construction of 'x' also jumps to the closing brace?
In less trivial examples I've seen it jump back and forth multiple times:
243 libmap libs;
(gdb) n
245 redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb)
310 }
(gdb)
245 redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb)
310 }
(gdb)
245 redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb)
[Detaching after fork from child process 845854]
310 }
(gdb)
More information about the Gcc-bugs
mailing list