Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Source locator fails for file paths starting with \\

It should be noted that the un-escaping of backslashes is currently done in MIConst.getString. If the mentioned extra append is removed from MIParser.translateCString, then MIConst.getString mustn't do any backslash un-escaping any more.

As it's related, I'd also like to mention (again) that I've fixed bug 307311 some time ago. The patch adds some code to the MIConst class; it works well for me. It would be great if someone could briefly check it - see http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg22737.html

Many thanks
Mathias Kunter


Am 24.08.2011 16:32, schrieb Marc Khouzam:
I know the escaping of slashes has been worked on before.
We should check the history of changes for MIParser and see when this
extra line was added.
But yes, please open a bug to track this.
Thanks

    ------------------------------------------------------------------------
    *From:* cdt-dev-bounces@xxxxxxxxxxx
    [mailto:cdt-dev-bounces@xxxxxxxxxxx] *On Behalf Of *Abeer Bagul
    *Sent:* Wednesday, August 24, 2011 8:57 AM
    *To:* CDT General developers list.
    *Subject:* [cdt-dev] Source locator fails for file paths starting
    with \\

    Hi,

    When stepping into printf, gdb reports the path of printf.c as follows:
    \\build\\tree\\RD-2011.2_kuma\\p4root\\Xtensa\\Target-libs\\newlib\\newlib\\libc\\stdio\\printf.c

    This string is unnecessarily escaped again by the MIParser in DSF,
    resulting in:
    \\\\build\\\\tree\\\\RD-2011.2_kuma\\\\p4root\\\\Xtensa\\\\Target-libs\\\\newlib\\\\newlib\\\\libc\\\\stdio\\\\printf.c

    When this string is converted into an IPath object, it is de-escaped
    into a path like:
    //build/tree/RD-2011.2_kuma/p4root/Xtensa/Target-libs/newlib/newlib/libc/stdio/printf.c
    rather than the correct path:
    /build/tree/RD-2011.2_kuma/p4root/Xtensa/Target-libs/newlib/newlib/libc/stdio/printf.c

    Due to the extra forward slash in the beginning, source locator
    fails for printf.c

    This is due to a bug in the MIParser for DSF, where it unnecessarily
    inserts extra escape chars into the strings returned by gdb.

    MIParser code for CDI:

    private String translateCString(FSB buffer)
    ...
    if (c == '\\') {
    if (escape) {
    sb.append(c);
    escape = false;
    } else {
    escape = true;
    }
    }

    MIParser code for DSF:

    private String translateCString(FSB buffer)
    ...
    if (c == '\\') {
    if (escape) {
    sb.append(c);
    sb.append(c); //this extra append causes the path to have extra
    slashes in the beginning.
    escape = false;
    } else {
    escape = true;
    }
    }

    Should I file a bug and attach a patch to remove the extra append()
    call?

    Thanks
    Abeer Bagul
    Tensilica India



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


Back to the top