This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198263 - Is it possible to debug c++ remotely at all?
Summary: Is it possible to debug c++ remotely at all?
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 7.0
Hardware: PC Linux
: P4 normal with 1 vote (vote)
Assignee: Maria Tishkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 21:48 UTC by puchuu
Modified: 2016-07-06 14:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description puchuu 2011-05-02 21:48:50 UTC
It is very bad fact for you to distribute netbeans 7.0 without testing remote debugging at all!

I have:
windows 7 + mingw + netbeans 7.0

virtual machine squeeze stable:
1) c++ project building properly with cmake
2) F:/Debian_squeeze/shared -> /media/sf_shared
3) gdbserver

in cmd I tried use simply gdb (from mingw) connected to virtual machine's gdbserver - all works properly
but I need graphical interface

1) I added new development host 
http://clip2net.com/clip/m46295/1304369767-clip-14kb.png
2) Select "System level file sharing" as default 
http://clip2net.com/clip/m46295/1304369948-clip-21kb.png
2) Select this host as default to my project 
http://clip2net.com/clip/m46295/1304369864-clip-16kb.png
3) press debug
4) it wants me to select mapping. here is a small bug: it dont want slash at the end of the path
http://clip2net.com/clip/m46295/1304370060-clip-24kb.png
5) ok. I delete slashes at the end of each path and press ok
6) he didn't say anything. only "BUILD FAILED". 
http://clip2net.com/clip/m46295/1304370211-clip-6kb.png

I found .netbeans\7.0\var\log\uigestures and messages.log files.
I clear this files and repeat bug:
1) messages.log still clear
2) in uigestures are logs from graphical interface with level FINE or INFO. 
It is not funny: bug without any log!

Okey. I select "automatic copying" 
http://clip2net.com/clip/m46295/1304371202-clip-20kb.png and press debug:
100% working cmake build failed! (I develop it for a week using console gdb before it became very complex)
http://clip2net.com/clip/m46295/1304372679-clip-24kb.png

1) I tried nano CMakeFiles/CMakeOutput.log 
http://clip2net.com/clip/m46295/1304371485-clip-3kb.png
2) I tried enca -L none CMakeOutput.log - "Unrecognized encoding"
3) I copy this log to shared folder and open it with notepad++ http://clip2net.com/clip/m46295/1304371626-clip-2kb.png
4) I copy ALL files that uses netbeans to shared folder and open each of them:
ALL consist of zeros!!! (\0)
Netbeans couldn't copy files properly?? (no logs at all)

Okey. Lets try to attach remote debugger:
1) Select Debug -> Attach debugger 
http://clip2net.com/clip/m46295/1304372057-clip-11kb.png
2) After pressing ok it say that "Connection to gdb failed: null" 
http://clip2net.com/clip/m46295/1304372136-clip-8kb.jpg
3) Lets try to connect using mingw gdb http://clip2net.com/clip/m46295/1304372256-clip-26kb.png - works fine

At the result: 
I can't use remote debugging tools at all! errors has no logs! Why do you develop netbeans at close source if you can't do anything to work???
Comment 1 puchuu 2011-05-03 15:22:18 UTC
Founded netbeans's plugin GdbServer which don't work too!

1) Debug -> Attach Debugger
http://clip2net.com/clip/m46295/1304435354-clip-52kb.png
2) Hangs. cannot connect even with root privileges
http://clip2net.com/clip/m46295/1304435766-clip-11kb.jpg
without any log of cource

What is a sense of this plugin?

nohup gdbserver ip:port --attach `cat /var/run/my_app.pid` > /var/log/my_app/log.txt 2> /var/log/my_app/error.txt < /dev/null &
echo $! > /var/run/my_app_debug.pid

any man who interested in remote debug can read man!! Don't make stupid plugins!! 

Minimum that allows debugging project with netbeans is very simple: implement attaching gdbserver!
http://clip2net.com/clip/m46295/1304436072-clip-11kb.png
Comment 2 puchuu 2011-05-03 15:29:38 UTC
suddenly found a log to the plugin GdbServer in uigestures
<message>Cannot run program "/usr/bin/gdb" (in directory "F:\Debian_squeeze\shared\puchuupp"): CreateProcess error=2, ?? ??????? ????? ????????? ????</message>
  <exception>
    <message>java.lang.Exception: Cannot run program "/usr/bin/gdb" (in directory "F:\Debian_squeeze\shared\puchuupp"): CreateProcess error=2, ?? ??????? ????? ????????? ????</message>
    <frame>
      <class>org.netbeans.modules.cnd.debugger.common2.utils.ExecutorCND</class>
      <method>startEngine</method>
      <line>208</line>
      <file>${netBeansDir}modules/org-netbeans-modules-cnd-debugger-common2.jar</file>
    </frame>
    <frame>
      <class>org.netbeans.modules.cnd.debugger.gdb2.Gdb$Factory</class>
      <method>startAsync</method>
      <line>468</line>
      <file>${netBeansDir}modules/org-netbeans-modules-cnd-debugger-gdb2.jar</file>
    </frame>
    <frame>
      <class>org.netbeans.modules.cnd.debugger.gdb2.Gdb$Factory</class>
      <method>access$800</method>
      <line>172</line>
      <file>${netBeansDir}modules/org-netbeans-modules-cnd-debugger-gdb2.jar</file>
    </frame>
    <frame>
      <class>org.netbeans.modules.cnd.debugger.gdb2.Gdb$Factory$1</class>
      <method>run</method>
      <line>297</line>
      <file>${netBeansDir}modules/org-netbeans-modules-cnd-debugger-gdb2.jar</file>
    </frame>
    <frame>
      <class>org.openide.util.RequestProcessor$Task</class>
      <method>run</method>
      <line>1424</line>
      <file>${netbeans.home}lib/org-openide-util.jar</file>
    </frame>
    <frame>
      <class>org.openide.util.RequestProcessor$Processor</class>
      <method>run</method>
      <line>1968</line>
      <file>${netbeans.home}lib/org-openide-util.jar</file>
    </frame>
  </exception>
Comment 3 Egor Ushakov 2011-05-03 16:07:44 UTC
you need to attach from local configuration
Comment 4 puchuu 2011-05-03 16:18:41 UTC
okey I make this:
1) Select localhost as default developer host
http://clip2net.com/clip/m46295/1304439089-clip-14kb.png
2) Press attach and ok - it connected successfully
http://clip2net.com/clip/m46295/1304439170-clip-11kb.png
3) But it can't change directory
http://clip2net.com/clip/m46295/1304439232-clip-13kb.jpg

how to attach debugger without changing directory?
Comment 5 Egor Ushakov 2011-05-03 19:25:35 UTC
you can have debugger console opened to see what gdb commands it executes (main menu/windows/debugging/debugger console). Most probably you need to set propper directory in project properties.
Comment 6 Vladimir Kvashin 2011-05-04 07:16:54 UTC
Just a comment concerning zero files.
In "Automatic copy" mode IDE copies files into a special place that isn't supposed to be used by user directly. Let me explain how "Automatic copying" works. Files are copied on demand - a special shared library that is preloaded when building, interposes all file related calls; so IDE copies a file just at the moment build tries to open it. The problem is that Linux does not allow to interpose stat() call. Because of that all files are first initialized by zeros (note that this won't waste disk space), to have directory structure in place. Zeroes in CMakeOutput.log means just that it wasn't open when building. (Or that there is a bug in this complex machinery I just described). But that's a matter of a different discussion, you can file a bug or discuss this via email...
Comment 7 puchuu 2011-05-04 17:29:12 UTC
oh my god!!! inventing a wheel? I was sure that you use rsync!! rsync doesn't belongs to java way or what?

The question for you is "why doesn't your complex super mega wheel work?"
Comment 8 slonik 2015-01-12 13:14:22 UTC
I am getting:

{PATH_TO_PROJECT}: inappropriate ioctl for device.

I am on win7, have a debian remote build host, cross compiling to arm target.

I have correctly setup the gdb path in my build host.

I can debug like this:

dan@linuxbuilder:/usr/src/buildroot-at91/output/host/usr/bin$ arm-linux-gdb ~/9302/lw/ix_port                                                                                           
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-buildroot-linux-uclibcgnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/dan/9302/usr/local/bin/arm/linwax/ix_port...done.
(gdb) target extended-remote 192.168.69.222:12345
Remote debugging using 192.168.69.222:12345
Note: breakpoint 1 also set at pc 0x961c.
Breakpoint 2 at 0x961c
(gdb) r
Starting program: /home/dan/9302/usr/local/bin/arm/linwax/ix_port 
Running the default executable on the remote target failed; try "set remote exec-file"?
(gdb) set remote exec-file /lw/ix_port
(gdb) r
Starting program: /home/dan/9302/usr/local/bin/arm/linwax/ix_port 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Cannot access memory at address 0x0
warning: `/lib/libpthread.so.0': Shared library architecture unknown is not compatible with target architecture arm.
warning: Could not load shared library symbols for 6 libraries, e.g. /lw/ix_port.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

Breakpoint 1, gen_msg (msg=0xabc0 "IX_PORT -- No Command line given\n") at library/debug.c:328
328             if (my_slug != -1)
(gdb)