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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Segmentation fault when setting motorStatusProblem_ to 1 |
From: | "Sobhani, Bayan" <[email protected]> |
To: | Mark Rivers <[email protected]>, "[email protected]" <[email protected]> |
Date: | Thu, 1 Feb 2018 18:32:31 +0000 |
How exactly do i run the IOC from gdb? When the IOC is running ps -A shows two processes called st.cmd. I do gdp -p [PID] then make the IOC crash by typing dbpf {...}Mtr 1234, but
I get the same result as when I type backtrace without crashing the IOC:
0 0x00007fd1d8545bbd in read () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007fd1d7df2b7d in rl_getc ()
from /lib/x86_64-linux-gnu/libreadline.so.6
#2 0x00007fd1d7df3447 in rl_read_key ()
from /lib/x86_64-linux-gnu/libreadline.so.6
#3 0x00007fd1d7ddcc4c in readline_internal_char ()
from /lib/x86_64-linux-gnu/libreadline.so.6
#4 0x00007fd1d7ddd3c5 in readline ()
from /lib/x86_64-linux-gnu/libreadline.so.6
#5 0x00007fd1d9071970 in epicsReadline ()
from /usr/lib/x86_64-linux-gnu/libCom.so.3.14.12.3
#6 0x00007fd1d9062fdf in ?? ()
from /usr/lib/x86_64-linux-gnu/libCom.so.3.14.12.3
#7 0x0000000000404956 in main ()
From: Mark Rivers [[email protected]]
Sent: Thursday, February 01, 2018 11:22 AM To: Sobhani, Bayan; [email protected] Subject: RE: Segmentation fault when setting motorStatusProblem_ to 1 Ø 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
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 |