Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] TCF and Pretty Printing

Hi Eugene,

Thanks again for your reply.

 

Okay it’s makes more sense now.

 

So I get the fact that TCF uses debugger symbols, knowing that each has a symbolID.
The getSymbolInfoCache(symbolD) returns cached data which contains variable names and types (the ones from the Eclipse Debug view), I can retrieve them now.

But when it comes to the variables values, I can see in TCFNodeExpression.java a few methods such as appendValueText(), appendArrayValueText() and others. These ones seem to
format the value (array of bytes returned by the agent) and then add them to a StyledStringBuffer.

If I am not wrong, could you tell me how I can access those formatting functions from the ITCFPrettyExpressionProvider ?

Thank you !

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Eugene Tarassov
Sent: Wednesday, April 29, 2015 8:27 PM
To: TCF Development
Subject: Re: [tcf-dev] TCF and Pretty Printing

 

Hi David,

 

If _expression_ represents a variable, Value.getSymbolID() returns symbol ID of the variable. You can use Symbols service to get properties of the symbol – including name; you can use other TCF services to read target memory, etc., whatever you might need to produce pretty printing string. Proper string conversion becomes your responsibility, don’t expect much from the debugger UI APIs.

 

Regards,

Eugene

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Docteur, David
Sent: Wednesday, April 29, 2015 2:53 AM
To: TCF Development
Subject: Re: [tcf-dev] TCF and Pretty Printing

 

Hi Eugene,

Thanks a lot for your answer.

 

I can now retrieve the variable type and value. I would have two more questions:

 

_ I try to convert the value (array of bytes) with the function toASCIIString(), or even to build a new String from this array,

   but it does not seem to convert my string properly. Is it possible to get the converted value from the Provider ?

 

_ Is it possible to get the variable name (from the Debug) as well ? I can see getType() and getValue() but nothing like getName().

Thank you very much !

 

 

 

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Eugene Tarassov
Sent: Tuesday, April 28, 2015 7:44 PM
To: TCF Development
Subject: Re: [tcf-dev] TCF and Pretty Printing

 

Hi David,

 

> But getExpressionText() seems to contain null data.

 

TCFDataCache has asynchronous API. Comments in TCFDataCache.java explain how it supposed to be used.

 

You, probably, have to use getType() and getValue() instead of getExpressionText().

 

Your code would look something like this:

 

    TCFDataCache<String> getText(ITCFObject object) {

        if (object instanceof TCFNodeExpression) {

            final TCFNodeExpression exp = (TCFNodeExpression)object;

            return new TCFDataCache<String>(channel) {

                @Override

                protected boolean startDataRetrieval() {

                    TCFDataCache<ISymbols.Symbol> sym_cache = exp.getType();

                    if (!sym_cache.validate(this)) return false;

                    ISymbols.Symbol sym_data = sym_cache.getData();

                    // TODO: check for sym_data == null, sym_data.getError() == null, etc.

                    set(null, null, "Value type name: " + sym_data.getName());

                    return true;

                }

            };

        }

        return null;

    }

 

 

You also might want to consider “presentation_provider” extension point. For this one, there is example plugin in the examples directory.

 

Regards,

Eugene

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Docteur, David
Sent: Tuesday, April 28, 2015 4:42 AM
To: tcf-dev@xxxxxxxxxxx
Subject: [tcf-dev] TCF and Pretty Printing

 

Hi guys,

We are actually trying to implement our own pretty printers thanks to the ITCFPrettyExpressionProvider extension point.

 

The getText(ITCFObject object) overridden method returns a TCFDataCache<String> object from the object passed as a parameter.
This object is an instance of ITCFExpression but I don’t really know which is the best way to build a custom TCFDataCache<String> object from that.

For now I am having :

 

TCFNodeExpression _expression_ = (TCFNodeExpression) object;

TCFDataCache<String> _expression_ = _expression_.getExpressionText();

 

But getExpressionText() seems to contain null data.

What would be the best way to build a proper TCFDataCache<String> object  so that It can contain our “homemade” pretty printer ?

 

Thank you very much for your help.

 

David.

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


Back to the top