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

* [Bug gdb/30615] 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 [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 ` dominik.b.czarnota+bugzilla at gmail dot com
  2023-07-06 12:56 ` [Bug python/30615] " tromey at sourceware dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominik.b.czarnota+bugzilla at gmail dot com @ 2023-07-05 12:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Disconnect3d <dominik.b.czarnota+bugzilla at gmail dot com> ---
Relevant documentation:
https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-Connections-and-Programs.html

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

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

* [Bug python/30615] 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 [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 ` tromey at sourceware dot org
  2023-07-06 17:26 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-06 12:56 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-07-06
          Component|gdb                         |python
     Ever confirmed|0                           |1

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Python 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

* [Bug python/30615] 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 [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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-06 17:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I think this affects reading and writing memory as well.

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

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

* [Bug python/30615] 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 [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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-06 17:34 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch.

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

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

* [Bug python/30615] 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 [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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-07 15:10 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-July/200719.html

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

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

* [Bug python/30615] 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 [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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-14 19:43 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

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

commit 75ec09829780f8d00d8515e07101a29272a22303
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Jul 6 11:33:47 2023 -0600

    Use correct inferior in Inferior.read_memory et al

    A user noticed that Inferior.read_memory and a few other Python APIs
    will always use the currently selected inferior, not the one passed to
    the call.

    This patch fixes the bug by arranging to switch to the inferior.  I
    found this same issue in several APIs, so this fixes them all.

    I also added a few missing calls to INFPY_REQUIRE_VALID to these
    methods.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30615
    Approved-By: Pedro Alves <pedro@palves.net>

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

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

* [Bug python/30615] 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 [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
                   ` (5 preceding siblings ...)
  2023-07-14 19:43 ` cvs-commit at gcc dot gnu.org
@ 2023-07-14 19:43 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-14 19:43 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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