Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Sync debugger to changed source: (5 Items)
   
Sync debugger to changed source  
Hi
I have been using the debugger successfully and stepping into a function as expected.  I have now made changes to that 
source file and when I step into it, it is showing the cursor on the wrong line.  I presume that it is using the orignal
 line number.  I have to build using Makefiles and not build through Momentics.  How can I get the source and the 
debugger back into sync?

Many thanks
Ant
Re: Sync debugger to changed source  
As I understand you have 2 copies of source file - one on the machine it 
builds, and one on the host for IDE. And there is also virtual source in 
the debug into of the executable you build. To successfully debug you 
have to synchronize all 3 of them. I.e. change source in IDE, upload 
sources to target, make there, binary would be updated, restart debug. 
If you do opposite change source on target, build and upload to host 
then you have to also click refresh on IDE project (if it is in the 
project, if sources are not visible from any project - it is not needed).

Ant Pace wrote:
> Hi
> I have been using the debugger successfully and stepping into a function as expected.  I have now made changes to that
 source file and when I step into it, it is showing the cursor on the wrong line.  I presume that it is using the 
orignal line number.  I have to build using Makefiles and not build through Momentics.  How can I get the source and the
 debugger back into sync?
>
> Many thanks
> Ant
>
> _______________________________________________
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post9077
>
>   
Re: Sync debugger to changed source  
I'm sorry I don't understand.  As far as I can tell I only have source on the build machine.  If they are on the target 
on in the debugger, can you show me where they are?

I am connecting from the build machine to the target to debug so I can't see that I need them on the target.   I don't 
understand your comment about them being in the debugger.

thank you for your help

Ant
Re: Sync debugger to changed source  
Ant Pace wrote:
> I am connecting from the build machine to the target to debug so I can't see that I need them on the target.   I don't
 understand your comment about them being in the debugger.
> 

Ok, this is usual setup.

There are several possibilities I see:

1) your binary does not get uploaded automatically to your target. Gdb still works with the old binary on the target - 
line numbers won't match.

2) You do upload your modified binary but for some reason gdb is "reading" old binary on the host side (and again line 
numbers won't match). 

3) Nothing is wrong - due to optimizations gdb will sometimes step "off" the source code.


Please make sure you use correct binaries on both host and target sides.
Re: Sync debugger to changed source  
I did not know what is your sources structure. You said before that you 
build on target, and I assumed that it is qnx target and not the host 
where IDE is. If it is not the case see Aleksandar's post.

Ant Pace wrote:
> I'm sorry I don't understand.  As far as I can tell I only have source on the build machine.  If they are on the 
target on in the debugger, can you show me where they are?
>
> I am connecting from the build machine to the target to debug so I can't see that I need them on the target.   I don't
 understand your comment about them being in the debugger.
>
> thank you for your help
>
> Ant
>
> _______________________________________________
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post9113
>
>