With break-point at line 3, CB debugger fails to stop, exits with status 1. Works with any other std:: class. Works in terminal. SVN 12198. Ubuntu 18.04. gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Works in terminal:
~/code/cpp/circuit/regex$ gdb ./bin/Debug/regex
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/Debug/regex...done.
(gdb) b 5
Breakpoint 1 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5.
(gdb) r
Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Breakpoint 1, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
5 std::cout << std::regex_match("xxx", s) << '\n';
(gdb) n
0
4 const std::regex s("x");
(gdb)
6 }
(gdb)
__libc_start_main (main=0x555555558d45 <main()>, argc=1, argv=0x7fffffffde38,
init=<optimized out="">, fini=<optimized out="">, rtld_fini=<optimized out="">,
stack_end=0x7fffffffde28) at ../csu/libc-start.c:344
344 ../csu/libc-start.c: No such file or directory.
(gdb) [Inferior 1 (process 4307) exited normally]
(gdb) </optimized></optimized></optimized></main()>
Build log
Build started on: 31-12-2020 at 14:44.15
Build ended on: 31-12-2020 at 14:44.17
[debug]Reading symbols from /home/graeme/code/cpp/circuit/regex/bin/Debug/regex... [debug]done. [debug]> set prompt >>>>>>cb_gdb:
Setting breakpoints
[debug]Using sleep command's PID as console PID 4121, TTY /dev/pts/0 [debug]Queued:[tty /dev/pts/0] debug >>>>>>cb_gdb: [debug]> show version [debug]GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2 [debug]Copyright (C) 2018 Free Software Foundation, Inc. [debug]License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html [debug]This is free software: you are free to change and redistribute it. [debug]There is NO WARRANTY, to the extent permitted by law. [debug]Type "show copying" and "show warranty" for details. [debug]This GDB was configured as "x86_64-linux-gnu". [debug]Type "show configuration" for configuration details. [debug]For bug reporting instructions, please see: [debug]http://www.gnu.org/software/gdb/bugs/. [debug]Find the GDB manual and other documentation resources online at: [debug]http://www.gnu.org/software/gdb/documentation/. [debug]For help, type "help". [debug]Type "apropos word" to search for commands related to "word". [debug]>>>>>>cb_gdb: [debug]> set confirm off
Debugger name and version: GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
[debug]>>>>>>cb_gdb: [debug]> set width 0 [debug]>>>>>>cb_gdb: [debug]> set height 0 [debug]>>>>>>cb_gdb: [debug]> set breakpoint pending on [debug]>>>>>>cb_gdb: [debug]> set print asm-demangle on [debug]>>>>>>cb_gdb: [debug]> set unwindonsignal on [debug]>>>>>>cb_gdb: [debug]> set print elements 200 [debug]>>>>>>cb_gdb: [debug]> set filename-display absolute [debug]>>>>>>cb_gdb: [debug]> set disassembly-flavor intel [debug]>>>>>>cb_gdb: [debug]> catch throw [debug]Catchpoint 1 (throw) [debug]>>>>>>cb_gdb: [debug]> source /usr/bin/pp.gdb [debug]/usr/bin/pp.gdb: No such file or directory. [debug]>>>>>>cb_gdb: [debug]> directory /home/graeme/code/cpp/circuit/regex/ [debug]Source directories searched: /home/graeme/code/cpp/circuit/regex:$cdir:$cwd [debug]>>>>>>cb_gdb: [debug]> set args opAmpCinPole.log [debug]>>>>>>cb_gdb: [debug]> tbreak "/home/graeme/code/cpp/circuit/regex/src/regex.cc:5" [debug]Temporary breakpoint 2 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5. [debug]>>>>>>cb_gdb: [debug]> tty /dev/pts/0 [debug]>>>>>>cb_gdb: [debug]> run [debug]Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex opAmpCinPole.log [debug]Temporary breakpoint 2, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5 [debug]/home/graeme/code/cpp/circuit/regex/src/regex.cc:5:79:beg:0x555555558d75 [debug]>>>>>>cb_gdb:
At /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
[debug]> show language [debug]The current source language is "auto; currently c++". [debug]>>>>>>cb_gdb: [debug]> info locals
Debugger finished with status 1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems gdb is crashing on info locals. What happens if you execute this command in the console session? Can you try to disable locals/function args in the debugger settings and try again?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
~/code/cpp/circuit/regex$ gdb ./bin/Debug/regex
.........
Reading symbols from ./bin/Debug/regex...done.
(gdb) b 5
Breakpoint 1 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5.
(gdb) r
Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Breakpoint 1, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
5 std::cout << std::regex_match("xxx", s) << '\n';
(gdb) info locals
Segmentation fault (core dumped)
Code::blocks menu->settings->Debugger->Default->Uncheck "Watch local variables" ( Watch function arguments still checked ) ---> No crash
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You could try to update your gdb and see if the problem has been fixed in the new version. If it hasn't been fixed - reporting it to the gdb people might be a good idea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What do you mean works with any other class?
What do you mean by "works in terminal"?
In this example the compiler is allowed to generate 0 code, because
r
doesn't have any side effects.Are you building with optimizations enabled?
Posting full compiler and debugger logs might be useful (you have to enabled these in the settings).
If I print my match it shouldn't optimize it away?
Change regex to string and it works
Works in terminal:
~/code/cpp/circuit/regex$ gdb ./bin/Debug/regex
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/Debug/regex...done.
(gdb) b 5
Breakpoint 1 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5.
(gdb) r
Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Breakpoint 1, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
5 std::cout << std::regex_match("xxx", s) << '\n';
(gdb) n
0
4 const std::regex s("x");
(gdb)
6 }
(gdb)
__libc_start_main (main=0x555555558d45 <main()>, argc=1, argv=0x7fffffffde38,
init=<optimized out="">, fini=<optimized out="">, rtld_fini=<optimized out="">,
stack_end=0x7fffffffde28) at ../csu/libc-start.c:344
344 ../csu/libc-start.c: No such file or directory.
(gdb)
[Inferior 1 (process 4307) exited normally]
(gdb) </optimized></optimized></optimized></main()>
Build log
Build started on: 31-12-2020 at 14:44.15
Build ended on: 31-12-2020 at 14:44.17
-------------- Build: Debug in regex (compiler: GNU GCC Compiler)---------------
g++ -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Wunreachable-code -Wswitch-enum -Wmain -Wextra -Wall -fexceptions -finline-functions -fmax-errors=7 -fno-common -fshort-enums -std=c++2a -Wcast-qual -Wconversion -Werror -Wformat=2 -Winvalid-pch -Wno-long-long -Wno-missing-field-initializers -Wold-style-cast -Wpointer-arith -Wuninitialized -Wwrite-strings -g -c /home/graeme/code/cpp/circuit/regex/src/regex.cc -o obj/Debug/src/regex.o
g++ -o bin/Debug/regex obj/Debug/src/regex.o -lgsl -lgslcblas -lfmt
Output file is bin/Debug/regex with size 1.56 MB
Process terminated with status 0 (0 minute(s), 2 second(s))
0 error(s), 0 warning(s) (0 minute(s), 2 second(s))
Debug log:
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/graeme/code/cpp/circuit/regex/
Adding source dir: /home/graeme/code/cpp/circuit/regex/
Adding file: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Changing directory to: /home/graeme/code/cpp/circuit/regex/.
Set variable: LD_LIBRARY_PATH=.:
[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet -args /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
[debug]Working dir : /home/graeme/code/cpp/circuit/regex
Starting debugger: /usr/bin/gdb -nx -fullname -quiet -args /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Setting SHELL to '/bin/bash'
done
[debug]Reading symbols from /home/graeme/code/cpp/circuit/regex/bin/Debug/regex...
[debug]done.
[debug]> set prompt >>>>>>cb_gdb:
Setting breakpoints
[debug]Using sleep command's PID as console PID 4121, TTY /dev/pts/0
[debug]Queued:[tty /dev/pts/0]
debug >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
[debug]Copyright (C) 2018 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.
[debug]Type "show copying" and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]http://www.gnu.org/software/gdb/bugs/.
[debug]Find the GDB manual and other documentation resources online at:
[debug] http://www.gnu.org/software/gdb/documentation/.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set filename-display absolute
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/bin/pp.gdb
[debug]/usr/bin/pp.gdb: No such file or directory.
[debug]>>>>>>cb_gdb:
[debug]> directory /home/graeme/code/cpp/circuit/regex/
[debug]Source directories searched: /home/graeme/code/cpp/circuit/regex:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> set args opAmpCinPole.log
[debug]>>>>>>cb_gdb:
[debug]> tbreak "/home/graeme/code/cpp/circuit/regex/src/regex.cc:5"
[debug]Temporary breakpoint 2 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5.
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/0
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex opAmpCinPole.log
[debug]Temporary breakpoint 2, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
[debug]/home/graeme/code/cpp/circuit/regex/src/regex.cc:5:79:beg:0x555555558d75
[debug]>>>>>>cb_gdb:
At /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
[debug]> show language
[debug]The current source language is "auto; currently c++".
[debug]>>>>>>cb_gdb:
[debug]> info locals
Debugger finished with status 1
It seems gdb is crashing on
info locals
. What happens if you execute this command in the console session? Can you try to disable locals/function args in the debugger settings and try again?~/code/cpp/circuit/regex$ gdb ./bin/Debug/regex
.........
Reading symbols from ./bin/Debug/regex...done.
(gdb) b 5
Breakpoint 1 at 0x4d75: file /home/graeme/code/cpp/circuit/regex/src/regex.cc, line 5.
(gdb) r
Starting program: /home/graeme/code/cpp/circuit/regex/bin/Debug/regex
Breakpoint 1, main () at /home/graeme/code/cpp/circuit/regex/src/regex.cc:5
5 std::cout << std::regex_match("xxx", s) << '\n';
(gdb) info locals
Segmentation fault (core dumped)
Code::blocks menu->settings->Debugger->Default->Uncheck "Watch local variables" ( Watch function arguments still checked ) ---> No crash
OK, closing as invalid.
You could try to update your gdb and see if the problem has been fixed in the new version. If it hasn't been fixed - reporting it to the gdb people might be a good idea.
Compiled and installed gdb 9.2, problem fixed, thank you.