New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escapes in MI error records are mangled #57
Comments
Thanks for the report. Yes if you'd like to make a PR that would be appreciated! |
barisione
added a commit
to barisione/pygdbmi
that referenced
this issue
Jan 12, 2022
barisione
added a commit
to barisione/pygdbmi
that referenced
this issue
Jan 13, 2022
Here we go: #59 (not sure if you receive notifications for PRs). |
Thanks, yes I do. I appreciate the PR. I’ll review it as soon as possible. I have a lot of obligations in my personal life at the moment but I will get to it within the next 7 days. |
cs01
pushed a commit
that referenced
this issue
Jan 16, 2022
* convert Python 2 Unicode strings in test_pygdbmi.py If some Python 3 features, like f-strings, are used in a file, then black decides to convert all strings in the form u"..." to "...". This separate commit convert all these strings into a standalone commit to avoid the next commit to be too noisy due to black. * add code to unescape GDB MI strings * unescape messages in error records (#57) * unescape strings in console, log and target records (#58) * add changelog entry for unescaping strings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When parsing an error record, backslashes are just dropped. This works for quotes but mangles other escapes (like
\n
).For instance this:
Becomes a dictionary with this message:
To Reproduce
I wrote a simple
script.py
Python script with a GDB command to be able to have arbitrary escapes:Start GDB in MI-mode and load the script:
When you use the command, GDB produces this output:
Parse it with
pygdbmi
:And you get:
Expected behavior
Escapes should be interpreted. In the example above I would expect this output:
The correct escape behaviour (which is not compatible with Python escapes) can be found in
printchar
ingdb/utils.c
in the binutils-gdb repository.Please complete the following information:
pip freeze
output):Additional context
I haven't looked at the pygdbmi code yet but I may be able to make a PR if you are interested. I already have an unescape function in Python.
The text was updated successfully, but these errors were encountered: