summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcrashhandler_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QTest::CrashHandler: print the Unix signal si_code nameThiago Macieira2025-06-121-1/+140
| | | | | | | | | | | | | | It's easier to interpret an "SEGV_MAPERR", "FPE_INTDIV", or "ILL_ILLOPC" rather than "code 1". Alongside the decoded instruction pointer from the previous commit, we now get a message like: Received signal 11 (SIGSEGV), code SEGV_MAPERR, at address 0x00005637dd5c1346, for address 0x0000000000000004 Change-Id: Ic9f54e06fd2956fea3ccfffde7aa7b54167333b7 Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QTest::CrashHandler: extract the address of the crashing instructionThiago Macieira2025-05-251-1/+40
| | | | | | | | | | | | | | | | | | | | | | From the user and machine context provided in the signal handler. Linux w/ GDB prints: 0x563bb2ab7346 <_ZN11tst_Crashes5crashEv+28>: movl $0x1,(%rax) FreeBSD w/ LLDB prints: (lldb) x/i 0x0000319a0ae86996 0x319a0ae86996: c7 40 04 01 00 00 00 other movl $0x1, 0x4(%rax) macOS w/ LLDB prints (after disabling the check for SIP): (lldb) x/i 0x00000001054086c8 0x1054086c8: movl $0x1, 0x4(%rax) Done-With: Samuel Gaist Done-With: Ivan Solovev Change-Id: Iac02025b1922b6b4d927fffd3efe210ef51fc759 Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Samuel Gaist <[email protected]>
* QTest::CrashHandler: prepare to disassemble the crashing instructionThiago Macieira2025-05-251-11/+35
| | | | | | | | This is the infrastructure code, without actually getting the instruction pointer from the machine context. Change-Id: Iadd2c78913b2d0177949fffdeafa12e9fc3daf87 Reviewed-by: Edward Welbourne <[email protected]>
* QTest::CrashHandler: switch to execvp() instead of execlp()Thiago Macieira2025-05-251-5/+24
| | | | | | | | There will be variable options. Change-Id: Ie633615daeac87e8bd2cfffd962666a85d91d5cd Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QTest::CrashHandler: add asyncSafeToHexString()Thiago Macieira2025-05-231-6/+17
| | | | | | | | | Extracted from existing code; I'm going to need it for some GDB/LLDB commands in an upcoming commit. Change-Id: I7bdb7ef287ecd924df5cfffdc5aa3617540f7756 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QTest::CrashHandler: use string_view for writeToStderr() for the inputsThiago Macieira2025-05-231-18/+9
| | | | | | | | | | For regular strings, it'll call strlen() for us, removing the need of our doing it. We just have to remove the one case where we were passing iovec into it: make asyncSafeToString() return a string_view too. Change-Id: I7d17e5c4525637df23f1fffd5e5c381632386f49 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QTest::CrashHandler: reorganize Unix header blocksThiago Macieira2025-05-231-18/+19
| | | | | | Change-Id: Ib45e7e913fcc2e00f198fffdcc216e9f74c97e15 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QTest::CrashHandler: move the enum definition to the headerThiago Macieira2025-05-231-3/+0
| | | | | | | | | It's common between the two implementations, though currently completely unused on Windows because we don't start debuggers. Change-Id: I7a42db2db35cf6191693fffd3e4e46d482032630 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QTest::CrashHandler: move the Unix signal-handling code into the .cppThiago Macieira2025-05-231-18/+66
| | | | | | | | This further reduces the size of the header. Change-Id: I24a16daec8aed5a38e1ffffd812629cc7e7377f7 Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QTest::CrashHandler: move the Unix async-safe I/O code to the .cppThiago Macieira2025-05-231-11/+56
| | | | | | | | | | | | | | This declutters the header from code that doesn't need to be there and is only used in the .cpp anyway. This code used to be in qtestcase.cpp before commit c0014becca2cd376eadd5c8a0265e5cf47c9aa01, which we now amend. Additionally, since Windows code doesn't need to be async-safe anyway, we can simplify it. I'm also going to need the toHexString() lambda in another place. Change-Id: Ic9571bac864dfb31564cfffd785e8ab15cab3ae5 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QTest::CrashHandler: split into Unix and Windows (2/2)Thiago Macieira2025-05-231-166/+11
| | | | | | | | | | | | | | This file is convoluted and hard to read due to #if all over the place. Let's split the two very different implementations. This is the conclusion, which removes the Unix code from the Windows file and the Windows code from the Unix file. Drive-by remove the unnecessary header #includes. Change-Id: Iec7bd36d0aeabdc3c445fffd17bad22050c6b208 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QTest::CrashHandler: split into Unix and Windows (1/2)Thiago Macieira2025-05-231-0/+676
This file is convoluted and hard to read due to #if all over the place. Let's split the two very different implementations. This is the first commit, which just copies the files around without any changes, to help with Git history. Change-Id: I758dad7a07d927ccb61dfffd0199fb5e1e544c98 Reviewed-by: Edward Welbourne <[email protected]>