Is there a way to print a formatted string from a log action in a CDT eclipse breakpoint action?

I am trying to display a formatted string directly from a breakpoint action in eclipse-cdt (when programming in C).

I set up a conditional breakpoint and 2 actions associated with it: - an action in the log (I checked the "evaluate as an expression" checkbox) - a resume action to prevent disconnection from the actual stop at this breakpoint.

I did not find any documentation on the expected syntax of the expression of the action in action: I tried several options, but I was able to display only one content of the variable. From these attempts, I found that he does not expect any C-statements like printf ("i =% d", i); nor the syntax of gdb printf.

I would like to print a line like "i = 12 and sum = 34".

Thanks in advance.

+4
source share
1 answer

Just call printf, as in regular code, but don't put a semicolon at the end. It works for me. Note that this will print the text in your stdout application and it will look like normal application text output.

Tested: Eclipse IDE for C / C ++ Developers

Version: Kepler Service Release 2 Build ID: 20140224-0627

+3
source

Source: https://habr.com/ru/post/1544342/


All Articles