Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4e7d62f2b9f9
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7219fe768465
Choose a head ref
  • 1 commit
  • 5 files changed
  • 1 contributor

Commits on Sep 24, 2020

  1. Fixed some valgrind errors. Fixed inconsistent sizeof in TektronixOsc…

    …illoscope object creation via a workaround that makes no sense.
    azonenberg committed Sep 24, 2020
    Copy the full SHA
    7219fe7 View commit details
Showing with 37 additions and 12 deletions.
  1. +21 −3 scopehal/Oscilloscope.h
  2. +5 −5 scopehal/SCPILxiTransport.cpp
  3. +5 −0 scopehal/TektronixOscilloscope.cpp
  4. +1 −1 scopehal/TektronixOscilloscope.h
  5. +5 −3 scopeprotocols/OFDMDemodulator.cpp
24 changes: 21 additions & 3 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -577,11 +577,29 @@ class Oscilloscope : public virtual Instrument
static CreateMapType m_createprocs;
};

#define STRINGIFY(T) #T

/*
For some reason, certain classes don't like being created with OSCILLOSCOPE_INITPROC.
sizeof(T) has inconsistent values between .h and .cpp and we get memory bounds errors writing off the end of a
too-small memory block in the constructor.
If this happens use OSCILLOSCOPE_INITPROC_H in the header and OSCILLOSCOPE_INITPROC_CPP in the source.
The cause of this is currently unknown but this workaround shows no errors in valgrind and doesn't crash sooo...
*/
#define OSCILLOSCOPE_INITPROC_H(T) \
static Oscilloscope* CreateInstance(SCPITransport* transport); \
virtual std::string GetDriverName() \
{ return GetDriverNameInternal(); }

#define OSCILLOSCOPE_INITPROC_CPP(T) \
Oscilloscope* T::CreateInstance(SCPITransport* transport) \
{ return new T(transport); }

#define OSCILLOSCOPE_INITPROC(T) \
static Oscilloscope* CreateInstance(SCPITransport* transport) \
{ \
return new T(transport); \
} \
{ return new T(transport); } \
virtual std::string GetDriverName() \
{ return GetDriverNameInternal(); }

10 changes: 5 additions & 5 deletions scopehal/SCPILxiTransport.cpp
Original file line number Diff line number Diff line change
@@ -29,10 +29,10 @@

/**
@file
@author Tom Verbeure
@author Tom Verbeure
@brief Implementation of SCPILxiTransport
*/

#ifdef HAS_LXI

extern "C"
@@ -81,8 +81,8 @@ SCPILxiTransport::SCPILxiTransport(string args)
strcpy(instname_dup, "inst0");

m_device = lxi_connect(hostname_dup, m_port, instname_dup, m_timeout, VXI11);
delete hostname_dup;
delete instname_dup;
delete[] hostname_dup;
delete[] instname_dup;

if (m_device == LXI_ERROR)
{
@@ -225,4 +225,4 @@ bool SCPILxiTransport::IsCommandBatchingSupported()
return false;
}

#endif
#endif
5 changes: 5 additions & 0 deletions scopehal/TektronixOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -36,11 +36,16 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

OSCILLOSCOPE_INITPROC_CPP(TektronixOscilloscope)

TektronixOscilloscope::TektronixOscilloscope(SCPITransport* transport)
: SCPIOscilloscope(transport)
, m_triggerArmed(false)
, m_triggerOneShot(false)
{
//DEBUG
LogDebug("sizeof(TektronixOscilloscope) = %zu\n", sizeof(TektronixOscilloscope));

/*
//Last digit of the model number is the number of channels
std::string model_number = m_model;
2 changes: 1 addition & 1 deletion scopehal/TektronixOscilloscope.h
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ class TektronixOscilloscope : public SCPIOscilloscope

public:
static std::string GetDriverNameInternal();
OSCILLOSCOPE_INITPROC(TektronixOscilloscope)
OSCILLOSCOPE_INITPROC_H(TektronixOscilloscope)
};

#endif
8 changes: 5 additions & 3 deletions scopeprotocols/OFDMDemodulator.cpp
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ void OFDMDemodulator::Refresh()
//Not implemented, do nothing
SetData(NULL, 0);
return;

/*
//Make sure we've got valid inputs
if(!VerifyAllInputsOKAndAnalog())
{
@@ -321,11 +321,13 @@ void OFDMDemodulator::Refresh()
}
driftPer800ns /= 12;
ampScale /= 12;
float driftPerSymbol = 5 * driftPer800ns;
//Skip 1.6us (32 sample) guard interval
imax += 32;
startingPhase += 2*driftPer800ns;
*/

//We should now have two OFDM BPSK training symbols with no guard interval
//Carrier in columns 8, 12, 16, 20, 24, 40, 44, 48, 52, 56, 60??
@@ -360,8 +362,8 @@ void OFDMDemodulator::Refresh()
}*/

//Skip these training symbols
imax += 128;
startingPhase += 8*driftPer800ns;
//imax += 128;
//startingPhase += 8*driftPer800ns;

//Actual symbol data
/*