Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] evaluate command handling

Hi Johan,

Probably more correct solution would be to enhance printProperty() so it correctly escapes names. The simple implementation could be copied from org.eclipse.dltk.utils.TextUtils.escapeHTML(String)

Regards,
Alex

Johan Compagner wrote:
Hi,

I have build my own evaluate that uses the Dbgp protocol to evaluate strings that a user can put in like:

x < 10

and that is also a big problem.. :(

Because x < 10 is also the id of the property call and the EvalCommand calls printProperty:

DBGPDebugFrame fr = this.debugger.getStackManager().getStackFrame(0);
        Object evaluated = fr.eval(value);
        String shName = value;
        int k = shName.lastIndexOf('.');
        if (k != -1) {
            shName = shName.substring(k + 1);
        }
this.debugger.printProperty(shName, value, evaluated, valueBuffer, 0,
                true);

and print property:

properties.append("<property\r\n" + " name=\"" + id + "\"\r\n" + " fullname=\"" + fullName + "\"\r\n" + " type=\"" + data_type + "\"\r\n" + " classname=\"" + name_of_object_class + "\"\r\n" + " constant=\"0\"\r\n" + " children=\"" + (hasChilds ? 1 : 0) + "\"\r\n" + " encoding=\"base64\"\r\n" + " numchildren=\"" + numC + "\">\r\n" + vlEncoded + "</property>\r\n");

so because name and fullname are not encoded but are attributes the complete debugging engine just terminates (this is another issue that i will try to resolve because that really shouldnt happen anyway)

But how to fix this?

My eval command doesnt really need the name or fullname because it is only interessted in the value that it returns and i also looked at watch expressions that also dont really need the return name/fullname values

for example in javascript i can add this as a watch expression:

x..*.(name == "sam" &&

i know thats illegal but that will bomb out the debug engine..

What do you guys think can i do this in EvalCommand:

DBGPDebugFrame fr = this.debugger.getStackManager().getStackFrame(0);
        Object evaluated = fr.eval(value);
        this.debugger.printProperty("", "", evaluated, valueBuffer, 0,
                true);


so just return the evaluated results?

johan

------------------------------------------------------------------------

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top