[Mono-osx] Debug embedded OSX app

Duane Wandless duane at wandless.net
Sat Dec 12 10:49:18 EST 2009


I'm finally very close to enabling the soft debugger for embedded OSX
applications.  Any help would be greatly appreciated.  I am blocked on the
MD debugger not responding to the remote app.  Is this issue related to the
debugger needing to be signed or something similar?

I now can invoke the debugger and have it launch my cocoa app.  I see the
Waiting for debugger to connect message.  And in the console I see these 2
lines and no other errors:

12/12/09 9:44:04 AM Firewall[72] mono is listening from 127.0.0.1:10001proto=6
12/12/09 9:44:04 AM Firewall[72] mono is listening from 127.0.0.1:52690proto=6

But the invoked app hangs with this call stack:
#0  0x97c056ca in recvfrom$NOCANCEL$UNIX2003 ()
#1  0x97c6fe99 in recv ()
#2  0x00a9e906 in transport_connect (host=0x150c440 "127.0.0.1", port=10001)
at debugger-agent.c:1003
#3  0x00a9e12d in finish_agent_init (on_startup=1) at debugger-agent.c:809
#4  0x00a9df90 in mono_debugger_agent_init () at debugger-agent.c:763
#5  0x009d6b20 in mini_init (filename=0x150c100
"/Users/me/Src/sandbox/dec10/svn/my_files/PFiles/build/Debug/PFiles.app/Contents/Libraries/MacMonoClient.exe",
runtime_version=0x0) at mini.c:5109
#6  0x00a5e59a in mono_jit_init (file=0x150c100
"/Users/me/Src/sandbox/dec10/svn/my_files/PFiles/build/Debug/PFiles.app/Contents/Libraries/MacMonoClient.exe")
at driver.c:1892
#7  0x0004fbf7 in InitMono (argc=1, argv=0xbffff644) at
/Users/me/Src/sandbox/nov05/svn/InitMono/initmono.m:42

To get the call stack I launch a dummy app and then launch the real app from
within xcode that attempts to connect.  And yes I did try launching the real
app directly as well with:
var psi = new ProcessStartInfo ("open",
"/Users/me/Src/sandbox/nov05/svn/working/PFiles/build/Debug/PFiles.app")

If I cancel in the MD debugger connecting window I get this immediately from
the xcode app:
debugger-agent: DWP handshake failed.

I disabled the Firewall just in case with no change.  But since the cocoa
app responds to the cancel from MD I believe the connection is sort of
established.

Here is my init code:
MonoDomain *domain;

NSString *libraryPath = [[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@"Contents/Libraries"];
NSString *sampleAssemblyPath = [libraryPath stringByAppendingPathComponent:@
"MacMonoClient.exe"];

NSLog(@"libraryPath: %@", sampleAssemblyPath);

mono_config_parse ("config");

        NSLog(@"about to check for MOON_SOFT_DEBUG");
const gchar *soft_debug;
soft_debug = g_getenv ("MOON_SOFT_DEBUG");
if (soft_debug != NULL) {
NSLog(@"we have MOON_SOFT_DEBUG %s", soft_debug);
gchar *opt = g_strdup_printf ("--debugger-agent=%s", soft_debug);
mono_jit_parse_options (1, &opt);
g_free (opt);
}

mono_debug_init (MONO_DEBUG_FORMAT_MONO);

domain = mono_jit_init ([sampleAssemblyPath UTF8String]);

Thanks,
Duane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20091212/3fb59af2/attachment-0001.html 


More information about the Mono-osx mailing list