Ticket #39192

Unable to debug C++

Open Date: 2019-05-03 14:37 Last Update: 2019-05-03 20:38

Reporter:
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Invalid
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

When debugging i notices, that certain functions who throw are unable to show a backtrace. Gdb shows an like: Backtrace stopped: previous frame inner to this frame (corrupt stack?) All posix sjlj gcc versions are affected except seh. Here are the steps to reproduce:

λ cat main.cpp

  1. #include <stdexcept>
  2. void
  3. dummy()
  4. {
  5. volatile int i = 0;
  6. }
  7. bool
  8. expectTrue( bool value )
  9. {
  10. dummy();
  11. if ( !static_cast<bool>( value ) )
  12. {
  13. throw std::runtime_error("value failed");
  14. }
  15. dummy();
  16. return value;
  17. }
  18. int
  19. main( int argc, char** argv )
  20. {
  21. dummy();
  22. expectTrue( true );
  23. dummy();
  24. }

λ gcc --version

gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
λ g++ -g -O0 main.cpp -o main

λ gdb ./main

GNU gdb (GDB) 8.0.1
Copyright (C) 2017 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-w64-mingw32".
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 ./main...done.
(gdb) break dummy
Breakpoint 1 at 0x401578: file main.cpp, line 7.
(gdb) run
Starting program: C:\Users\mdr\Entwicklung\stackTest\main.exe
[New Thread 5844.0x1d58]
[New Thread 5844.0x1320]
[New Thread 5844.0x2334]
[New Thread 5844.0x1750]

Thread 1 hit Breakpoint 1, dummy () at main.cpp:7
7               volatile int i = 0;
(gdb) backtrace
#0  dummy () at main.cpp:7
#1  0x0000000000401728 in main (argc=1, argv=0x25d1d20) at main.cpp:28
(gdb) continue
Continuing.

Thread 1 hit Breakpoint 1, dummy () at main.cpp:7
7               volatile int i = 0;
(gdb) backtrace
#0  dummy () at main.cpp:7
#1  0x0000000000401626 in expectTrue (value=true) at main.cpp:13
#2  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) continue
Continuing.

Thread 1 hit Breakpoint 1, dummy () at main.cpp:7
7               volatile int i = 0;
(gdb) backtrace
#0  dummy () at main.cpp:7
#1  0x000000000040167b in expectTrue (value=true) at main.cpp:20
#2  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) continue
Continuing.

Thread 1 hit Breakpoint 1, dummy () at main.cpp:7
7               volatile int i = 0;
(gdb) backtrace
#0  dummy () at main.cpp:7
#1  0x0000000000401737 in main (argc=1, argv=0x25d1d20) at main.cpp:30
(gdb) continue
Continuing.
[Thread 5844.0x1750 exited with code 0]
[Thread 5844.0x1320 exited with code 0]
[Thread 5844.0x2334 exited with code 0]
[Inferior 1 (process 5844) exited normally]
(gdb)

Ticket History (2/2 Histories)

2019-05-03 14:37 Updated by: maxdrechsler
  • New Ticket "Unable to debug C++" created
2019-05-03 20:38 Updated by: keith
  • Resolution Update from None to Invalid
  • Status Update from Open to Closed
Comment

gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 7.2.0

Not our product. Illegally branded, due to unauthorized use of our registered trademark. Not our problem. Can't help you.

Attachment File List

No attachments

Edit

Please login to add comment to this ticket » Login