1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 <2018> 2019 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 <2018> 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Segmentation fault when setting motorStatusProblem_ to 1 |
From: | "Sobhani, Bayan" <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Thu, 1 Feb 2018 16:16:43 +0000 |
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 |