public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dominik.b.czarnota+bugzilla at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30615] New: search_memory() method on the gdb.Inferior objects disregards the particular inferior and always searches the memory of the current inferior instead
Date: Tue, 04 Jul 2023 22:29:18 +0000	[thread overview]
Message-ID: <bug-30615-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30615
           Summary: search_memory() method on the gdb.Inferior objects
                    disregards the particular inferior and always searches
                    the memory of the current inferior instead
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: dominik.b.czarnota+bugzilla at gmail dot com
  Target Milestone: ---

The search_memory() method on the gdb.Inferior objects disregards the
particular inferior and always searches the memory of the current inferior
instead.

The error is here:

```
static PyObject *
infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) {
...
      found = target_search_memory (start_addr, length,
                                    buffer, pattern_size,
                                    &found_addr);
```

(Can also be seen on
https://github.com/bminor/binutils-gdb/blob/a89e364b45a93acd20f48abd787ef5cb7c07f683/gdb/python/py-inferior.c#L659).


Instead of calling target_search_memory(...args) the GDB should call
self->...<some field referencing
inferior>...->top_target()->search_memory(...args)


This can be triggered from Python API via
`gdb.selected_inferior().search_memory(...)` but I haven't created a reproducer
that would tell if this is really a problem or not. However, the fact that
there is a "selected inferior" suggests that there could  be.


Thanks to my friend Arusekk who spotted this bug.

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

             reply	other threads:[~2023-07-04 22:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 22:29 dominik.b.czarnota+bugzilla at gmail dot com [this message]
2023-07-05 12:02 ` [Bug gdb/30615] " dominik.b.czarnota+bugzilla at gmail dot com
2023-07-06 12:56 ` [Bug python/30615] " tromey at sourceware dot org
2023-07-06 17:26 ` tromey at sourceware dot org
2023-07-06 17:34 ` tromey at sourceware dot org
2023-07-07 15:10 ` tromey at sourceware dot org
2023-07-14 19:43 ` cvs-commit at gcc dot gnu.org
2023-07-14 19:43 ` tromey at sourceware dot 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-30615-4717@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).