Uwe Hermann [Sun, 1 Apr 2018 17:26:16 +0000 (19:26 +0200)]
CMakeLists.txt: Set CMake policy CMP0054 to NEW.
This prevents the following warnings upon a second cmake run:
CMake Warning (dev) at /usr/share/cmake-3.10/Modules/CMakePushCheckState.cmake:65 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "HAVE_CXX_ATOMICS_WITHOUT_LIB" will no longer be
dereferenced when the policy is set to NEW. Since the policy is not set
the OLD behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:123 (cmake_push_check_state)
CMakeLists.txt:139 (check_working_cxx_atomics)
This warning is for project developers. Use -Wno-dev to suppress it.
Gerhard Sittig [Tue, 2 Jan 2018 19:03:56 +0000 (20:03 +0100)]
DecodeSignal: Reset and re-use existing decoder sessions
Instead of destroying and re-creating decoder sessions, re-use
previously created sessions by just terminating their current work and
resetting internal state.
This implementation most proboably is incomplete in respect of changes
to the stack hierarchy or individual decoders' properties. This needs
more attention. When the stack is kept but its configuration has changed,
the involved properties need to get "somehow applied to" the stack's
instances before re-using it with new input data will yield correct results.
Dan Horák [Fri, 23 Mar 2018 20:33:18 +0000 (21:33 +0100)]
fix catching polymorphic types by value
Compiling with GCC 8 produces a new warning about catching polymorphic
types by value. Proper way is to use references instead.
/home/sharkcz/projects/pulseview/main.cpp: In function ‘int main(int, char**)’:
/home/sharkcz/projects/pulseview/main.cpp:229:22: error: catching polymorphic type ‘class std::exception’ by value [-Werror=catch-value=]
} catch (exception e) {
^
cc1plus: all warnings being treated as errors
Soeren Apel [Thu, 8 Mar 2018 23:28:42 +0000 (00:28 +0100)]
Fix #1125 by adding a missing typecast
Without this typecast, the return type of get_sample_count() is
a uint64_t, which doesn't go well when it's 0 and we subtract 1
from it. Assigning the result of this underflow to an int64_t
doesn't help, it's too late.
Soeren Apel [Mon, 12 Mar 2018 14:58:06 +0000 (15:58 +0100)]
SignalBase: Speed up conversion and prevent leaving samples unconverted
Unconverted samples can happen due to a race condition: being notified
of new samples coming in is ignored when the thread is already executing.
If these notifications however were the last ones sent out because the
segment was completed right after, the currently ongoing conversion
will finish but not be restarted with the final sample range.
Soeren Apel [Mon, 5 Mar 2018 22:45:46 +0000 (23:45 +0100)]
Fix #1132 by passing segment IDs, not segment instances
Passing segment instances fails because this creates a race condition.
When a long conversion is taking place, the SignalBase::samples_added
signal is called often but since it's in a separate thread, the calls
are queued and aren't executed immediately. Now if the conversion is
restarted - for example as a result of a changed conversion threshold -
then the segments holding the converted data are destroyed, rendering
the pointers submitted as parameters to samples_added invalid.
Once the signal queue is processed, those invalid pointers will be
accessed and PV segfaults.
Since the signal queue can neither be emptied nor flushed, this
leaves only two sensible choices:
1) Signal samples_added less often, thereby reducing the chance of
signals being queued
2) Supply the segment ID instead of the segment instance as that's
essentially the only thing we currently care about - in fact, the
only user of samples_added (ViewBase::on_samples_added) uses the
instance to query only this
As #1 is only a band-aid and not a waterproof solution, I chose
to go with #2.
Uwe Hermann [Sat, 10 Feb 2018 21:01:26 +0000 (22:01 +0100)]
MinGW: Fix a compile error due to a missing #include.
In file included from [...]/pv/globalsettings.cpp:20:0:
[...]/pv/globalsettings.hpp:31:12: error: 'std::function' has not been declared
using std::function;
^
test/CMakeFiles/pulseview-test.dir/build.make:88: recipe for target 'test/CMakeFiles/pulseview-test.dir/__/pv/globalsettings.cpp.obj' failed
make[2]: *** [test/CMakeFiles/pulseview-test.dir/__/pv/globalsettings.cpp.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 5%] Building CXX object CMakeFiles/pulseview.dir/pv/globalsettings.cpp.obj
In file included from [...]/pv/globalsettings.cpp:20:0:
[...]/pv/globalsettings.hpp:31:12: error: 'std::function' has not been declared
using std::function;
^
Add #include <functional> everywhere where std::function is used. Only
the occurence in globalsettings.hpp was causing an actual build failure
on MinGW, though.
Gerhard Sittig [Sun, 4 Feb 2018 13:54:32 +0000 (14:54 +0100)]
MainBar: fixup file extension filter in "Import File" dialog
The previous implementation used a "*" filter when a file of any other
format than srzip got imported. This happened to be a duplicate of
"All files", and ignored the list of filename extensions provided by
the input formats.
This change does respect the input format's file extensions, and copes
with the lack of such a list (raw binary), as well as lists that have
one (most formats), or multiple extensions (raw analog).
This fixes bug #1039.
Another byproduct of the change is that extensions and their decoration
(separators, parentheses) move outside of tr() calls. These technical
details shall not concern translators, and translations for human
languages shall not break the filter mechanism.
This implementation might be "too complex, computationally expensive".
But it works, and fixes an issue, and the code path executes seldom and
waits for user interaction anyway. Cost reduction can get applied later.
Gerhard Sittig [Sun, 28 Jan 2018 20:02:54 +0000 (21:02 +0100)]
DecodeSignal: only pass non-zero sample rate to decoders
As reported in bug #1118 not all input sources provide a samplerate, and
decoder instances may not cope with a rate spec of 0. Only pass non-zero
sample rates to the decoder stack. This improves robustness in addition
to the specific fix for #1118 in the decoders' implementations.
Gerhard Sittig [Wed, 24 Jan 2018 20:11:50 +0000 (21:11 +0100)]
main: introduce -D cmdline option, don't auto-scan for devices
Add a -D command line option which skips auto-detection of devices upon
startup. This can speedup program startup for setups with known devices,
and allows to skip the scan for troubled drivers which might break the
startup phase.
This -D option can be combined with -d specs, either presence or absence
of -d is acceptable when -D is specified. Users still can interactively
scan for and use devices after program startup.
Cenkron [Fri, 12 Jan 2018 18:43:27 +0000 (12:43 -0600)]
win32: Use -mwindows only for non-Debug targets.
Direct cmake to apply the -mwindows linker switch based on a cmake
command line argument rather than by using a patch file. The command
line argument is -DCMAKE_BUILD_TYPE=xxxxx and applies the linker switch
only to WIN32 builds that are not Debug.
Soeren Apel [Tue, 2 Jan 2018 10:07:36 +0000 (11:07 +0100)]
SignalBase: Don't terminate conversion when there's no data
Instead of terminating, we wait instead.
We do this because SignalBase::on_samples_added() somehow doesn't
reliably see that there's no conversion thread active anymore.
conversion_thread_.joinable() returns true when the thread was
already terminated for whatever reason, resulting in on_samples_added()
trying to notify a non-existant thread.
Soeren Apel [Wed, 27 Dec 2017 09:31:30 +0000 (10:31 +0100)]
DecodeSignal: Restructure metadata handling
Instead of handling the metadata separately from the mux/decode segments,
it's much neater to handle both together. Doing this also allows us to
remove the need for query_input_metadata() since we're taking the metadata
from the muxed logic segments.
Adjust trace view header width when signal names change
This change is primarily needed because before, newly
created decode signals had a name assigned to them at time
of the constructor call. This changed, and now the name
is empty upon creation, breaking the previously working
header size adjustment.
Fix #1024 by changing decode channel assigment to PDs
When assigning the decoder stack channels to the libsrd
instance's channels, channels that had no signal assigned
to them were still assigned anyway. This patch fixes this bug.
After doing this, another subtle bug became apparent:
The mapping between channels and bits in the data stream sent
to the PD was done via DecodeChannel->id. This is however
insufficient as the channels of the decoder stack have
IDs that may or may not match the ID needed for the data
stream. Example:
A PD has 4 channels: A, B, C and D. In PV, those channels
have the IDs 0, 1, 2 and 3. If the user only assigns A and D,
Decoder::create_decoder_inst() will use the IDs 0 and 3 as
the bit positions of those signals in the data stream sent
to libsrd. This is obviously wrong.
Hence, we now use a separate bit_id for this purpose.