Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Access Violation when breakpoint is hit

davec
2015-06-02
2023-08-17
  • davec - 2015-06-02

    Hi all,
    we got a weird problem when trying to debug our application, each time I put a breakpoint (anywhere) and the code hit this breakpoint, the runtime just crash with an Access Violation in CmpIecTask

    Here is a log output of the exception and a few entry before the exception
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_Logout received: App=Main_Control, SessionId=0xfc8d4a40, AppSessionId=0xdb505186 </entry>
    <entry component="CmpIecTask" severity="exception" user="nobody">SOURCEPOSITION App=[Main_Control] area=0, offset=22429936</entry>
    <entry component="CmpIecTask" severity="exception" user="nobody">EXCEPTION [AccessViolation] occurred: App=[Main_Control], Task=[DefaultTask]</entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpApp_Exception received: App=Main_Control, ulException=0x51 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_ConfigAppStoppedDone received </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_StopDone received: App=Main_Control, Reason=3 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb324f948, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb324f948, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb324d360, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb324d360, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb327d530, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb327d530, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb3285818, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb3285818, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb327db88, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb327db88, nCodeLen=4 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_PrepareConfigAppStopped received </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_PrepareStop received: App=Main_Control, Reason=3 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_DenyStop received: App=Main_Control, Reason=3, bDeny=0 </entry>
    <entry component="hardware_v2" severity="information" user="nobody"> EVT_CmpAppBP_CodePatch: Begin received: pbyCodePos=0xb324f948, nCodeLen=4 </entry>

    I've also found someone in the forum who got the same problem, though I don't know if he managed to resolve the issue
    l viewtopic.php?f=21&t=6147 l

    We are using runtime v3.5.6.10 on the target and Codesys 3.5 SP6 Patch 3

    Did anyone already got this problem and managed to resolve it ?

    Regards,
    Dave

     
  • irfanmirza - 2015-08-05

    Does anybody found the reason for this exception?
    Dave have you already solved it? please comment, as I am also facing this issue

     
  • davec - 2015-08-05

    Hi,
    yes we found the issue. When compiling Codesys runtime, a specific flag needs to be added to enable debugging. If this flag is omitted, if you put breakpoints in your code, it'll just crash. It must be a security feature.
    You'll only encounter this problem if Codesys is compiling the runtime for your specific application. If it's not the case, it must be something else

    Regards,
    Dave

     
  • irfanmirza - 2015-08-06

    Hi,

    Thanks Dave for the hint about setting the flag.
    I did a deep investigation on this special flag but could not find it. Can you please tell me which flag are you talking about?

    Were you also working on ARM target platform?

    Regards
    Irfan

     
  • irfanmirza - 2015-08-14

    Hi,

    we found out that the ARM processor flag (in our case EABIv5) was missing in the makefiles. And because of that issue, the incorrect debug handler (ArmDebugHandler(...)) was called within SysCpuHandlingLinux.c file.
    Hope it will help other users.

    Regards.

     

Log in to post a comment.