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

Duane Wandless duane at wandless.net
Thu Jan 28 18:15:05 EST 2010


I have not had time to use this on Mono 2.6 GA.  When I tried, the addin was
not working for me.  Has anyone updated the addin to work with the GA
release?

Thanks,
Duane

On Mon, Dec 14, 2009 at 10:09 AM, Duane Wandless <duane at wandless.net> wrote:

> The box.net file is my project to create the 2 addins required to enable
> debugging an embedded application using MD 2.2RC and Mono 2.6RC.
>
> IMPORTANT:  For some reason only right clicking in the Solution explorer
> and selecting Debug Item works.  I did not even attempt to investigate this.
>  In other words the menu items Run | Debug and Run | Run do not work.  And
> right clicking in the solution explorer and selecting Run Item does not work
> either.
>
> http://www.box.net/shared/lskor4zxgc
>
> You must edit EmbeddedSoftDebuggerSession.cs and change this line:
> var psi = new ProcessStartInfo ("open", "<full path to your>.app")
>
> Then build both projects.  Then from the command line go into the repos
> directory and type:
> ./clean
> ./docopy
>
> This will create a MD addin repository in the directory three.
>
> Then go to MD and click Tools | Addin Manager.  Click Repositories.  Click
> Add.  Check Register a local repository.  Select the directory three.  Click
> Install Addins.  At this point you should have two options.  Debugging and
> Embedded.  Install both.  Restart MD.
>
> Create a new project and select EmbeddedProject.  You can change this to be
> a DLL or EXE based on how you are embedding.
>
> You can modify an existing project (at least this worked for me) to be an
> EmbeddedProject by editing the csproj file directly.  Add this line after
> the <ProjectGuid> entry:
>
>  <ProjectTypeGuids>{84408980-E7F5-11DE-B313-B87456D89593};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
>
> Best of luck!
> Duane
>
> On Mon, Dec 14, 2009 at 8:55 AM, ptr <ptrajkumar at gmail.com> wrote:
>
>>
>>
>> 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/monodevelop-list/attachments/20100128/ed58e009/attachment-0001.html 


More information about the Monodevelop-list mailing list