This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

step into and step over do same thing in AG_GoStep in apntex_173

i am writing a AGDI Driver for the uVision Debugger base on apntex_173.
my chip is using Cortex-M0, many functions (r/w registers, r/w memory, start/stop debug session, run, run to cursor line, step out of current function, breakpoint and so on) have realized. only one thing makes me confused, as follow:
i compile a project and then debug it, when arrive a subroutine, F10 and F11(step and step over) do same thing, they both go into subrountine, F10 should execute step over but execute step into .

i track souce, when F10 and F11, they both go into AG_GoStep, parameters nCode is 2, nSteps always is 1(only execute a step), F10 should execute n step. Somebody can give me some advice?

Thans a lot!!!

Parents
  • Thanks for your reply.
    I have a little confused:
    For example:
    int main(void)
    { test1();
    printf("Hello World");
    test2();
    }

    when arrive test1()

    if i press F11(step into), it step into test1() to execute, i check code AG_GoStep, now parameter:nCode is 2, nSteps is 1; go to case: AG_NSTEP to execute a step command, it is right.

    but if i press F10(step over), it should step over test1() to execute "printf("Hello World");", but the test result is : it also step into test1() to execute, i check code AG_GoStep, now parameter: nCode is 2, nSteps is 1; go to case: AG_NSTEP to execute a step command, it looks wrong.

    Now I have two question:
    one: in anycase, F10, F11 both execute step into, go into case AG_NSTEP(nCode is 2, nSteps is 1), how resolved it?
    two: "In case of a call a BP is set behind the call and Go is executed"
    ==> that keil have realized or my AGDI driver need realize , if i realized it in my AGDI driver, how can i depart step into and step over from (AG_NSTEP).

    Thanks a lot!

Reply
  • Thanks for your reply.
    I have a little confused:
    For example:
    int main(void)
    { test1();
    printf("Hello World");
    test2();
    }

    when arrive test1()

    if i press F11(step into), it step into test1() to execute, i check code AG_GoStep, now parameter:nCode is 2, nSteps is 1; go to case: AG_NSTEP to execute a step command, it is right.

    but if i press F10(step over), it should step over test1() to execute "printf("Hello World");", but the test result is : it also step into test1() to execute, i check code AG_GoStep, now parameter: nCode is 2, nSteps is 1; go to case: AG_NSTEP to execute a step command, it looks wrong.

    Now I have two question:
    one: in anycase, F10, F11 both execute step into, go into case AG_NSTEP(nCode is 2, nSteps is 1), how resolved it?
    two: "In case of a call a BP is set behind the call and Go is executed"
    ==> that keil have realized or my AGDI driver need realize , if i realized it in my AGDI driver, how can i depart step into and step over from (AG_NSTEP).

    Thanks a lot!

Children
  • > how can i depart step into and step over from
    the debugger does this for you, AG_GoStep() should be called several times.

  • That is:
    when i press F10, if current address is subroutine start address, keil will tell AGDI driver nCode = 3 let AGDI go to execute GoUtil(addr), addr is next address of whole subroutine.
    if current address is not subroutine start address, keil will tell AGDI driver nCode = 2, nSteps = 1 let it go to execute Step, is this right?

  • 'Step Into' and 'Step Over' do the same except for function calls. There is also a difference if you select these commands from a source window or from the disassembly window. Let's start with the simple one:

    'Step Into' executed in the disassembly window:
    Will always create one call to "AG_GoStep with nCode = 2 (AG_NSTEP) and nStep=1".

    'Step Over' executed in the disassembly window:
    Will create one call to "AG_GoStep with nCode = 2 (AG_NSTEP) and nStep=1" for all instructions except CALLs. For CALLs, a breakpoint will be set after the CALL and then one "AG_GoStep with nCode = 3 (AG_GOTILADR)" will be executed.

    'Step Into' executed in the C-source window:
    Will create one or more calls to "AG_GoStep with nCode = 2 (AG_NSTEP) and nStep=1" until the next C-source line is reached.

    'Step Over' executed in the C-source window:
    Will create one or more calls to "AG_GoStep' until the next source line is reached. One C-source line is usually translated into many assembly instructions. As explained above, CALLs will be handled with a breakpoint and a AG_GOTILADR and all other instructions with a AG_NSTEP command. In your example, a 'printf("hello");' will create a few AG_NSTEP to load the function parameter and then one AG_GOTILADR.

    You will only see a nStep value greater than 1 if you enter a command like "t 100" in the command window of the uVision debugger.

  • Hi,
    Thank you for giving us this information.

    We still can not get the correct result,
    both F10 (Pstep) and F11 (Istep) always step into the functions, and did not set breakpoint.

    For F10 and F11, It's OK to step the whole C source line, which calls "AG_GoStep(AG_NSTEP)" for serveral times internally.
    So Keil or upper layer dll(SARMCM3.DLL) must has the ability to know the PC address of next line.

    It seems that it just can not understand the code of function call (such as BL, BX).

    How Keil know if the code is a function call?
    Do we need to provide any information about it in ADGI driver?

    Best regards,

    xhchen
    at nuvoton.com