[Mono-osx] [MonoDevelop] Debug embedded OSX app

ptr ptrajkumar at gmail.com
Mon Dec 14 08:55:40 EST 2009


On Sat, Dec 12, 2009 at 11:55 AM, Duane Wandless <duane at wandless.net> wrote:

> Here is my create process code.  Is this the code in question?
>
>                         Process browser;
> var psi = new ProcessStartInfo ("open",
> "/Users/me/Src/sandbox/nov05/svn/working/PFiles/build/Debug/PFiles.app") {
>  UseShellExecute = false,
> RedirectStandardOutput = false,
> RedirectStandardError = true,
>  };
> psi.EnvironmentVariables.Add ("MOON_SOFT_DEBUG",
> string.Format ("transport=dt_socket,address={0}:{1}", dsi.Address,
> dsi.DebugPort));
>  browser = Process.Start (psi);
> ConnectOutput (browser.StandardOutput, false);
>  ConnectOutput (browser.StandardError, true);
>
> I did modify the Waiting for debugger to connect message to print out both
> DebugPort and OutputPort.  OutputPort is zero.
>
> protected override string GetListenMessage (RemoteDebuggerStartInfo dsi)
> {
>  return string.Format("Waiting for debugger to connect at
> {0}:dbg{1}:con{2}", dsi.Address, dsi.DebugPort, dsi.OutputPort);
> }
>
> Thanks,
> Duane
>
> On Sat, Dec 12, 2009 at 11:12 AM, Geoff Norton <gnorton at novell.com> wrote:
>
>> Duane,
>>
>>   How are you initializing the remove debug agent?  It sounds like you're
>> listening for a console connection as well, but not connecting to that port.
>>
>> -g
>>
>> On 2009-12-12, at 10:49 AM, Duane Wandless wrote:
>>
>> 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
>>
>>

Hey Duane

    Did you get this to work on MAC, If so I was wondering if you like to
share it with everybody ? There is hardly any documentation anywhere so I
don't even know where to start ?


Thanks
Raj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20091214/c2daf495/attachment.html 


More information about the Mono-osx mailing list