Petter Måhlén writes:
> Hi,
>
> I think this is not particularly easy to do. The steps that are needed
> on the Java side are:
>
> 1. Create a new command object (jde.debugger.command.X) - piece of cake
> 2. Add it to the DebugCommandFactory list of prototypes - piece of cake
> 3. The hard part: make it do what you want. It's easy to use the list of
> StackFrame:s to figure out the value of a variable (see the GetLocals
> command), but it's quite hard to simulate execution of a function call
> in a detailed way. I am not at all sure how best to execute a call that
> could involve access to global variables, synchronization, etc. On top
> of that, there is the fact that you need to execute the call inside the
> debuggee VM, not the debugger VM, to ensure that class loading, etc., is
> all done in the same way. And normally, the debugee VM will be suspended
> by the debugger when stepping through the code, so I think you'd have to
> create a new thread with the same context as the current one and execute
> your call in that scope. It seems to quickly run out of hand here.
>
> I tried looking a bit at the JDI interface, but I couldn't see any way
> to do step 3. I didn't spend a lot of time on it, but it may be
> something that is not well supported at this level at least.
>
Hi Petter,
I believe the JDI supports method evaluation in the debuggee vm.
Certainly, jdb, which is base on JDE, supports method evaluation.
For example, it is possible with the current JDEE interface to
jdb to evaluation expressions such as
obj.toString()
The LValue class in JDEbug expr package contains two methods, operation()
and booleanOperation(), that evaluate simple binary expressions, e.g.,
a + b
a < b
in the debuggee vm. That would be a good starting point to study
how to extend the JDEE's current expression interpretation capabilities
to handle method expressions.
Paul
> Best regards,
>
> Petter
>
> > -Original Message-
> > From: Paul Kinnucan [mailto:[EMAIL PROTECTED]
> > Sent: den 1 september 2003 04:37
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: [work] How can JDEbug evaluate expression be extended?
> >
> >
> > Jeff VanBaalen writes:
> > > Does anyone have an extension for the JDEbug "Evaluate Expression"
> > > command that enables one to examine the result of calling
> > a method on
> > > some variable in the current context?
> > >
> > > If not, can anyone give me some hints on how hard this
> > would be to do
> > > and how to do it? Its been a while, but I have hacked elisp before.
> > >
> >
> > Hi Jeff,
> >
> > This would require work on the Java side of JDEbug, not the Lisp
> > side. You would have to enhance JDEbug's rather primitive
> > expression interpreter to parse and evaluate method expressions.
> >
> > Paul
> >
> >
>