Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Debugger strange behaviour: (5 Items)
   
Debugger strange behaviour  
In a simple C++ application with a certain scheme, the visual debugger steps over an else block form its if block.
The process runs normally. It doesn't execute the else block. But the debugger shows wrong code line.

Sample code is attached. 
Attachment: Text TestGdb.cpp 440 bytes
Re: Debugger strange behaviour  
Either code compiled with optimization, or binary debugger see is not 
the same (i.e. you did not recompile or re-upload the binary)

On 12-12-18 03:39 AM, Serkan Basaran wrote:
> In a simple C++ application with a certain scheme, the visual debugger steps over an else block form its if block.
> The process runs normally. It doesn't execute the else block. But the debugger shows wrong code line.
>
> Sample code is attached.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post98188
> To cancel your subscription to this discussion, please e-mail general-ide-unsubscribe@community.qnx.com

Re: Debugger strange behaviour  
The problem appears also when the application is compiled with no optimization.
Re: Debugger strange behaviour  
Does gdb continue stepping correctly, i.e. is showing the wrong line 
number the only bad thing that happened?

Wrong line info has been seen before. There are cases where line 
information is very confusing especially in the case as you show in the 
sample. "result" is known to be zero at compile time. In this case, even 
at O0 gcc will emit strange line info.

You will also see strange things in constructs like

for (;;) {
...
}

In some cases, setting a breakpoint at 'for' statement line will yield 
breakpoint that never triggers.

I'm sure there can be more.

This is also architecture specific and if this is happening on arm it is 
not necessarily reproducible on x86 and vice versa.

---
Aleksandar

Re: Debugger strange behaviour  
Thanks for your interest.

Yes, debugger goes on correctly.

I haven't tried that on another platform.

> Does gdb continue stepping correctly, i.e. is showing the wrong line 
> number the only bad thing that happened?
> 
> Wrong line info has been seen before. There are cases where line 
> information is very confusing especially in the case as you show in the 
> sample. "result" is known to be zero at compile time. In this case, even 
> at O0 gcc will emit strange line info.
> 
> You will also see strange things in constructs like
> 
> for (;;) {
> ...
> }
> 
> In some cases, setting a breakpoint at 'for' statement line will yield 
> breakpoint that never triggers.
> 
> I'm sure there can be more.
> 
> This is also architecture specific and if this is happening on arm it is 
> not necessarily reproducible on x86 and vice versa.
> 
> ---
> Aleksandar
>