User forums > Using Code::Blocks
Debugger question
(1/1)
VeeDub:
Hello,
I am using CodeBlocks v20.03
on RedHat 4.8.5-39
GCC is version 4.8.5
For a certain record, the following if statement should evaluate as true.
--- Code: ---if (
(tail->i_local_port == Device_Activity_record->i_local_port) && \
(strcmp(tail->c_remote_ip_address,Device_Activity_record->c_remote_ip_address) == 0) && \
(tail->i_remote_port == Device_Activity_record->i_remote_port) && \
(strcmp(tail->c_protocol,Device_Activity_record->c_protocol) == 0) && \
(strcmp(tail->c_type,Device_Activity_record->c_type) == 0) && \
(strcmp(tail->c_content,Device_Activity_record->c_content) == 0)
)
{
//do actions
}
--- End code ---
However for some reason this is not happening.
I have placed watch statements on all the variables, and they're identical as expected.
Is there a way using the debugger interactively that I can identify which condition/s are not being evaluated as true, or is my only option to add a bunch of extra debugging code along the lines of
--- Code: ---if (tail->i_local_port == Device_Activity_record->i_local_port)
{
printf("Test true\n");
}
else
{
printf("Test false\n");
}
--- End code ---
Thanks
VW
VeeDub:
I've figured out this issue.
Essentially a logic flaw in an earlier block of code.
This if statement was part of a while block, and when this if statement was being evaluated, a condition in the earlier while block had changed which resulted in the while loop being exited and as a result the if statement not being executed
In short, user error, as usual
Navigation
[0] Message Index
Go to full version