You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Daniel Gong <da...@gmail.com> on 2010/07/05 15:28:03 UTC

Re: About JDB's expression calculation

Back to this question, I still do not find a proper solution.

I think expressions like "object.method()" can only be evaluated at the
debuggee side, because the debugger does not have enough information to
evaluate it. Then, if this kind of expression can be evaluated at the
debuggee side, expressions like "a+b" are supposed to be able to be
evaluated too.

I'm not sure whether my understanding is right. If I'm right, there should
be some interface at the debugger side that can evaluate a valid java
expression, does anyone know what it is? If I'm wrong, is there any library
that I can use to parse a java expression and evaluated it as Regis said?

Best wishes
Daniel Gong


On Wed, Jun 9, 2010 at 9:27 AM, Regis <xu...@gmail.com> wrote:

> On 2010-06-08 19:07, Daniel Gong wrote:
>
>> Hi everyone,
>>
>> As you know I'm now preparing to develop jdb command line tool. I've
>> encountered a problem. JDB has the functionality of display value of a
>> java
>> expression, but how can I calculate the value from an expression string?
>> I've thought about the problem for days and still cannot figure it out. I
>> need some help from you. Thanks :)
>>
>> Best wishes
>> Daniel Gong
>>
>>
> I guess you need to parse the string to find out which part should be
> calculated at debuggee side, and which can be done at jdb side.
>
> --
> Best Regards,
> Regis.
>

Re: About JDB's expression calculation

Posted by Regis <xu...@gmail.com>.
On 2010-07-05 21:28, Daniel Gong wrote:
> Back to this question, I still do not find a proper solution.
>
> I think expressions like "object.method()" can only be evaluated at the
> debuggee side, because the debugger does not have enough information to
> evaluate it. Then, if this kind of expression can be evaluated at the
> debuggee side, expressions like "a+b" are supposed to be able to be
> evaluated too.

"object.method()" can be done by jdwp command ObjectReference::InvokeMethod; 
primitive type operations, such as "3 / 4", can be done in debugger side, but I 
guess you have to parse it yourself.

>
> I'm not sure whether my understanding is right. If I'm right, there should
> be some interface at the debugger side that can evaluate a valid java
> expression, does anyone know what it is? If I'm wrong, is there any library

At least there is no jdwp commands can do this AFAIK.

> that I can use to parse a java expression and evaluated it as Regis said?
>
> Best wishes
> Daniel Gong
>
>
> On Wed, Jun 9, 2010 at 9:27 AM, Regis<xu...@gmail.com>  wrote:
>
>> On 2010-06-08 19:07, Daniel Gong wrote:
>>
>>> Hi everyone,
>>>
>>> As you know I'm now preparing to develop jdb command line tool. I've
>>> encountered a problem. JDB has the functionality of display value of a
>>> java
>>> expression, but how can I calculate the value from an expression string?
>>> I've thought about the problem for days and still cannot figure it out. I
>>> need some help from you. Thanks :)
>>>
>>> Best wishes
>>> Daniel Gong
>>>
>>>
>> I guess you need to parse the string to find out which part should be
>> calculated at debuggee side, and which can be done at jdb side.
>>
>> --
>> Best Regards,
>> Regis.
>>
>


-- 
Best Regards,
Regis.