Re: why does assert(0) corrupt the stack trace?
Jan Kratochvil <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 05 Nov 2017 20:13:20 +0100, wrote: > I have a question about debugging assert in gdb. When one program > crash at one assert statement, the stack trace shown in the gdb is > corrupted. Is it normal? It was happening in the past as when assert() detects a failure it calls abort() which does never return - using GCC attribute noreturn. Then GCC optimizer does not save enough registers to make the backtrace possible because the code will just abort anyway, the code does not need to know where to return. It was some intermediate development phase where such optimization was created and before an exception has been made to make the backtracing by debuggers possible. Sorry for not looking up the Bugs/commits. As usual you should update your compiler + debugger to latest versions. Jan