EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Segmentation fault when setting motorStatusProblem_ to 1
From: Mark Rivers <[email protected]>
To: "'Sobhani, Bayan'" <[email protected]>, "[email protected]" <[email protected]>
Date: Thu, 1 Feb 2018 16:22:13 +0000

Ø  What is causing the segmentation fault to occur?

 

You need to obtain a stack trace when the fault occurs.  Are you running on Linux or Windows?  On Linux you can run your program under gdb and when it crashes type the gdb command “backtrace”.  On Windows you need to build for the –debug architecture and then you can use the Visual Studio debugger when it crashes.

 

Mark

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Sobhani, Bayan
Sent: Thursday, February 01, 2018 10:17 AM
To: [email protected]
Subject: Segmentation fault when setting motorStatusProblem_ to 1

 

Here is my polling function for the MCS2 driver I am developing:

 

asynStatus SmarActMCS2Axis::poll(bool* moving_p){

        int64_t val;

        comStatus_=getp(channel_,&val);

        if(comStatus_!=asynSuccess){

                *moving_p=false;

               asynPrint(c_p_->pasynUserSelf,ASYN_TRACE_ERROR,"Error reading axis, channel=%d, comstatus=%d!\n", channel_,comStatus_);

                //c_p_ is a pointer to the controller object

                //setIntegerParam(c_p_->motorStatusProblem_,1);

                setIntegerParam(c_p_->motorStatusCommsError_,1);

                callParamCallbacks();

                return asynError;

        }

        val=val/1000;

        setDoubleParam(c_p_->motorEncoderPosition_,(double)val);

        setDoubleParam(c_p_->motorPosition_,(double)val);

        if(is_moving(channel_)==true){

                *moving_p=true;

        }

        else{

                *moving_p=false;

        }

        setIntegerParam(c_p_->motorStatusProblem_,0);

        setIntegerParam(c_p_->motorStatusCommsError_,0);

 

        setIntegerParam(c_p_->motorStatusMoving_,*moving_p);

        setIntegerParam(c_p_->motorStatusDone_, ! *moving_p);

        callParamCallbacks();

        return asynSuccess;

}

 

Notice that “setIntegerParam(c_p_->motorStatusProblem_,1);” is commented out because when I uncomment it, it causes the IOC to have a segmentation fault when I attempt to move an axis that is not connected. Surprisingly, “setIntegerParam(c_p_->motorStatusCommsError_,1);” does not cause the IOC to have a segmentation fault, and as expected raises a COMM alarm when I attempt to move an axis that is not connected. motorStatusProblem and motorStatusCommsError are not referenced anywhere else inside my code. What is causing the segmentation fault to occur?

 

Alex


Replies:
RE: Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan
References:
Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan

Navigate by Date:
Prev: Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan
Next: RE: Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan
Next: RE: Segmentation fault when setting motorStatusProblem_ to 1 Sobhani, Bayan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
ANJ, 01 Feb 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·