NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Remote Debugging from Windows to Linux

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
UnhandledException



Joined: 07 Feb 2017
Posts: 6

PostPosted: Tue Feb 07, 2017 2:31 pm    Post subject: Remote Debugging from Windows to Linux Reply with quote

Using NetBeans IDE 8.2 on Windows 7.
Created required Services and associated Projects.

Project 1 connects to Machine 1 which is Linux to do the compile/link and works fine. The executable is moved to Machine 2.

Project 2 connects to Machine 2 which is Linux. Within this Project, reference to the source is made back to Machine 1. Also, reference to the executable on Machine 2 is also made. From here I can start debugging the process and step through the code.

What I can't do is attach to the process if it is already running and debug via that way. I would have to kill the process and start it within the Project. When attempted to attach via the Debug->Attach where I can see the process and associated PID on the remote machine but once the OK button is clicked an error appears that it can't find the executable in my local directory on Windows. Strange that it shows me the correct procedure on the correct remote machine with correct PID and UID but then attempts to locate the process locally.

Is there a step missing?
I have yet to find any reference with the steps on how to attach to an already running remote process and debug while stepping through the code which is my ultimate goal.
Back to top
Paulo R. Panhoto
Posted via mailing list.





PostPosted: Tue Feb 07, 2017 5:20 pm    Post subject: Remote Debugging from Windows to Linux Reply with quote

When I click on a process, I notice the Project (drop down menu) gets back to <no project>. After selecting the process, if I select the appropriate project and then, that works for me.

On Tue, Feb 7, 2017 at 12:31 PM, UnhandledException <address-removed ([email]address-removed[/email])> wrote:
Quote:
Using NetBeans IDE 8.2 on Windows 7.
Created required Services and associated Projects.

Project 1 connects to Machine 1 which is Linux to do the compile/link and works fine. The executable is moved to Machine 2.

Project 2 connects to Machine 2 which is Linux. Within this Project, reference to the source is made back to Machine 1. Also, reference to the executable on Machine 2 is also made. From here I can start debugging the process and step through the code.

What I can't do is attach to the process if it is already running and debug via that way. I would have to kill the process and start it within the Project. When attempted to attach via the Debug->Attach where I can see the process and associated PID on the remote machine but once the OK button is clicked an error appears that it can't find the executable in my local directory on Windows.  Strange that it shows me the correct procedure on the correct remote machine with correct PID and UID but then attempts to locate the process locally.

Is there a step missing?
I have yet to find any reference with the steps on how to attach to an already running remote process and debug while stepping through the code which is my ultimate goal.




Back to top
UnhandledException



Joined: 07 Feb 2017
Posts: 6

PostPosted: Tue Feb 07, 2017 5:24 pm    Post subject: Re: Remote Debugging from Windows to Linux Reply with quote

Paulo R. Panhoto wrote:
When I click on a process, I notice the Project (drop down menu) gets back to <no project>. After selecting the process, if I select the appropriate project and then, that works for me.



I have tried <no project>, <create new project>, the project configured for the Source on Machine 1 and the project configured for the executable on Machine 2.

In the last two scenarios, an error would return indicating the process could not be found and it was searching in a local directory.

Both projects used are tied to there respected Services and do point to their respected remote machines.

Just curious which version of NetBeans are you using?
Back to top
soldatov



Joined: 05 Nov 2009
Posts: 583

PostPosted: Tue Feb 07, 2017 5:28 pm    Post subject: Re: Remote Debugging from Windows to Linux Reply with quote

I checked such scenario:
- Local platform is Windows 10
- Remote host is Ubuntu 16.10
- On Ubuntu I created such file:

#include <stdio.h>
#include <unistd.h>

int main(int argc, char** argv) {
for (int i = 0; i < 100; i++) {
printf("%d\n", i);
sleep(1);
}
return 0;
}

- I did:
g++ -g -o test test.cpp
./test
- On Windows In NetBeans I pressed Debug|Attach Debugger
- I selected "Gdb Debugger", "user@ubuntuhost", "./test" process and "<no project>" filter
- I pressed OK button
- I pressed Pause button on toolbar
- In Call Stack tab I selected "main()" frame
==> IDE opens "test.cpp"file in Full Remote mode
Back to top
UnhandledException



Joined: 07 Feb 2017
Posts: 6

PostPosted: Tue Feb 07, 2017 5:50 pm    Post subject: Re: Remote Debugging from Windows to Linux Reply with quote

soldatov wrote:
I checked such scenario:
:
:

- I did:
g++ -g -o test test.cpp
./test
- On Windows In NetBeans I pressed Debug|Attach Debugger
- I selected "Gdb Debugger", "user@ubuntuhost", "./test" process and "<no project>" filter
- I pressed OK button
:
:
==> IDE opens "test.cpp"file in Full Remote mode


This is a great test.
Doing the same steps as you , I encounter the following error right after the OK button is clicked:


java.lang.NullPointerException
at org.netbeans.modules.cnd.api.remote.RemoteSyncSupport.getPathMap(RemoteSyncSupport.java:95)
at org.netbeans.modules.cnd.makeproject.api.ProjectActionSupport$EventsProcessorImpl.checkExecutable(ProjectActionSupport.java:732)
at org.netbeans.modules.cnd.makeproject.api.ProjectActionSupport$EventsProcessorImpl.run(ProjectActionSupport.java:440)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:6Cool
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Back to top
soldatov



Joined: 05 Nov 2009
Posts: 583

PostPosted: Tue Feb 07, 2017 7:32 pm    Post subject: Re: Remote Debugging from Windows to Linux Reply with quote

https://netbeans.org/bugzilla/show_bug.cgi?id=268698 has been fixed 2 months ago
Back to top
UnhandledException



Joined: 07 Feb 2017
Posts: 6

PostPosted: Tue Feb 07, 2017 8:26 pm    Post subject: Re: Remote Debugging from Windows to Linux Reply with quote

soldatov wrote:
https://netbeans.org/bugzilla/show_bug.cgi?id=268698 has been fixed 2 months ago


Just updated the IDE and able to run this sample which is pretty neat.

Currently encountering a different issue with my actual process but will post within a new thread.

Thanks for the help. It was great to see this actually working.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo