Using Simulator printf("%s")

Can anyone tell me how to print the value of a source code string in the simulator? I am trying to use the simulator printf() function in a breakpoint assignment as follows:

bs \assertions\assert\81, 1, "printf(\"%s.\",\\assertions\\assert\\debugstr)"
debugStr is defined within Assert()as follows:
char debugStr[CHARS_PER_LINE];
I have tried many variations on this theme but all report:
<printf: argument 2 invalid>

Thanks,
Barry

Parents
  • Type the following in the comand window:

    d debugStr, &(((debugStr)) [sizeof(debugStr)-1])
    

    This should display the string. If it does, then change your breakpoint to:

    bs \assertions\assert\81, 1, "d debugStr, &(((debugStr)) [sizeof(debugStr)-1])"
    

    I'm pretty sure this will work. You may need to use the EXEC debugger function, but I don't think so.

    The reason that the printf Debugger Function doesn't work is because its arguments must be Debugger Variables and not variables in your program.

    Jon

Reply
  • Type the following in the comand window:

    d debugStr, &(((debugStr)) [sizeof(debugStr)-1])
    

    This should display the string. If it does, then change your breakpoint to:

    bs \assertions\assert\81, 1, "d debugStr, &(((debugStr)) [sizeof(debugStr)-1])"
    

    I'm pretty sure this will work. You may need to use the EXEC debugger function, but I don't think so.

    The reason that the printf Debugger Function doesn't work is because its arguments must be Debugger Variables and not variables in your program.

    Jon

Children
No data
More questions in this forum