Hot!How to configure breakpoints before execution of line

Author
justinmreina
Starting Member
  • Total Posts : 66
  • Reward points : 0
  • Joined: 2009/06/06 22:37:00
  • Location: 0
  • Status: offline
2018/02/13 16:33:15 (permalink)
0

How to configure breakpoints before execution of line

 I am ramping into MPLAB now and having some issues configuring breakpoints, see below for description -
 
Task
  • Configure a HW or SW breakpoint to halt the debug session before any of the selected line is performed
 
Observed Result (see attached for ref)
  • Init: Launch Breakpoint occurs on the third instruction of main
  • BP#1: Stops at last asm instruction of line operation ('x++')
  • BP#2: Stops at entry instruction to called fcn
Questions
  1. How do I get BP#1 to occur at the entry instruction (e.g. 0x880 or 0x882)
  2. How do I get BP#2 to occur before operation of any asm code for line (e.g. at 0x888)
  3. How do I get BP#3 to occur before RCALL (e.g. at 0x88E)
 
So confused right now, I cannot understand the observed behavior nor configure my expected results, yikes! Are the listed questions possible?
 
post edited by justinmreina - 2018/02/13 16:38:20

Attached Image(s)

#1

10 Replies Related Threads

    jtemples
    Super Member
    • Total Posts : 10816
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 16:36:38 (permalink)
    0
    You probably want to enable software breakpoints which prevents skidding when you hit a breakpoint.  And I believe there's an option in X that will break on entry to main().
    post edited by jtemples - 2018/02/13 17:52:00
    #2
    justinmreina
    Starting Member
    • Total Posts : 66
    • Reward points : 0
    • Joined: 2009/06/06 22:37:00
    • Location: 0
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 17:13:56 (permalink)
    0
    I have both of these configured, see attached -
    •  'Software Breakpoint Support.jpg' - S/W Breakpoints are not supported?
    • 'Debug Startup Config Setting.jpg' - "Halt at main" is selected
    Thoughts?

    Attached Image(s)

    #3
    justinmreina
    Starting Member
    • Total Posts : 66
    • Reward points : 0
    • Joined: 2009/06/06 22:37:00
    • Location: 0
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 17:19:41 (permalink)
    0
    I am using the DM240016 Curiosity Board to note.
     
    PIC24F Board
    #4
    jtemples
    Super Member
    • Total Posts : 10816
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 17:51:07 (permalink)
    0
    I guess you'll have to get a better debugger to get software breakpoints.
     
    I just tried the "halt at main" option with a PIC24 + REAL ICE + X 4.05, and it worked as expected, using either hardware or software breakpoints.
    #5
    justinmreina
    Starting Member
    • Total Posts : 66
    • Reward points : 0
    • Joined: 2009/06/06 22:37:00
    • Location: 0
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 17:56:10 (permalink)
    0
    Yikes, interesting! I will try out my PICkit 3 on this unit and share results.
    #6
    BobAGI
    Super Member
    • Total Posts : 1693
    • Reward points : 0
    • Joined: 2011/03/09 00:04:35
    • Location: Texas and Sweden
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/13 23:45:02 (permalink)
    3 (1)
    FWIW:
    I have had problems in the past to get the break happening in the right spot too.
    Sometimes if setting a breakpoint before a call to a function it actually breaks INSIDE that function which was not intended.
    What seemed to help is adding a few nop() instructions before the call and setting the breakpoint on the nop() line instead. I have no idea why this helped though....

    --
    Bo B
    Sweden & Texas
     
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 16029
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: How to configure breakpoints before execution of line 2018/02/13 23:49:31 (permalink)
    0
    That works since the issue with the PIC24 is break point skidding. The NOPs take the skid. If it misses the first bop, it will hit the second. Or stop and the line after that. It has to do with the way the cpu fetches instructions.
    #8
    justinmreina
    Starting Member
    • Total Posts : 66
    • Reward points : 0
    • Joined: 2009/06/06 22:37:00
    • Location: 0
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/14 14:25:56 (permalink)
    0
    I connected my PICkit 3 to the board, repeated the same test and observed the same results see attached. Yikes! Thoughts?

    Attached Image(s)

    #9
    NKurzman
    A Guy on the Net
    • Total Posts : 16029
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: How to configure breakpoints before execution of line 2018/02/14 17:56:21 (permalink)
    #10
    maxruben
    Super Member
    • Total Posts : 3265
    • Reward points : 0
    • Joined: 2011/02/22 03:35:11
    • Location: Sweden
    • Status: offline
    Re: How to configure breakpoints before execution of line 2018/02/15 04:51:41 (permalink)
    0
    Also turn off all optimization
     
    /Ruben
    #11
    Jump to:
    © 2018 APG vNext Trial Version 4.5