public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/31845] [gdb/python, arm] FAIL: gdb.python/py-disasm.exp: global_disassembler=ShowInfoRepr: disassemble test
Date: Thu, 20 Jun 2024 13:53:18 +0000	[thread overview]
Message-ID: <bug-31845-4717-q9GIenxOHu@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31845-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31845

--- Comment #8 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The gdb-15-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1aa3b72f07269a0a678ba2de2481d84c74f1c117

commit 1aa3b72f07269a0a678ba2de2481d84c74f1c117
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Jun 20 15:54:16 2024 +0200

    [gdb/python] Fix gdb.python/py-disasm.exp on arm-linux

    After fixing test-case gdb.python/py-disasm.exp to recognize the arm nop:
    ...
            nop     {0}
    ...
    we run into:
    ...
    disassemble test^M
    Dump of assembler code for function test:^M
       0x004004d8 <+0>:     push    {r11}           @ (str r11, [sp, #-4]!)^M
       0x004004dc <+4>:     add     r11, sp, #0^M
       0x004004e0 <+8>:     nop     {0}^M
    => 0x004004e4 <+12>:    Python Exception <class 'ValueError'>: Buffer \
      returned from read_memory is sized 0 instead of the expected 4^M
    ^M
    unknown disassembler error (error = -1)^M
    (gdb) FAIL: $exp: global_disassembler=ShowInfoRepr: disassemble test
    ...

    This is caused by this code in gdbpy_disassembler::read_memory_func:
    ...
      gdbpy_ref<> result_obj (PyObject_CallMethod ((PyObject *) obj,
                                                  "read_memory",
                                                  "KL", len, offset));
    ...
    where len has type "unsigned int", while "K" means "unsigned long long"
[1].

    Fix this by using "I" instead, meaning "unsigned int".

    Also, offset has type LONGEST, which is typedef'ed to int64_t, while "L"
means
    "long long".

    Fix this by using type gdb_py_longest for offset, in combination with
format
    character "GDB_PY_LL_ARG".  Likewise in disasmpy_info_read_memory.

    Tested on arm-linux.

    Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
    Approved-By: Tom Tromey <tom@tromey.com>

    PR python/31845
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31845

    [1] https://docs.python.org/3/c-api/arg.html

    (cherry picked from commit 4cd214dce4579f86a85a96c882e0fc8c4d94601c)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-06-20 13:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  9:41 [Bug python/31845] New: " vries at gcc dot gnu.org
2024-06-05  9:44 ` [Bug python/31845] " vries at gcc dot gnu.org
2024-06-07  6:37 ` vries at gcc dot gnu.org
2024-06-10 15:52 ` cvs-commit at gcc dot gnu.org
2024-06-10 15:53 ` cvs-commit at gcc dot gnu.org
2024-06-10 15:53 ` vries at gcc dot gnu.org
2024-06-14 14:08 ` vries at gcc dot gnu.org
2024-06-14 14:12 ` vries at gcc dot gnu.org
2024-06-20 13:53 ` cvs-commit at gcc dot gnu.org [this message]
2024-06-20 13:53 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31845-4717-q9GIenxOHu@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).