チケット #39192

Unable to debug C++

登録: 2019-05-03 14:37 最終更新: 2019-05-03 20:38

報告者:
担当者:
(未割り当て)
チケットの種類:
状況:
完了
コンポーネント:
(未割り当て)
マイルストーン:
(未割り当て)
優先度:
5 - 中
重要度:
5 - 中
解決法:
不正
ファイル:
なし
投票
点数: 0
No votes
0.0% (0/0)
0.0% (0/0)

詳細

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)

チケットの履歴 (2 件中 2 件表示)

2019-05-03 14:37 更新者: maxdrechsler
  • 新しいチケット "Unable to debug C++" が作成されました
2019-05-03 20:38 更新者: keith
  • 解決法なし から 不正 に更新されました
  • 状況オープン から 完了 に更新されました
コメント

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.

添付ファイルリスト

添付ファイルはありません

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする