1) I start GDB on remote machine by gdb myAppName
2) Then i give run -p portNumber
3) Then i run java application which connect with it on above mentioned port.
Now when i am trying to remote debug via gdbserver then the scenario is
1) I run gdb server on remote machine
gdbserver host:port path to application
Now when i try to connect my java client application to the gdbserver port .It will not be able to connect.
So i am searching of alternative of run -p command of gdb in gdb server
What i was trying was remote debugging of C code via eclipse CDT
Any help would be highly appreciated.
gdbserver can be started attached to a pid on some systems according to the docs using the following syntax which is different than the normal invocation
gdbserver hostname : port --attach pid
or gdb can be started with a program that is subsequently started by the remote machine
gdbserver hostname : port program
and then you can attach to it from another remote gdb using
(gdb) target remote hostname: port
Eclipse would probably do the same thing so long at the remote gdbserver is invoked as above
and then start the remote program using a different port
(gdb) run -p someotherport
This 2nd invocation, from your comments above, I assume you have created some flag to your program that allows it to bind to someotherport
Related
I'm new to Grails and attempting to implement the Hello World app described at grails.org's Getting Started guide.
I have installed Grails using SDKman on an Ubuntu Server 16.04 VM (VirtualBox, running as a service). My host machine is Windows 10.
I configured two network adapters in VirtualBox: the first a NAT with port forwarding (3022 host -> 22 guest, 8080 host -> 8080 guest), the second a Host-Only adapter.
I can SSH into my VM just fine from my Windows host (using Bash): ssh -p 3022 user#localhost
When I run python3 -m http.server 8080 from that SSH session, it successfully listens on both localhost:8080 and :8080. I can access both URLs from a browser on my host machine.
When I run grails run-app it hangs forever, and none of the above endpoints work from my host.
When I run grails run-app --verbose I see it compile without complaint through "Building 85% > :bootRun". I understand that this is expected behavior, but I never see "Application started" or any similar message. It never starts.
ONE TIME the following command succeeded in building and running the app, creating exactly the result I needed:
grails -Dserver.port=8080 -Dserver.host=0.0.0.0 run-app --verbose --stacktrace
However when I stopped the app and tried again, it failed as before.
I notice that VirtualBox > Settings > Network > Adapter #2 which I had set as "Host-Only Network" has multiple times reset itself to Bridged. I suspect that this reset may have caused my problem. But I don't know how to prevent the reset, or to restore that functionality I so briefly had.
Thanks, anyone who can help!
Resolved! Turns out run-app just takes a LONG time to finish compiling and building, upwards of 10 minutes. So I just needed to wait ~5+ minutes with no visual sign of action before the completion message would show and I could access my site. :)
I just get trouble to use ndk-gdb to debug my native application. This is my environment:
OS X El Captain 10.11.5
NDK version r12
SDK version 24
Build tool version 24.0.0
Device Nexus 6P with Android N (NPD35K)
The issue:
When I was going to launch ndk-gdb it always fail with the message
Error: unable to connect to device.
Remote connection closed
However, the gdbserver instance has already been launched since my app is paused and I could see the gdbserver in adb shell ps list.
What I have tried:
Instead of start gdbserver by the ndk-gdb script, I launched the
gdbserver manually by adb run-as and make sure the gdbserver
keeps running
Make a socket forward by adb forward :5039 localfilesystem:/the_gdb_socket_path
Use netstat -na | grep 5309 to make sure the port is being listening
Use telnet localhost 5039 to test socket but get the error Connection closed by foreign host
Is there any better way to identify where the issue cause the remote gdb failed on connection?
In my case, I had to root the phone to fix that connection issue, see:
Does ndk-gdb work under macOS Sierra?
i am facing problem while configuring MPJ Express in cluster mode.
i am following the guide given at
http://mpj-express.org/docs/guides/linuxguide.pdf
the environment variables are successfully Initialized as
1)
Set MPJ_HOME and PATH variables
a. export MPJ_HOME=/path/to/mpj/
b. export PATH=$PATH:$MPJ_HOME/bin
2)
the machines are also added successfully with a machines file as
mpjboot machines
it shows message
starting mpjd...
3)
Next step is to test the HelloWolrd program by
Compile:
javac -cp .:$MPJ_HOME/lib/mpj.jar HelloWorld.java
10. Execute: mpjrun.sh -np 2 –dev niodev HelloWorld
when i do that i get this error
runtime.MPJRuntimeException: Cannot connect to the daemon at machine and port <10000>
The Platform i am using is
Sun Ultra 25 workstations with Solaris 10 OS
i have made a Fast Ethernet cluster of 2 machines
ssh is enabled with root user on each machine
network is established well
any help or solution is appreciated..
thank you
Examine the cluster nodes environment variables.
Try adding vars to .bashrc in each cluster node (ssh to it from main node):
echo 'export MPJ_HOME=/home/<user>/path/to/mpj' >> ~/.bashrc
echo 'export PATH=$PATH:$MPJ_HOME/bin' >> ~/.bashrc
Alternately, turn on logging /conf/wrapper.conf, run and report your findings.
This is the first time i give an answer in stackOverflow.
I set up MPJExpress-v0_42 in my centos6.3 with jdk1.6.0_32, and finally everything seems OK.
Question 1: can not connect to daemon at machine and port
This may happens that the daemon is not running. You can give a try as follows:
you can use sudo netstat -anp |grep port to check whether the port is listening and also get the processId.
In my machine, after I started the daemon using mpjdaemon -boot localhost, I used the sudo netstat -apn |grep 4000 command to check the port and got the followings.
tcp 0 0 :::40000 :::* LISTEN 8766/java
tcp 0 0 :::40001 :::* LISTEN 8766/java
the port is configured in $MPJ_HOME/conf/wrap.conf and my configuration is as follows:
#port number for the daemon.
wrapper.app.parameter.2=40001
#Socket Server Port Number.
wrapper.app.parameter.3=40000
I also use the jps -m command to get the java daemon process, the result is as follows:
8766 MPJDaemon 40001
30850 Jps -m
Here 8766 is the processId as netstat shows, and MPJDaemon is the daemon process, 40001 is the listening port.
In your question, you cannot connect the daemon process. Do the followings:
you should check the port. If you cannot find the port using netstat, it generally means the MPJDaemon is not running.
To be sure, you can also using jps to check the process. Maybe process is running but the port is another one
Do not use the Cluster commands like mpjboot machines or mpjrun.sh -np 2 -dev niodev HelloWorld. You can use mpjdaemon -boot localhost to test current machine, if it is configured OK and you can set the machines file with one item of localhost and run Cluster commands.
Other questions that I met.
Question 2: compile failed using ant
At first I use MPJ-v0_44.zip and jdk1.6.0, but it cannot compile and give an error that ProcessBuilder has no method of "interNIO"(something like that). I analyse the source code and guess may be it is because JDK version is a litter lower. Given the fact that upgrading JDK is a litter complicated, I find another MPJ version of mpj-v0_42.zip and it compiled OK.
Question 3: mpjdaemon -boot localhost with no error message, but MPJDeamon is not running.
After I configure the environment variables like MPJ_HOME from .bash_profile to .bashrc, the question is resolved. I don't know why.
Question 4: command jps -m says "MPJDeamon is running" , but mpjdaemon -status localhost says "mpjdeamon is not running".
I use command (ssh localhost nohup 'jps -m') and it says jps command not found, but i use jps the command works fine. I guess maybe it is the same question as above. The jps's path is not configured in path environment variable of .bashrc. So after adding one line of PATH=/jpspath:$PATH in .bashrc, everything works fine.
I'm debugging a program that runs on a remote target using ddd ( the remote gdbserver is running on localhost over port 1234 for example, but still acts as remote).
I know you can connect to the gdbserver by opening ddd, then calling target remote localhost:1234 on the gdb command line of ddd, as described in:
http://www.gnu.org/software/ddd/manual/html_mono/ddd.html#Remote%20Program
However, I hate having to call the target remote localhost:1234 command every time I open ddd, and I'd like to set it to connect to the gdbserver automatically with an alias. I tried running ddd --rhost localhost:1234 program, but once ddd launches a window pops stating that "GDB could not be started", and in the shell written:
sh: 1: exec: localhost:1234: not found
Anyone knows how can I attach to the remote gdbserver right on launch?
Tnx!
Choose one of:
ddd --eval-command="target remote localhost:1234"
put target remote localhost:1234 into a file and use --command
to execute it
put target remote localhost:1234 into your .gdbinit
Here is the situation:
I've got a linux binary that is crashing. No log files, trace files, etc. I need to be able to attach a debugger to it (I have the source locally) and track down the error.
Whats the easiest, best way to approach this problem?
Remote debugging is rather straightforward: on the target platform, launch the application with GDBserver, while specifying the host and port for listening to an incoming TCP connection:
gdbserver HOST:PORT PROG [ARGS ...]
On the development workstation, launch the cross-target GDB:
powerpc-7450-linux-gnu-gdb PROG
Be sure to specify the non-stripped executable. At the GDB console, type:
target remote HOST:PORT
break main
continue
Remote cross-target debugging with GDB and GDBserver
It looks like gdb supports remote debugging.
I've never used it but http://davis.lbl.gov/Manuals/GDB/gdb_17.html looks like a start.
Basically you run the program under gdbserver on the target machine, and gdb connects (over TCP or serial) to the gdbserver.