Comments (6)
Previously, pygdbmi would either ignore or mangle escapes (depending on where they appeared) but this was fixed in 0.10.0.2. See #57 and #58.
The consequence is that now pygdbmi expects the output from GDB to be well formed.
Long story short, this seems like a bug in GdbController
, not the unescaping code.
I will investigate this but, in the meantime, please use 0.10.0.1.
Details
If I do this in my GDB:
-data-evaluate-expression "s[1] = 254"
I get:
=memory-changed,thread-group="i1",addr="0x00005555555592a1",len="0x1"
^done,value="-2 '\\376'"
Note that double slash before 376
.
And with GdbController
(I'm using a trivial program where s
is a char *
):
gdbmi = GdbController()
gdbmi.write("-file-exec-and-symbols [...]")
gdbmi.write("break [...]")
gdbmi.write("run")
print(gdbmi.write('''-data-evaluate-expression "s[1] = 254"''')[1]["payload"]["value"])
The output is -2 '\376'
Where did the other \
go?!
from pygdbmi.
Thanks for having a look that quickly!
For the moment I've pinned my stuff to 0.10.0.1.
from pygdbmi.
In my previous comment I got confused but the behaviour, with my GDB, is correct. I got confused as I thought I was printing the repr
of the string but I added a print()
so I printed the str
version of the response's payload's value.
From what I can see here everything works correctly.
I'm using this trivial program (in a file calles strings.c
):
#include <stdio.h>
static void print_string(char *the_string)
{
printf("%s\n", the_string);
}
int main()
{
char the_string[] = "Hello world!";
print_string(the_string);
return 0;
}
Compiled with:
gcc strings.c -g -o strings_app
Then, in an interactive Python session, I'm doing:
from pygdbmi.gdbcontroller import GdbController
gdbmi = GdbController()
gdbmi.write(
[
"-file-exec-and-symbols strings_app",
"-break-insert print_string",
"-exec-run",
]
)
Then I try -data-evaluate-expression
:
print(gdbmi.write(['-data-evaluate-expression "the_string[0] = 254"'])[-1]["payload"]["value"]) # → -2 '\376'
print(gdbmi.write(['-data-evaluate-expression "the_string[0] = 32"'])[-1]["payload"]["value"]) # → 32 ' '
print(gdbmi.write(['-data-evaluate-expression "the_string[0] = 10"'])[-1]["payload"]["value"]) # → 10 '\r'
print(gdbmi.write(['-data-evaluate-expression "the_string[0] = 65"'])[-1]["payload"]["value"]) # → 65 'A'
From what I can see everything is correct.
I'm using GDB 9.2 on Ubuntu 20.04.
Do you have more details that could help reproducing?
from pygdbmi.
Hi,
I checked my CICD envrionment. Indeed, it seems that only my Windows 10 job was failing with release 0.10.0.2 wiht the error I reported. The Linux (Ubuntu 20.04) did not fail. I'll drill deeper in the coming days and report back.
On both, Windows and Linux, I'm using gdb 8.3.1 from the GNU Arm Embedded Toolchain verison 9-2020-q2 from https://developer.arm.com/downloads/-/gnu-rm
The target is a Cortex-M0+ MCU system.
from pygdbmi.
I think this may be a GDB bug on Windows. Potentially only affecting a few versions of GDB.
I will try to work it around.
from pygdbmi.
Thank you for your patience! I'm working on a few fixes/improvements and then release this fix.
from pygdbmi.
Related Issues (20)
- interrupt_gdb terminates gdb [win] HOT 1
- Interrupt GDB HOT 1
- Version of code descrepancy? HOT 4
- Slow time response with pipes (Windows) HOT 5
- IoManager._get_responses_windows self.stdout.readline() stuck HOT 2
- Thank you! I ported your parser to Rust HOT 5
- Incompatible behavior in GDB command line and pygdbmi HOT 2
- IoManager._get_responses_windows mangles token when reading from stdout
- Escapes in MI error records are mangled HOT 3
- Payload for textual messages not unescaped
- get_gdb_response doesn't parse tab char correctly HOT 6
- GdbController cannot recognize window short path of gdb executable HOT 1
- "GdbTimeoutError" during '-symbol-info-variables' command HOT 1
- README.md - AttributeError: 'GdbController' object has no attribute 'get_subprocess_cmd' HOT 1
- Consider using a real language parser to parse MI output HOT 1
- Some responses dropped while debugging ARM microcontroller
- -break-insert * address not supported HOT 1
- Documentation published to https://cs01.github.io/pygdbmi/ is out of date
- Missing send_signal_to_gdb() and interrupt_gdb() of GdbController
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygdbmi.