[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [SOLUTION] Object Browser (#8

Jamis Buck

11/22/2004 2:58:00 PM

James Edward Gray II wrote:
> On Nov 21, 2004, at 6:48 PM, Jamis Buck wrote:
>
>> Well, I was kind of waiting to see what other people came up with, but
>> since the list seems quiet on this topic, I guess I'll go ahead and
>> post first.
>
>
> [snip description]
>
>> Anyway. Comments?
>
>
> Yes. Would you mind posting a few screenshots, for those of us having
> trouble getting past the interface requirements?
>
> James Edward Gray II

Here are three screenshots. (It's really nothing special to look
at--like I said, it needs a lot more attention than I can afford to give
it right now.)

http://ruby.jamisbuck.org/objbrow...
This is how it looks when you first bring it up.

http://ruby.jamisbuck.org/objbrow...
This is the same scenario, with the instance variables expanded.

http://ruby.jamisbuck.org/objbrow...
This is the same, drilling down to inspect the constants defined in
the class of one of the instance variables.

I think something like this (maybe used in conjunction with the
breakpoint and assert concepts that have been discussed on this list)
would be useful in debugging, especially if the ability to modify values
were added. I'm still hoping someone submits a nicer solution to the
quiz than mine, since mine is pretty rough, and is really only half done. :)

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck...



6 Answers

Florian Gross

11/23/2004 12:54:00 AM

0

Jamis Buck wrote:

> http://ruby.jamisbuck.org/objbrow...
> This is the same, drilling down to inspect the constants defined in
> the class of one of the instance variables.
>
> I think something like this (maybe used in conjunction with the
> breakpoint and assert concepts that have been discussed on this list)
> would be useful in debugging, especially if the ability to modify values
> were added. I'm still hoping someone submits a nicer solution to the
> quiz than mine, since mine is pretty rough, and is really only half
> done. :)

I agree heavily. This looks very interesting. Would you be interested in
patching this so it can work with Breakpoints? I can not do it myself
unfortunately as GTK is completely screwed on this machine and I think I
can only fix that by reinstalling Windows...

The required changes would basically be using drb_gateway.evaluate(nil,
"methods") instead of directly doing examined_obj.methods and so on.

Jamis Buck

11/23/2004 3:36:00 PM

0

Florian Gross wrote:
> Jamis Buck wrote:
>
>> http://ruby.jamisbuck.org/objbrow...
>> This is the same, drilling down to inspect the constants defined in
>> the class of one of the instance variables.
>>
>> I think something like this (maybe used in conjunction with the
>> breakpoint and assert concepts that have been discussed on this list)
>> would be useful in debugging, especially if the ability to modify values
>> were added. I'm still hoping someone submits a nicer solution to the
>> quiz than mine, since mine is pretty rough, and is really only half
>> done. :)
>
>
> I agree heavily. This looks very interesting. Would you be interested in
> patching this so it can work with Breakpoints? I can not do it myself
> unfortunately as GTK is completely screwed on this machine and I think I
> can only fix that by reinstalling Windows...
>
> The required changes would basically be using drb_gateway.evaluate(nil,
> "methods") instead of directly doing examined_obj.methods and so on.

I'd be happy to make that change, Florian, but I think it might be
better to combine my approach with Brian's. His is much prettier, for
one thing, but it also has the ability to navigate to specific instances
of a class, which is nice.

Unfortunately, I'm racing to get Net::SSH ready to release (I wanted to
do a release before Thanksgiving, but I'm not sure that'll happen). Then
I need to work on Net::SFTP... If no one has tackled this by the time
I'm done with SFTP, I'll take another look at it.

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck...


Brian Schröder

11/23/2004 7:35:00 PM

0

On Wed, 24 Nov 2004 00:36:17 +0900
Jamis Buck <jgb3@email.byu.edu> wrote:

> Florian Gross wrote:
> > Jamis Buck wrote:
> >
> >> http://ruby.jamisbuck.org/objbrow...
> >> This is the same, drilling down to inspect the constants defined in
> >> the class of one of the instance variables.
> >>
> >> I think something like this (maybe used in conjunction with the
> >> breakpoint and assert concepts that have been discussed on this list)
> >> would be useful in debugging, especially if the ability to modify values
> >> were added. I'm still hoping someone submits a nicer solution to the
> >> quiz than mine, since mine is pretty rough, and is really only half
> >> done. :)
> >
> >
> > I agree heavily. This looks very interesting. Would you be interested in
> > patching this so it can work with Breakpoints? I can not do it myself
> > unfortunately as GTK is completely screwed on this machine and I think I
> > can only fix that by reinstalling Windows...
> >
> > The required changes would basically be using drb_gateway.evaluate(nil,
> > "methods") instead of directly doing examined_obj.methods and so on.
>
> I'd be happy to make that change, Florian, but I think it might be
> better to combine my approach with Brian's. His is much prettier, for
> one thing, but it also has the ability to navigate to specific instances
> of a class, which is nice.
>
> Unfortunately, I'm racing to get Net::SSH ready to release (I wanted to
> do a release before Thanksgiving, but I'm not sure that'll happen). Then
> I need to work on Net::SFTP... If no one has tackled this by the time
> I'm done with SFTP, I'll take another look at it.
>

My code is also in need of a good overhaul. It developed while learning how to use a Gtk::TreeView and reflection, so it is not structured very good. I'd love to merge it with Jamis solution, but I can't promise that I'll get time because I'm in the midst of my carreer-finals.

If you could point me to some description of how breakpoints works, I'll take a look next time I get too bored and want to waste some time ;)

Regards,

Brian

--
Brian Schröder
http://www.brian-sch...



Florian Gross

11/23/2004 8:07:00 PM

0

Brian Schröder wrote:

> If you could point me to some description of how breakpoints works,
> I'll take a look next time I get too bored and want to waste some
> time ;)

The remote ones work by running part of an irb session at the server and
part of it on the client. The communication is done transparently via
DRb. This required a bit of hacking, but in this case the only important
thing is really that you can use drb_service.evaluate(nil, code) for
evaluating arbitrary code.

Breakpoints themself just cause an IRB shell to spawn in the current
context at the current line of code. Some Binding.of_caller magic is
used for making the interface transparent.

There's a few extensions over that basic principle (assume, being able
to return a custom value from a breakpoint, getting the source code
where the breakpoint was triggered and so on), but it's really all not
too complex.

Feel free to ask if that explanation was not in detail enough for your
needs. I'd be pleased to help out. I think a good GUI interface like the
ones you and Jamis did would really be a very nice addition to the
Breakpoint package. (And also dev-utils, IMHO)

Gavin Sinclair

11/23/2004 11:08:00 PM

0

On Wednesday, November 24, 2004, 7:08:02 AM, Florian wrote:

> I think a good GUI interface like the ones you and Jamis did would
> really be a very nice addition to the Breakpoint package. (And also
> dev-utils, IMHO)

Definitely!

Gavin



Jonathan Paisley

11/24/2004 9:49:00 AM

0

Hi Florian,

Would you consider adding some description (such as your text below) to
the Drb version of breakpoint.rb? I spent some time reading the code to
figure this out, and perhaps it might be a useful addition to help others
to get an overview of how it works.

On a related point, I discovered that if I attempt tab completion in the
Drb-ified IRB session the server side crashes since it uses plain eval()
against a Drb-proxy of the binding, which fails. Any idea how to fix this?

ruby--1.8.2p2/lib/ruby/1.8/irb/completion.rb:160:in `eval': wrong argument type DRb::DRbObject (expected Proc/Binding) (TypeError)

Many thanks.
Jonathan

On Tue, 23 Nov 2004 21:07:25 +0100, Florian Gross wrote:

> The remote ones work by running part of an irb session at the server and
> part of it on the client. The communication is done transparently via
> DRb. This required a bit of hacking, but in this case the only important
> thing is really that you can use drb_service.evaluate(nil, code) for
> evaluating arbitrary code.
>
> Breakpoints themself just cause an IRB shell to spawn in the current
> context at the current line of code. Some Binding.of_caller magic is
> used for making the interface transparent.
>
> There's a few extensions over that basic principle (assume, being able
> to return a custom value from a breakpoint, getting the source code
> where the breakpoint was triggered and so on), but it's really all not
> too complex.
>
> Feel free to ask if that explanation was not in detail enough for your
> needs. I'd be pleased to help out. I think a good GUI interface like the
> ones you and Jamis did would really be a very nice addition to the
> Breakpoint package. (And also dev-utils, IMHO)