Starting ddd with remote gdbserver - linux

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

Related

Run a gui based application on a remote Linux machine using telnet

I need to run a gui-based application on a remote PC to which I am connected over telnet. The remote PC runs Linux Ubuntu 18.04
To figure out the screen, I run the following command on the remote machine:
echo $DISPLAY
which gave me :1 as result.
Then I run the program on the remote machine from my client (over telnet) using:
DISPLAY=:1 application_name
The program started correctly (since, in addition to the GUI, it prints some things on the command line) but the GUI didn't show up. But, if I run my app directly on the remote machine, everything is fine.
As a test, I tried to run firefox browser on an another machine (always through telnet) with the following command:
DISPLAY=:0 firefox
and it worked. Note: on the other machine the output of echo $DISPLAY was :0. Furthermore, I could not test my app on the second machine.
It seems that there are different settings between the two machines since what I'm trying to do works on a machine, but not on the other.
Do you have any idea of what type of setting should I check?
Did you try to run your application on the first remote machine but with DISPLAY=:0 instead of :1?
What is the error message you get from application when you started application in the first case ("DISPLAY=:1 app_name").

Gitlab Executor TTY

I'm trying to leverage Gitlab Runner to execute builds on remote machine. I have the runner and am using the shell executor to kick off builds locally. Unfortunately, I'm receiving the following error when I kick off something:
Using Shell executor...
standard in must be a tty
ERROR: Job failed: exit status 1
I suspect this is occurring because the user that I'm passing in with the --user parameter can access tty. Any thoughts on how to get this working? The shell type is bash.
Check first if GitLab is doing a sudo once connected to the remote machine, to change user.
If that is the case, with visudo (on that remote machine), do:
Defaults:[username] !requiretty
If not, as in here, check if this is a JVM initialization issue.

Remote debug with gdbServer

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

MPJ Express -- runtime.MPJRuntimeException: Cannot connect to the daemon at machine <x> and port <10000>

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.

How to debug a remote linux binary?

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.

Resources