Discussion:
[Qt-creator] What's the crash?
Jason H
2018-07-12 15:16:39 UTC
Permalink
When my program seg faults, bus errors, or divides by zero, I'm left at the offending line in the debugger. Is there a way to tell what exactly caused the crash without having to guess?
Jason H
2018-07-13 20:55:53 UTC
Permalink
Didn't there used to be some simple dialog that presented that information?
Sent: Thursday, July 12, 2018 at 11:16 AM
Subject: [Qt-creator] What's the crash?
When my program seg faults, bus errors, or divides by zero, I'm left at the offending line in the debugger. Is there a way to tell what exactly caused the crash without having to guess?
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
Nikos Chantziaras
2018-07-14 04:27:29 UTC
Permalink
Post by Jason H
When my program seg faults, bus errors, or divides by zero, I'm left at the offending line in the debugger. Is there a way to tell what exactly caused the crash without having to guess?
You need to do a debug build of your application and then start it in
the debugger (just press F5.) This will give you the line of the crash
but also a backtrace to see how you got to that current line.
Vadim Peretokin
2018-07-14 06:22:35 UTC
Permalink
Yes, but how do you get the actual crash reason?
Post by Jason H
Post by Jason H
When my program seg faults, bus errors, or divides by zero, I'm left at
the offending line in the debugger. Is there a way to tell what exactly
caused the crash without having to guess?
You need to do a debug build of your application and then start it in
the debugger (just press F5.) This will give you the line of the crash
but also a backtrace to see how you got to that current line.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
a***@gmx.de
2018-07-14 07:22:09 UTC
Permalink
Hi all,
Post by Vadim Peretokin
Yes, but how do you get the actual crash reason?
You need to inspect the backtrace. You have the local variables for each function on the stack, and this should give you some insight.

There's nothing more the debugger or C++ can do for you here.

