Forum: IronRuby Debugging ruby code in a host

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-03-23 21:01
(Received via mailing list)
Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need
to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are
described in the wiki but had no success. I have a debug version of
IronRuby
and I'm using it in a C# ASP.NET MVC project with the
System.Web.Mvc.IronRuby dll as a reference. The web application hosts
the
scriptruntime etc. Now what do I need to do to make visual studio break
on
the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces
etc. again the question how springs to mind? :)

Thanks
Ivan
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-03-23 21:36
(Received via mailing list)
Is DebugMode property of the ScriptRuntimeSetup of the ScriptRuntime you
run the script in set to true?

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Monday, March 23, 2009 12:32 PM
To: ironruby-core
Subject: [Ironruby-core] Debugging ruby code in a host

Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are described in the wiki but had no success. I have a debug version of
IronRuby and I'm using it in a C# ASP.NET<http://ASP.NET> MVC project
with the System.Web.Mvc.IronRuby dll as a reference. The web application
hosts the scriptruntime etc. Now what do I need to do to make visual
studio break on the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces etc. again the question how springs to mind? :)

Thanks
Ivan
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-03-23 21:46
(Received via mailing list)
When you create the ScriptRuntimeSetup, do this:

setup.Debug = true;

That will tell the DLR to generate debuggable code.

________________________________
From: ironruby-core-bounces@rubyforge.org
[ironruby-core-bounces@rubyforge.org] on behalf of Ivan Porto Carrero
[ivan@flanders.co.nz]
Sent: Monday, March 23, 2009 12:32 PM
To: ironruby-core
Subject: [Ironruby-core] Debugging ruby code in a host

Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are described in the wiki but had no success. I have a debug version of
IronRuby and I'm using it in a C# ASP.NET<http://ASP.NET> MVC project
with the System.Web.Mvc.IronRuby dll as a reference. The web application
hosts the scriptruntime etc. Now what do I need to do to make visual
studio break on the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces etc. again the question how springs to mind? :)

Thanks
Ivan
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-03-23 21:47
(Received via mailing list)
Woops ... setup.DebugMode (like Tomas said)

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jimmy
Schementi
Sent: Monday, March 23, 2009 1:32 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Debugging ruby code in a host

When you create the ScriptRuntimeSetup, do this:

setup.Debug = true;

That will tell the DLR to generate debuggable code.

________________________________
From: ironruby-core-bounces@rubyforge.org
[ironruby-core-bounces@rubyforge.org] on behalf of Ivan Porto Carrero
[ivan@flanders.co.nz]
Sent: Monday, March 23, 2009 12:32 PM
To: ironruby-core
Subject: [Ironruby-core] Debugging ruby code in a host
Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are described in the wiki but had no success. I have a debug version of
IronRuby and I'm using it in a C# ASP.NET<http://ASP.NET> MVC project
with the System.Web.Mvc.IronRuby dll as a reference. The web application
hosts the scriptruntime etc. Now what do I need to do to make visual
studio break on the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces etc. again the question how springs to mind? :)

Thanks
Ivan
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-03-23 22:38
(Received via mailing list)
Yes.. I'll try again.. maybe I missed something.
I should really say that the file that has the ruby code is an assembly
resource that gets read through an AssemblyReaderStreamContentProvider.
Should I be providing that content differently?

http://github.com/casualjim/ironrubymvc/blob/57cfa...

I use http://gist.github.com/74979 to set a breakpoint.




2009/3/23 Tomas Matousek <Tomas.Matousek@microsoft.com>
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-03-23 22:56
(Received via mailing list)
The file you are setting breakpoint to needs to exists on the disk for
Visual Studio debugger to work.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Monday, March 23, 2009 2:14 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Debugging ruby code in a host

Yes.. I'll try again.. maybe I missed something.
I should really say that the file that has the ruby code is an assembly
resource that gets read through an AssemblyReaderStreamContentProvider.
Should I be providing that content differently?

http://github.com/casualjim/ironrubymvc/blob/57cfa...

I use http://gist.github.com/74979 to set a breakpoint.



2009/3/23 Tomas Matousek
<Tomas.Matousek@microsoft.com<mailto:Tomas.Matousek@microsoft.com>>

Is DebugMode property of the ScriptRuntimeSetup of the ScriptRuntime you
run the script in set to true?



Tomas



From:
ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>
[mailto:ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>]
On Behalf Of Ivan Porto Carrero
Sent: Monday, March 23, 2009 12:32 PM
To: ironruby-core
Subject: [Ironruby-core] Debugging ruby code in a host



Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are described in the wiki but had no success. I have a debug version of
IronRuby and I'm using it in a C# ASP.NET<http://ASP.NET> MVC project
with the System.Web.Mvc.IronRuby dll as a reference. The web application
hosts the scriptruntime etc. Now what do I need to do to make visual
studio break on the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces etc. again the question how springs to mind? :)

Thanks
Ivan

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-03-23 23:31
(Received via mailing list)
Ok it works when I use
Engine.RequireRubyFile("C:\path\to\file\controller.rb")
but not when i use a custom streamcontent provider that knows how to
deal
with virtual paths.

like
http://github.com/casualjim/ironrubymvc/blob/57cfa...

Anyway I'll take the stream content providers out and just put something
in
that handles mappath to allow debugging.

But now the question becomes When would I want to use a
StreamContentProvider and when should I have to create a PAL ?  Would
using
a PAL be a better idea to when hosting it in a webserver?

2009/3/23 Tomas Matousek <Tomas.Matousek@microsoft.com>
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-03-24 02:56
(Received via mailing list)
PAL provides more general virtualization of file system (though still
not complete). By using custom content providers for a ScriptSource it
only affects one particular ScriptSource while PAL is used by other API
as well. For example, File#open goes thru PAL:
context.DomainManager.Platform.OpenInputFileStream(path, fileMode,
access, share);

Also, content of required files is read via PAL: see
Microsoft.Scripting\SourceFileContentProvider.cs.

So, PAL allows the host to make basic file IO operations work – you can,
for example, build virtual file system based on Isolated Storage or some
database table. The virtualization is not complete, we are looking for
reasonable set of API that it make sense to virtualize. If you find
something you would need let us know.

Sadly, Visual Studio debugger requires source files to be physical files
on disk. If you need to debug some code stored in a database you need to
save it to a file. You might want to do so only when DebugMode is on. If
it is not, PDBs are not generated anyways so the code is not debuggable
by VS.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Monday, March 23, 2009 3:18 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Debugging ruby code in a host

Ok it works when I use
Engine.RequireRubyFile("C:\path\to\file\controller.rb")
but not when i use a custom streamcontent provider that knows how to
deal with virtual paths.

like
http://github.com/casualjim/ironrubymvc/blob/57cfa...

Anyway I'll take the stream content providers out and just put something
in that handles mappath to allow debugging.

But now the question becomes When would I want to use a
StreamContentProvider and when should I have to create a PAL ?  Would
using a PAL be a better idea to when hosting it in a webserver?
2009/3/23 Tomas Matousek
<Tomas.Matousek@microsoft.com<mailto:Tomas.Matousek@microsoft.com>>

The file you are setting breakpoint to needs to exists on the disk for
Visual Studio debugger to work.



Tomas



From:
ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>
[mailto:ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>]
On Behalf Of Ivan Porto Carrero
Sent: Monday, March 23, 2009 2:14 PM

To: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org>
Subject: Re: [Ironruby-core] Debugging ruby code in a host



Yes.. I'll try again.. maybe I missed something.
I should really say that the file that has the ruby code is an assembly
resource that gets read through an AssemblyReaderStreamContentProvider.
Should I be providing that content differently?

http://github.com/casualjim/ironrubymvc/blob/57cfa...

I use http://gist.github.com/74979 to set a breakpoint.



2009/3/23 Tomas Matousek
<Tomas.Matousek@microsoft.com<mailto:Tomas.Matousek@microsoft.com>>

Is DebugMode property of the ScriptRuntimeSetup of the ScriptRuntime you
run the script in set to true?



Tomas



From:
ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>
[mailto:ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>]
On Behalf Of Ivan Porto Carrero
Sent: Monday, March 23, 2009 12:32 PM
To: ironruby-core
Subject: [Ironruby-core] Debugging ruby code in a host



Hi

With my IronRubyMVC implementation I'm far enough to figure out that I
need to be able to put breakpoints in my ruby code :)
Now the question is how, because I think I tried all of the ways that
are described in the wiki but had no success. I have a debug version of
IronRuby and I'm using it in a C# ASP.NET<http://ASP.NET> MVC project
with the System.Web.Mvc.IronRuby dll as a reference. The web application
hosts the scriptruntime etc. Now what do I need to do to make visual
studio break on the breakpoint I define?

In merging the latest git pushes into the linux branch I've seen a pdb
generator does that mean I can actually get to more meaningful stack
traces etc. again the question how springs to mind? :)

Thanks
Ivan

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core



_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
This topic is locked and can not be replied to.