Bug 1150 - Enabling boost::stacktrace corrupts srd session ID
Summary: Enabling boost::stacktrace corrupts srd session ID
Alias: None
Product: PulseView
Classification: Unclassified
Component: Other (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
Depends on:
Blocks: 1209
  Show dependency treegraph
Reported: 2018-04-05 22:29 CEST by Soeren Apel
Modified: 2020-05-02 23:51 CEST (History)
2 users (show)

Patch to enable stacktrace completely (1.61 KB, patch)
2020-04-18 00:19 CEST, Wolfram Sang

Note You need to log in before you can comment on or make changes to this bug.
Description Soeren Apel 2018-04-05 22:29:05 CEST
When enabling boost::stacktrace on linux via -DENABLE_STACKTRACE=y, running a PD and closing PV results in a segfault:

--- stop_srd_session() called for 0xadc005b8 with session ID -1379921704
srd: Invalid session.
*** Error in `build/bin/pulseview': free(): invalid pointer: 0x0a5bfa48 ***
======= Backtrace: =========

Without boost::stacktrace, the session ID for the PD is always 1 and there's no issue when closing PV. With it, the session ID is consistently -1379921704 (at least on my machine), causing the error above.
Comment 1 Wolfram Sang 2020-04-15 01:11:00 CEST
Can't reproduce with today's build (1db57c03). I loaded the SR-file 'st_m24c02_powerup_and_reset.sr' from the dumps-repo and attached the I2C decoder to it, then closed PulseView -> no crash. Stacktraces are enabled ('Stack trace file is "/tmp/pv_stacktrace.dmp"'). Anything else I could try?
Comment 2 Soeren Apel 2020-04-15 08:25:35 CEST
Thanks for revisiting this bug but I don't think boost::stacktrace is enabled in any of the public builds at the moment because boost::stacktrace can't resolve the symbol names, which needs solving before we can roll out this feature.

It's enabled by cmake -DENABLE_STACKTRACE.
Comment 3 Wolfram Sang 2020-04-18 00:19:20 CEST
Created attachment 622 [details]
Patch to enable stacktrace completely

I enabled stacktrace with the attached patch (which is under discussion on the mailing list), but I still can't reproduce the above error. I took a larger file from the dumps repo and closed pv when the decoder was still decoding, but all went fine for me.
Comment 4 Uwe Hermann 2020-05-02 23:51:39 CEST
Merged in b409dfdc01ed36b54f5b8a70b3738146a26bf37e, thanks!

I can confirm that it builds fine with cmake 3.16.3 and Boost 1.71 on Debian (which does ship a libbacktrace).

No segfaults or corrupted session IDs in a few quick tests for me, either.