Regards, Andre
Post by Vadim Peretokin
Post by Jason H
Post by Jason H
When my program seg faults, bus errors, or divides by zero, I'm left at
the offending line in the debugger. Is there a way to tell what exactly
caused the crash without having to guess?
You need to do a debug build of your application and then start it in
the debugger (just press F5.) This will give you the line of the crash
but also a backtrace to see how you got to that current line.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Von meinem Jolla gesendet
Jason H
2018-07-16 14:05:55 UTC
Permalink
Post by a***@gmx.de
There's nothing more the debugger or C++ can do for you here.
But it does at the command line:
Process 79112 launched: '/Users/jhihn/Projects/test_crash/a.out' (x86_64)
Process 79112 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
frame #0: 0x0000000100000fad a.out`main at main.c:7
4 {
5 int a = 2;
6 int b = 0;
-> 7 return a/b;


I'm pretty sure I remember some dialog appearing saying something about SIGSEGV (or in this case EXC_ARITHMETIC)?

MS gives this: Loading Image...
I thought earlier versions of QtC had something simular.

The difference is:

int *a, *b; *b=0;
return *a / *b;

Here, the problem could be that 'a' is out of process space, or 'b' is 0. If 'a' is a pointer, I don't necessarily know what my address range is. I have to deduce (and risk being wrong) what the actual crash was, meaning I could waste time going down the wrong path.
Nikos Chantziaras
2018-07-16 14:37:21 UTC
Permalink
Seems to be working fine here:

Loading Image...
Post by Jason H
Post by a***@gmx.de
There's nothing more the debugger or C++ can do for you here.
Process 79112 launched: '/Users/jhihn/Projects/test_crash/a.out' (x86_64)
Process 79112 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
frame #0: 0x0000000100000fad a.out`main at main.c:7
4 {
5 int a = 2;
6 int b = 0;
-> 7 return a/b;
I'm pretty sure I remember some dialog appearing saying something about SIGSEGV (or in this case EXC_ARITHMETIC)?
MS gives this: https://user-images.githubusercontent.com/10531631/36583169-c65d48ea-1874-11e8-90db-1a651cfd09f5.png
I thought earlier versions of QtC had something simular.
int *a, *b; *b=0;
return *a / *b;
Here, the problem could be that 'a' is out of process space, or 'b' is 0. If 'a' is a pointer, I don't necessarily know what my address range is. I have to deduce (and risk being wrong) what the actual crash was, meaning I could waste time going down the wrong path.
Andy
2018-07-16 14:41:34 UTC
Permalink
FWIW I do (sometimes?) get a dialog like Nikos (MSVC 2017):

[image: 2018-07-16 10_29_04-Exception Triggered.jpg]

(What's "The inferior"?)

Once that's dismissed, however, the only place I can find the info is
digging through the debugger log.

It would be useful to indicate in the thread menu which thread crashed
along with the reason. Maybe add to the menu entry:

"#0 - crashed (division by zero)"

or something like that.

---
Andy Maloney // https://asmaloney.com
Post by Nikos Chantziaras
https://i.imgur.com/OfFSAk5.png
Post by Jason H
Post by a***@gmx.de
There's nothing more the debugger or C++ can do for you here.
Process 79112 launched: '/Users/jhihn/Projects/test_crash/a.out' (x86_64)
Process 79112 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason =
EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
Post by Jason H
frame #0: 0x0000000100000fad a.out`main at main.c:7
4 {
5 int a = 2;
6 int b = 0;
-> 7 return a/b;
I'm pretty sure I remember some dialog appearing saying something about
SIGSEGV (or in this case EXC_ARITHMETIC)?
https://user-images.githubusercontent.com/10531631/36583169-c65d48ea-1874-11e8-90db-1a651cfd09f5.png
Post by Jason H
I thought earlier versions of QtC had something simular.
int *a, *b; *b=0;
return *a / *b;
Here, the problem could be that 'a' is out of process space, or 'b' is
0. If 'a' is a pointer, I don't necessarily know what my address range is.
I have to deduce (and risk being wrong) what the actual crash was, meaning
I could waste time going down the wrong path.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
Jason H
2018-07-16 21:11:21 UTC
Permalink
Yes!! I wonder why I don't get that anymore?
Sent: Monday, July 16, 2018 at 10:37 AM
Subject: Re: [Qt-creator] What's the crash?
https://i.imgur.com/OfFSAk5.png
Post by Jason H
Post by a***@gmx.de
There's nothing more the debugger or C++ can do for you here.
Process 79112 launched: '/Users/jhihn/Projects/test_crash/a.out' (x86_64)
Process 79112 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
frame #0: 0x0000000100000fad a.out`main at main.c:7
4 {
5 int a = 2;
6 int b = 0;
-> 7 return a/b;
I'm pretty sure I remember some dialog appearing saying something about SIGSEGV (or in this case EXC_ARITHMETIC)?
MS gives this: https://user-images.githubusercontent.com/10531631/36583169-c65d48ea-1874-11e8-90db-1a651cfd09f5.png
I thought earlier versions of QtC had something simular.
int *a, *b; *b=0;
return *a / *b;
Here, the problem could be that 'a' is out of process space, or 'b' is 0. If 'a' is a pointer, I don't necessarily know what my address range is. I have to deduce (and risk being wrong) what the actual crash was, meaning I could waste time going down the wrong path.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
André Hartmann
2018-07-16 15:27:03 UTC
Permalink
Hi Jason,
Post by Jason H
Post by a***@gmx.de
There's nothing more the debugger or C++ can do for you here.
My comment refered to something like this in your code:

QList<int> data;
data[0] = 123;

That will crash in qlist.cpp with index out of range, and not in your
code. Therefore it is not immediately obvious what causes the crash. But
with the stack trace you can find the guilty function.

It's up to you to inspect the stack though. If global variables are
involved, things might get more complicated.
https://user-images.githubusercontent.com/10531631/36583169-c65d48ea-1874-11e8-90db-1a651cfd09f5.png
Post by Jason H
I thought earlier versions of QtC had something simular.
Are you working with a debug version of your program?

Regards,
André
Post by Jason H
Process 79112 launched: '/Users/jhihn/Projects/test_crash/a.out' (x86_64)
Process 79112 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
frame #0: 0x0000000100000fad a.out`main at main.c:7
4 {
5 int a = 2;
6 int b = 0;
-> 7 return a/b;
I'm pretty sure I remember some dialog appearing saying something about SIGSEGV (or in this case EXC_ARITHMETIC)?
MS gives this: https://user-images.githubusercontent.com/10531631/36583169-c65d48ea-1874-11e8-90db-1a651cfd09f5.png
I thought earlier versions of QtC had something simular.
int *a, *b; *b=0;
return *a / *b;
Here, the problem could be that 'a' is out of process space, or 'b' is 0. If 'a' is a pointer, I don't necessarily know what my address range is. I have to deduce (and risk being wrong) what the actual crash was, meaning I could waste time going down the wrong path.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
Loading...