Giter Site home page Giter Site logo

Comments (6)

barisione avatar barisione commented on May 5, 2024

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.

twinkler-ams-osram avatar twinkler-ams-osram commented on May 5, 2024

Thanks for having a look that quickly!

For the moment I've pinned my stuff to 0.10.0.1.

from pygdbmi.

barisione avatar barisione commented on May 5, 2024

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.

twinkler-ams-osram avatar twinkler-ams-osram commented on May 5, 2024

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.

barisione avatar barisione commented on May 5, 2024

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.

barisione avatar barisione commented on May 5, 2024

Thank you for your patience! I'm working on a few fixes/improvements and then release this fix.

from pygdbmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.