public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [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
@ 2023-07-04 22:29 dominik.b.czarnota+bugzilla at gmail dot com
  2023-07-05 12:02 ` [Bug gdb/30615] " dominik.b.czarnota+bugzilla at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dominik.b.czarnota+bugzilla at gmail dot com @ 2023-07-04 22:29 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-14 19:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 22:29 [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 dominik.b.czarnota+bugzilla at gmail dot com
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

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).