[MonoDevelop] remote debugging a hello world application

Ian Norton ian.norton-badrul at thales-esecurity.com
Fri Apr 27 06:33:54 UTC 2012


Jerrill <jerrill at gmail.com> wrote:

>I'm ultimately going to try and remote debug an application on an
>embedded
>Linux device, but I though I would try out the process locally first
>and
>have run into a problem.
>
>I have the following application (debug-test.cs):
>
>-----------------------
>using System;
>
>namespace debugtest
>{
>	class MainClass
>	{
>		public static void Main (string[] args)
>		{
>			Console.WriteLine ("Hello World once!"); //breakpoint here!
>			Console.WriteLine ("Hello World twice!");
>			Console.WriteLine ("Hello World three times!");
>		}
>	}
>}
>---------------------
>
>I launch MonoDevelop 2.6 on Ubuntu 11.10 with the environment variable
>MONODEVELOP_SDB_TEST set to 1. This gives me the Run->Run With->Custom
>Command Mono Soft Debugger option. I start the debugger listening on
>port
>127.0.0.1:10000 and get the "Waiting for debugger to connect..."
>window.
>
>From the command line I execute the following:
>
>mono --debug
>--debugger-agent=transport=dt_socket,address=127.0.0.1:10000
>debug-test.exe
>
>And nothing happens.... The "Waiting for debugger to connect..." window
>never goes away. I can confirm that a connection is made as follows:
>
># netstat -n inet
>Active Internet connections (w/o servers)
>Proto Recv-Q Send-Q Local Address           Foreign Address        
>State      
>...
>tcp       13      0 127.0.0.1:10000         127.0.0.1:44421        
>ESTABLISHED
>...
>
>And when I click the Cancel button, only then does the command prompt
>reappear after the following message:
>
>debugger-agent: DWP handshake failed.
>
>If I run the debugger without the listener running I get the following:
>
>debugger-agent: Unable to connect to 127.0.0.1:10000
>
>So *something* is happening, but it doesn't appear to be a debugging
>session.
>
>If I debug with Run->Run With->Mono Soft Debugger I can successfully
>debug.
>When I inspect how this is all invoked I get the following:
>
>#ps aux
>USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
>COMMAND
>...
>jerrill   8159  0.1  0.6  65712 13752 pts/1    Sl+  01:03   0:00
>/usr/bin/gnome-terminal --disable-factory --title MonoDevelop External
>Console -e bash -c 'cd
>/home/jerrill/projects/debug-test/debug-test/debug-test/bin/Debug ;
>/usr/bin/mono  --debug
>--debugger-agent=transport=dt_socket,address=127.0.0.1:44327
>"/home/jerrill/projects/debug-test/debug-test/debug-test/bin/Debug/debug-test.exe"
>
>; echo; read -p "Press any key to continue..." -n1;'
>
>jerrill   8163  0.0  0.0   2212   720 pts/1    S+   01:03   0:00
>gnome-pty-helper
>
>jerrill   8164  0.0  0.0   5396  1128 pts/3    Ss+  01:03   0:00 bash
>-c cd
>/home/jerrill/projects/debug-test/debug-test/debug-test/bin/Debug ;
>/usr/bin/mono  --debug
>--debugger-agent=transport=dt_socket,address=127.0.0.1:44327
>"/home/jerrill/projects/debug-test/debug-test/debug-test/bin/Debug/debug-test.exe"
>
>; echo; read -p "Press any key to continue..." -n1;
>
>jerrill   8165  0.0  0.1  13924  3880 pts/3    Sl+  01:03   0:00
>/usr/bin/mono --debug
>--debugger-agent=transport=dt_socket,address=127.0.0.1:44327
>/home/jerrill/projects/debug-test/debug-test/debug-test/bin/Debug/debug-test.exe
>
>I can see that my assembly is being invoked nearly the same way, except
>for
>using the hidden addin in the failing case.
>
>Can anyone shed some light on what I'm doing wrong? 
>
>Thank you in advance for your help!
>Jerrill
>
>--
>View this message in context:
>http://mono.1490590.n4.nabble.com/remote-debugging-a-hello-world-application-tp4591791p4591791.html
>Sent from the Mono - MonoDevelop IDE mailing list archive at
>Nabble.com.
>_______________________________________________
>Monodevelop-list mailing list
>Monodevelop-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/monodevelop-list

You are doing all the right things, I could only get this working with mono 2.10.8 and monodevelop 2.8.x as built from sources, checkout my pmono ubuntu packages. I use them at work and often do remote debug.

Ian


More information about the Monodevelop-list mailing list