[Help] Unable to profile app with valgrind [answered]
I want to profile the heap of my app using valgrind, but the app does not launch and will terminate/crash everytime.
A quick research tells me that this appears to be a known issue for programs using the library libcrypto.so
.
Is there a way to successfully profile the app using valgrind, e.g. by preventing the app from being killed from SIGILL
? And how to do so?
I tried to profile the app on my Sony Xperia XA2 and on my Jolla Tablet, both via terminal and via the SFOS-SDK and none worked.
Terminal output:
,---
| Sailfish OS 3.0.3.9 (Hossa)
'---
[nemo@Sailfish ~]$ valgrind --leak-check=yes --gen-suppressions=all --track-origins=yes --leak-check=full harbour-app
==20226== Memcheck, a memory error detector
==20226== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==20226== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==20226== Command: harbour-app
[...]
==20226== Conditional jump or move depends on uninitialised value(s)
==20226== at 0x8DF8C3C: ??? (in /odm/lib/libgsl.so)
==20226== Uninitialised value was created by a stack allocation
==20226== at 0x8DFB15C: ??? (in /odm/lib/libgsl.so)
==20226==
{
<insert_a_suppression_name_here>
Memcheck:Cond
obj:/odm/lib/libgsl.so
}
disInstr(thumb): unhandled instruction: 0xEBAD 0x1CCA
==20226== valgrind: Unrecognised instruction at address 0xdc7d23d.
==20226== at 0xDC7D23C: bsaes_ctr32_encrypt_blocks (in /lib/libcrypto.so.1.0.2o+git2)
==20226== Your program just tried to execute an instruction that Valgrind
==20226== did not recognise. There are two possible reasons for this.
==20226== 1. Your program has a bug and erroneously jumped to a non-code
==20226== location. If you are running Memcheck and you just saw a
==20226== warning about a bad jump, it's probably your program's fault.
==20226== 2. The instruction is legitimate but Valgrind doesn't handle it,
==20226== i.e. it's Valgrind's fault. If you think this is the case or
==20226== you are not sure, please let us know and we'll try to fix it.
==20226== Either way, Valgrind will now raise a SIGILL signal which will
==20226== probably kill your program.
==20226==
==20226== Process terminating with default action of signal 4 (SIGILL)
==20226== Illegal opcode at address 0xDC7D23D
==20226== at 0xDC7D23C: bsaes_ctr32_encrypt_blocks (in /lib/libcrypto.so.1.0.2o+git2)
==20226==
==20226== HEAP SUMMARY:
[...]
==20226==
==20226== For counts of detected and suppressed errors, rerun with: -v
==20226== ERROR SUMMARY: 430 errors from 170 contexts (suppressed: 0 from 0)
Illegal instruction
[nemo@Sailfish ~]$
Could you provide a test project and/or binary? I've been trying to reproduce this without luck.
vige ( 2019-05-28 10:40:28 +0200 )edit@vige Create a SFOS application from the template inside the Application SDK and put the following code into the main:
Alex ( 2019-05-30 14:27:43 +0200 )editThanks. With the code above I was able to reproduce and verify that the patch really works.
vige ( 2019-06-04 13:21:06 +0200 )editFix is now included in 3.2.0 release
Ville Nummela ( 2019-11-01 08:14:33 +0200 )edit