Hot!Debugging Broken Breakpoints In MPLABX

Page: 12 > Showing page 1 of 2
Author
gguerrerdymetek
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2013/12/18 06:19:17
  • Location: 0
  • Status: offline
2017/01/12 11:31:18 (permalink)
0

Debugging Broken Breakpoints In MPLABX

Hi everyone.
 
I´m using MPLAPX (Ver 3.45), XC8 Ver 1.38 and PICKIT 3 in a simple project with a PIC18F2620. 
When I try to debug, every breakpoint that I try to use, get broke as soon as I click the line. The thing is that if I try to do the same with exactly the same project (Sync via Dropbox) in other computer (with exactly the same SW versions), it works fine.
 
DO you have any advice to fix the computer that is failing regarding this issue?
 
Thanks a lot
 
Gonzalo
#1

26 Replies Related Threads

    Mysil
    Super Member
    • Total Posts : 2831
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/01/12 12:10:28 (permalink)
    +1 (1)
    Hi,
    Broken breakpoints means that the debugger do not understand the correspondence between source code and executable instruction address.
     
    This more often happen with optimized code.
    Are you sure you are running with same optimization settings and license when comparing?
    Usually it is recommended to switch off optimization when compiling a program for debugging.
     
    One way to get a fix, is to insert a nop instruction at a point where you know you will want to stop: NOP();
    it will not usually be optimized away.
    Another is to open a memory view of Execution Memory and set the breakpoint at actual instruction.
     
    You must show actual code, to get more specific tips, and you have to tell what optimization settings you are using.
     
    Regards,
       Mysil
    #2
    JesseGordon
    Starting Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2011/08/08 20:05:57
    • Location: 0
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/01/13 01:42:28 (permalink)
    0
    I have similar problem.
    Inherently, breakpoints are working in that stepping, stepping over/into works, and (get this) "run to cursor" works!
    Furthermore, if I go to Window->Debugging->Disassembly I can then set breakpoints in there and they work fine.
    Problem exists with ICD3 or simulator.
    Again, same OS same mplabx on two different computers - problem on one, but not on other.
    (i.e. ironically on my main computer breakpoints are broken, but on an old slow laptop, they work great.)
    And yes I know you have to set breakpoints only on code producing lines -- but no breakpoint works on any line. Really.
    But for C lines (XC in default free mode) all breakpoints are broken.
    I've had this problem for months - just upgraded to v3.50 to see if it helps, and no help.
     
    Oh yeah, my project name and path contains nothing accept a-z A-Z 0-9 as user provided input.
    (/path/to/home/MPLABXProjects/GWScada420A.X/main.c)
    Fresh install of latest mplab-x just today, all default settings for optimization etc.
     
     
    Thanks very much,
    Jesse
    post edited by JesseGordon - 2017/01/13 01:49:16
    #3
    GeorgePauley
    Moderator
    • Total Posts : 981
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/01/13 15:12:47 (permalink)
    0
    Have you tried erasing the Cache, and maybe User, directories?  Their locations can be found in the MPLAB X Help -> About screen.  This is kind of the catch all problem solver for MPLAB X (kind of like restarting for Windows).
    #4
    JesseGordon
    Starting Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2011/08/08 20:05:57
    • Location: 0
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/01/13 18:39:25 (permalink)
    +1 (1)
    George,
    THANK YOU SO MUCH!
    You have just solved months of head banging!
    I had done what I thought was a complete mplab-x delete and reinstall, so I had deleted .mplab* files in home directory, but I had not deleted the entry in ~/.cache/mplab*  !
    Anyway I deleted it and restarted now I can set break points!
    Thank you so much!
    ~Jesse
    #5
    PIC4C code
    Starting Member
    • Total Posts : 81
    • Reward points : 0
    • Joined: 2011/02/21 10:32:55
    • Location: 0
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/07/16 15:20:17 (permalink)
    0
    Hi
    MPLAB x v3.65 and xc8 1.42 free version.  Using PIC16886.
    Breakpoints work fine except in subroutines.  I've gone through a lot of documents to find the why without success.   I used the NOP() and made sure I use a program statement also.  Breakpoints work on project files.
    I have the prototype defined: unsigned short Short2BCD3(unsigned short inValue);
    the call subroutine in the Main; unsigned short Short2BCD3(unsigned short inValue);
    and the subroutine:unsigned short Short2BCD3(unsigned short inValue){}
    Maybe the subroutine is not being called?
    I used a lot of the advice discussed above but there is something I don't understand.
    Breakpoints in the main step right over the call.  If I move the whole subroutine into the main without the call function etc.  The program execution works fine and breakpoints work.
    #6
    qhb
    Superb Member
    • Total Posts : 6262
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/07/16 15:23:33 (permalink)
    +1 (1)
    PIC4C code
    ...
    Maybe the subroutine is not being called?
     

    That is the most likely explanation, that the compiler has decided the function is never called, and optimises it away.
    We'd need to see your full code to comment more.
     
     
    #7
    RISC
    Super Member
    • Total Posts : 5240
    • Reward points : 0
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2017/07/16 16:25:21 (permalink)
    +1 (1)
    Hi,
    Broken breakpoint have multiple reasons :
    * already used all HW breakpoints
    * breakpoint put on a C program line generating no code
    * breakpoint put on a C project which is optimised 
    PIC16F886 has a single HW breakpoint...like many PIC16 devices.
    Generally this breakpoint is more or less "reserved" for "Reset to main" which means you have only 1 BP available.
    All these infos can be found in MPLAB X documentation :
    c:\Program Files (x86)\Microchip\MPLABX\v3.65\docs\FeatureSupport\HWToolDebugFeatures.html
    One advantage of the recent PIC16F1xxx or PIC16F1yyyy is that they support almost unlimited SW breakpoints if you use an ICD3 or a Real-Ice which makes debugging easier.
    Regards
     
    #8
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/12 15:58:46 (permalink)
    0
    Since there's a breakpoint discussion going here, I'm struggling too.  MPLABX 4.05 PICKit 3.
     
    After entering a debug session, I run to a breakpoint.  The PC appears to stop (continue button returns to green).  The breakpoint doesn't turn green and the variables aren't displayed.  Any ideas on what's happening?
     
    thx
    #9
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/12 16:12:53 (permalink)
    0
    The output window states "Target Halted"
     
    #10
    RISC
    Super Member
    • Total Posts : 5240
    • Reward points : 0
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/12 16:56:45 (permalink)
    0
    Hi,
    Which PIC ?
    Which language (ASM / C) ?
    If it is C, which compiler name / version ?
    Optimization on or off ?
    Did you try to close reopen the project and/or MPLAB X ?
    Regards
     
    #11
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 17:25:40 (permalink)
    0
    PIC24FJ64GB004
    C
    XC16 V1.33
    Don't know where the switch is for optimization
    Yes, I closed and re-openned the project.
     
    How do i control optimization?  This might help me with broken break points.
    Is there an easy way to see where the PC is at halt?  I'm seeing the green bar for the first breakpoint but not after that.  The IDE indicates the "user program stopped" lower left corner.
     
    thx
     
    -T
     
    post edited by BumpSplat - 2018/01/17 17:29:46
    #12
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 18:03:19 (permalink)
    0
    I just found the optimization level and have set it to zero. :)
    #13
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 18:16:42 (permalink)
    0
    And I just found the source address is bottom left next to the debugger bar.  Now, I know where I am!
     
    #14
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 18:45:00 (permalink)
    0
     
    Now that I know where I am I can see where the issue is happening.  I've indicated Break Points below with "BP - ". 
    I hit "BP1" and successfully read the file name from the USB Drive.  The second Break Point stops correctly at "BP2".  Only after selecting continue three times does it move off of that address and around to BP1.  It never lands within the if() statement (BP3) the "else" (BP4).
      
    If I change the find() search attribute "True" (first search) it successfully is captured by the break points.  If it's set to false (second search), the above action happens.
     
    I've set optimization to one as zero generated errors.  The breakpoints are not showing as broken.... hmm.
     
    case SEARCHING_FILE:
    {
    //////////////
    BP1 - if (FILEIO_Find("*.BDG", FILEIO_ATTRIBUTE_MASK, &SearchResult1, true) == FILEIO_ERROR_NONE)
       {
       for (Transfer=0; Transfer<File_Name_Length; Transfer++)
       Sound.call_1[Transfer] = SearchResult1.shortFileName[Transfer];
       }
    BP2 - if (FILEIO_Find("*.BDG", FILEIO_ATTRIBUTE_MASK, &SearchResult2, false) == FILEIO_ERROR_NONE)
       {
       Transfer=0;
       while (Transfer < File_Name_Length)
          {
    BP3 - Sound.call_2[Transfer] = SearchResult2.shortFileName[Transfer];
          Transfer++;
          }
       }
    else
       {
       Transfer=0;
          while (Transfer < File_Name_Length)
          {
          BP4 - Sound.call_3[Transfer] = SearchResult2.shortFileName[Transfer];
          Transfer++;
          }
    }
     
    thx - Tim
    post edited by BumpSplat - 2018/01/17 19:49:22
    #15
    qɥb
    Monolothic Member
    • Total Posts : 3248
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 19:49:21 (permalink)
    0
    What value is in file_name_length ?
    If it was zero it would explain your symptoms.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #16
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 20:04:00 (permalink)
    0
    const uint8_t File_Name_Length = 13;
    Globally defined.
    #17
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 20:06:47 (permalink)
    0
    uint8_t Transfer = 0;
    Locally defined
    #18
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 20:13:01 (permalink)
    0
    It's looking shotty becuase I've kluged together statements goofing around with coding (still learning C).  It's turned into complete non-sense as I've kluged statements to place breakpoints and look for variables in the debug window.  Complete nonsense.  :)
     
    #19
    qɥb
    Monolothic Member
    • Total Posts : 3248
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: Debugging Broken Breakpoints In MPLABX 2018/01/17 20:57:18 (permalink)
    0
    How about moving BP3 up a couple of lines to
    Transfer=0;

    and then single step from there?
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2018 APG vNext Commercial Version 4.5