[Mono-dev] Debugging with MonoDevelop
Francois Schelling
fschelling at square-enix-montreal.com
Tue Nov 20 01:23:10 UTC 2012
Hi,
I've just did a test by running everything in Win32 (x86) and this is working. With my Mono build, my test app and my test assembly compiled in x86, I'm able to attach to the my C# assembly, put breakpoints and debug it. So the issue seems to come from the Mono library build in x64. Anyone have been able to Debug with MonoDevelop with an x64 version on Mono 3.0.1?
Also, it seems that I'm unable to launch my c++ app from Visual Studio and attach to the assembly with MonoDevelop. I'm only able to debug if I launch my app manually from explorer. Anyone know how to achieve that?
Francois Schelling
Senior Programmer
Square Enix Montréal
fschelling at square-enix-montreal.com
-----Original Message-----
From: Francois Schelling
Sent: 19 November 2012 14:15
To: Francois Schelling; Andres G. Aragoneses; mono-devel-list at lists.ximian.com
Subject: RE: [Mono-dev] Debugging with MonoDevelop
Hi again,
I've tried to repro the same setup on a small test app and still have the result. Here my c++ code. On the C# assembly, I only have one class with an empty Main. When putting a break point, it triggers and exception, without breakpoint, everything is fine.
I'm using Mono 3.0.1 for Windows and using a custom x64 build of Mono 3.0 for my Mono library. I'm building my c# assembly with MonoDevelop using Mono / .Net 4.0 as the Target framework.
void InitMono()
{
mono_set_assemblies_path("./");
if(debugMono)
{
// Debugging w/Embedded Mono how to set breakpoints in C# code?
static const char* options[] = {
"--soft-breakpoints",
"--debugger-agent=transport=dt_socket,address=127.0.0.1:10000"
};
mono_jit_parse_options(sizeof(options)/sizeof(char*), (char**)options);
mono_debug_init(MONO_DEBUG_FORMAT_MONO);
}
m_MainMonoDomain = mono_jit_init_version("MainDomain", "v4.0.30128");
m_GameMonoDomain = mono_domain_create_appdomain("GameDomain", NULL);
if(debugMono)
{
mono_debug_domain_create(m_GameMonoDomain);
}
m_GameMonoAssembly = mono_domain_assembly_open(m_GameMonoDomain, "MonoGame.exe");
if(!m_GameMonoAssembly)
{
printf("Error: Cannot find assembly MonoGame.exe");
return false;
}
m_GameMonoImage = mono_assembly_get_image(m_GameMonoAssembly);
if (!m_GameMonoImage)
{
printf("Error: Cannot create image for assembly GameMono.exe");
return false;
}
char* args[1];
args[0] = "game-mono.exe";
mono_jit_exec(m_GameMonoDomain, m_GameMonoAssembly, 1, args); }
Francois Schelling
Senior Programmer
Square Enix Montréal
fschelling at square-enix-montreal.com
-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Francois Schelling
Sent: 16 November 2012 11:47
To: Andres G. Aragoneses; mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Debugging with MonoDevelop
I've got two questions:
1- I'm now able to generate the mdb file by compiling with MonoDevelop. But I had to install Mono 3.0.1 for Windows in order to add a new .NET runtimes in MonoDevelop. But I'm currently building my own Mono version since I need it to be in x64. Is it the right way to do it our mixing the use of these two mono versions is wrong?
2- I'm now able to attach the MonoDevelop to my mono domain but when a breakpoint is triggered, my main app crashed on:
- Unhandled exception at 0x774d8e3d in engine.exe: 0xC0000005: Access violation writing location 0x00000000000c0a98
and I got the following message in MonoDevelop
- System.NullReferenceException has been thrown.
Francois Schelling
Senior Programmer
Square Enix Montréal
fschelling at square-enix-montreal.com
-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Andres G. Aragoneses
Sent: 16 November 2012 08:54
To: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Debugging with MonoDevelop
IIRC, MS.NET compiler generates .pdb files, while Mono's generates .mdb files. So using MonoDevelop + MS.NET won't help. Use MonoDevelop in Linux, or install Mono for Windows (and configure MonoDevelop to build with Mono, not .NET).
On 16/11/12 13:25, Francois Schelling wrote:
> Thanks for the link. What I'm missing is the .mdb file. How do you generate that? I'm currently building a C# solution I've created with VS Studio 2010 on Windows and I can compile it with both VS or MonoDevelop.
>
> Francois Schelling
> Senior Programmer
> Square Enix Montréal
> fschelling at square-enix-montreal.com
>
>
>
>
>
>
>
> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com
> [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of
> Guillaume George
> Sent: 16 November 2012 01:59
> To: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Debugging with MonoDevelop
>
> Hi,
>
> I have just worked on this topic this morning.
> You will find a nice article about this right there :
> http://www.jeffongames.com/2012/03/debugging-embedded-mono/
>
> Regards,
>
>
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/Debugging-with-MonoDevelop-tp4657403
> p4657406.html Sent from the Mono - Dev mailing list archive at
> Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs
> ______________________________________________________________________
>
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
______________________________________________________________________
This email has been scanned by the MessageLabs ______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs ______________________________________________________________________
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
______________________________________________________________________
This email has been scanned by the MessageLabs ______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs
______________________________________________________________________
More information about the Mono-devel-list
mailing list