Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #7

Open
huseyinkozan opened this issue Dec 4, 2019 · 5 comments
Open

Linux support #7

huseyinkozan opened this issue Dec 4, 2019 · 5 comments

Comments

@huseyinkozan
Copy link
Contributor

Hi,

I tried my development env which is Ubuntu 16.04 64bit, and got some problems. I got prebuilt Qt 5.12 which installed by Qt installer.

First, line endings are not LF. Editing and sending to git may cause problems, so did not try to add a PR.

Could not catch divide by zero, so tried with access violation.

stack_t have different order than you initialized. Got asmCrashReportExample: sigaltstack: Invalid argument error. I have fixed by adding a correct ordered initialization.

With SA_ONSTACK, does not call handler at access violation. Also, cannot catch stack overflow with or without SA_ONSTACK.

diff --git a/src/asmCrashReport.cpp b/src/asmCrashReport.cpp
index 3799d11..bfbcc89 100644
--- a/src/asmCrashReport.cpp
+++ b/src/asmCrashReport.cpp
@@ -391,7 +391,11 @@ namespace asmCrashReport
    void _posixSetupSignalHandler()
    {
       // setup alternate stack
-      stack_t ss{ static_cast<void*>(sAlternateStack), SIGSTKSZ, 0 };
+#ifdef Q_OS_LINUX^M
+      stack_t ss {static_cast<void*>(sAlternateStack), 0, SIGSTKSZ};^M
+#else^M
+      stack_t ss {static_cast<void*>(sAlternateStack), SIGSTKSZ, 0};^M
+#endif^M
 
       if ( sigaltstack( &ss, nullptr ) != 0 )
       {
@@ -409,7 +413,8 @@ namespace asmCrashReport
       // backtrace() doesn't work on macOS when we use an alternate stack
       sigAction.sa_flags = SA_SIGINFO;
 #else
-      sigAction.sa_flags = SA_SIGINFO | SA_ONSTACK;
+      // sigAction.sa_flags = SA_SIGINFO | SA_ONSTACK;  // _posixSignalHandler does not called with SA_ONSTACK^M
+      sigAction.sa_flags = SA_SIGINFO;^M
 #endif
 
       if ( sigaction( SIGSEGV, &sigAction, nullptr ) != 0 ) { err( 1, "sigaction" ); }

I have checked sigaction.h and it seems disable. I tried to add below defines before csignal but no luck. Also, IDE shows _GNU_SOURCE already defined.

#define _XOPEN_SOURCE 700
#define _GNU_SOURCE

Here the catched output:

asmCrashReportTest v1.0.0
04 Ara 2019 @ 10:02:19

Caught SIGSEGV: Segmentation Fault

/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7fefff690390]
/home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_5_GCC_64bit-Release/asmCrashReportTest() [0x4028f1]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7feffed3d830]
@asmaloney
Copy link
Owner

There's a PR for Linux support with gcc 64-bit: #10

Does this work for you?

@huseyinkozan
Copy link
Contributor Author

huseyinkozan commented May 5, 2020

There's a PR for Linux support with gcc 64-bit: #10

Does this work for you?

Hi,
I have fetched the PR with git fetch origin pull/10/head:fixed-for-linux-gcc-64bit and run test project.
OS is same, Ubuntu 16.04 64bit. Qt is 5.12.6 64bit. Used QtCreator 5.14. GCC is 5.4.0.

Here is the results:

With arg 0: No report dialog, and no report on desktop.

23:10:27: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 0...
void crashTest::_divideByZero(int) 42
23:10:27: The program has unexpectedly finished.
23:10:27: The process was ended forcefully.
23:10:27: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

With arg 1: No report dialog, and no report on desktop.

23:10:47: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 1...
void crashTest::_accessViolation(int)
23:10:47: The program has unexpectedly finished.
23:10:47: The process was ended forcefully.
23:10:47: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

With arg 2: No report dialog, and no report on desktop.

23:13:34: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 2...
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
void crashTest::_stackoverflow()
23:13:34: The program has unexpectedly finished.
23:13:34: The process was ended forcefully.
23:13:35: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

With arg 3: No report dialog, and no report on desktop.

23:15:48: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 3...
void crashTest::_throwError()
Terminate handler called
23:15:48: The program has unexpectedly finished.
23:15:48: The process was ended forcefully.
23:15:48: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

With arg 4: No report dialog, and no report on desktop.

23:16:54: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 4...
void crashTest::_outOfBounds()
23:16:54: The program has unexpectedly finished.
23:16:54: The process was ended forcefully.
23:16:54: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

With arg 5: No report dialog, and no report on desktop.

23:17:45: Starting /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest 5...
void crashTest::_abort()
23:17:45: The program has unexpectedly finished.
23:17:45: The process was ended forcefully.
23:17:45: /home/hk/p/asmCrashReport/build-test-Desktop_Qt_5_12_6_GCC_64bit-Debug/asmCrashReportTest crashed.

@asmaloney
Copy link
Owner

There are two big differences between your setup and the PR - you have very old versions of Ubuntu and gcc. I wonder if that's part of the problem?

I don't have Linux installed anywhere to try this on.

(BTW - this commit fixed the line endings you mention in the original report.)

@huseyinkozan
Copy link
Contributor Author

Sorry for late response, I was waiting some free time to work on it.

I don't know if old OS cause the problem, but I dont thing so.

I will try if I find some free time. Thanks.

@Riflio
Copy link

Riflio commented Jun 9, 2020

Hi!
I believe the gcc version is too old. Now checked on 9.2.1 the dialogue and the log is.
Unfortunately, I can not check on gcc 5.4. because my system is not able to deliver it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants