Bug 577936 - dprintf not work as expected
Summary: dprintf not work as expected
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-22 02:44 EST by yuan bian CLA
Modified: 2021-12-23 15:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yuan bian CLA 2021-12-22 02:44:59 EST
dprintf can't work as expected due to https://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/commit/?id=27bbd177b7b6effe192225788869bb93f07e51cf

As you know, dprintf is a breakpoint whose condition is just like '$printf(...)' and related BP should never be hit.

But currently, dprintf related BPs will be hit unexpectly.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
static void evaluate_condition(void * x) {
    ...
        if (check_context_ids_condition(bp, ctx)) condition_ok = 1;
        if (condition_ok && bp->condition != NULL) {
#if ENABLE_Expressions
            Value v;
            if (evaluate_expression(ctx, STACK_TOP_FRAME, 0, bp->condition, 1, &v) < 0 ||(v.size > 0 && value_to_boolean(&v, &condition_ok) < 0)) {
                error = errno;
            }   
#endif
        }
    ...
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For dprintf, v.size is set to 0, and then variable 'condition_ok' is always equal to 1 which result in the final hit.

Can you help to check it?

thanks.
Comment 1 Eugene Tarassov CLA 2021-12-23 15:53:44 EST
Fixed.
Thanks!