Community
Participate
Working Groups
Build Identifier: I20110613-1736 This bug is related to Bug 222568 and Bug 307311. MIParser's translateCString function doesn't properly parse the gdb/MI backslash escaping. The issue is that gdb doesn't escape backslashes within stream records, while it does escape them within result and out of band records. Steps to reproduce: Compiling and debugging the following simple test program int main() { const char *s = "back\\slash"; return 0; } and looking at the gdb/MI traces shows that the backslash is escaped by gdb by using 4 backslashes: 737,828 23-stack-list-locals --thread 1 --frame 0 1 737,828 23^done,locals=[{name="s",value="0x403064 \"back\\\\slash\""}] However, compare that to the gdb/MI traces of a simple gdb echo command: 835,421 29-interpreter-exec console "echo back\\\\slash" 835,437 ~"back\\slash" 835,437 29^done Now gdb uses 2 backslashes to escape the single backslash. However, both the "0x403064 \"back\\\\slash\"" and the ~"back\\slash" string are parsed by translateCStrings(). So translateCStrings() obviously must differ between those two situations in order to properly parse the gdb/MI backslash escaping. The reason why the current implementation works is that the MIConst class itself cares about the gdb/MI backslash escaping as well. But that's a quite unclean implementation. A proper handling of the MI backslash escaping is furthermore required to fix Bug 307311. A proposed fix for this bug is attached. It simply adds a boolean parameter to the translateCStrings() function which switches the backslash escaping on or off, depending on the current gdb record type. Note that this fix relies on the proposed fix for Bug 307311. Reproducible: Always
Created attachment 208751 [details] Proposed fix for bug 367456
I'm ok with this patch, but as you pointed out, we need to commit it at the same time as Bug 307311. Could you include this patch in the patch for Bug 307311, so that they happen in the same commit. Once the one commit is done, we'll mark both bugs as resolved. Thanks!
(In reply to comment #2) > Could you include this patch in the patch for Bug 307311 Just for the records: this has been done by 2012-02-01. So please see bug 307311 for any further details about this issue.
This bug has been fixed as part of bug 307311. Thanks Mathias for your efforts.