public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/16820] New: Value in Python object is not updated and propagated to GDB unless the print statement is called
@ 2014-04-08 11:51 bogdan.tabacaru88 at yahoo dot com
  2014-04-08 11:52 ` [Bug python/16820] " bogdan.tabacaru88 at yahoo dot com
  2022-06-05 16:48 ` tromey at sourceware dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bogdan.tabacaru88 at yahoo dot com @ 2014-04-08 11:51 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16820
           Summary: Value in Python object is not updated and propagated
                    to GDB unless the print statement is called
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: bogdan.tabacaru88 at yahoo dot com

Created attachment 7539
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7539&action=edit
contains c++ and gdb python scripts which illustrate the current issue.

OS info:
Linux vihlln12 2.6.18-371.4.1.el5 #1 SMP Wed Jan 8 18:42:07 EST 2014 x86_64
x86_64 x86_64 GNU/Linux

works with:
gcc 4.1.2 and 4.6.3
gdb 7.5 and 7.7

This is a very simplified example.
Makefile present for convenience.
file main.log contains the result from running gdb.


The C++ program initiates the obj object, writes its value to True and then
reads it 10 times.
The GDB Python scripts override each 4th read call from C++ with the value
False. This is done through the ReadObject which calls GDB's Python API.
A breakpoint is set into the obj::read function using Python classes which
inherit from gdb.Breakpoint.
The issue appears when updating ReadObject's value. Lines 13/14
py/read_object.py show where the error is present. 
When running the code 'as is', the main.log file contains the correct results.
If line 14 in file py/read_object.py is changed and the print statement is
removed (i.e., line 14 only contains the statement BaseObject.update(self,
"m_cur_val")) then the main.log file gives a different output.

Summary: not writing 'print' in line 14 makes GDB output different results.

when "print" statement is present main.log file contains:
value= 1
read value= 0
read value= 1
read value= 1
read value= 1
read value= 0
read value= 1
read value= 1
read value= 1
read value= 0
read value= 1
value= 1

when "print" statement is absent main.log file contains:
value= 1
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
read value= 0
value= 0

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


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

* [Bug python/16820] Value in Python object is not updated and propagated to GDB unless the print statement is called
  2014-04-08 11:51 [Bug python/16820] New: Value in Python object is not updated and propagated to GDB unless the print statement is called bogdan.tabacaru88 at yahoo dot com
@ 2014-04-08 11:52 ` bogdan.tabacaru88 at yahoo dot com
  2022-06-05 16:48 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bogdan.tabacaru88 at yahoo dot com @ 2014-04-08 11:52 UTC (permalink / raw)
  To: gdb-prs

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

Bogdan Tabacaru <bogdan.tabacaru88 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bogdan.tabacaru88 at yahoo dot com

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


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

* [Bug python/16820] Value in Python object is not updated and propagated to GDB unless the print statement is called
  2014-04-08 11:51 [Bug python/16820] New: Value in Python object is not updated and propagated to GDB unless the print statement is called bogdan.tabacaru88 at yahoo dot com
  2014-04-08 11:52 ` [Bug python/16820] " bogdan.tabacaru88 at yahoo dot com
@ 2022-06-05 16:48 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2022-06-05 16:48 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
             Status|NEW                         |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Changing update to this works without the print:

    def update (self, varName=None):
        self.originalValue = gdb.parse_and_eval(varName)
        self.originalValue.fetch_lazy()
        return self.originalValue

Basically a value is lazy when initially captured, and
if you want to keep the contents at that moment you have
to explicitly request it.  Often this happens implicitly,
but not in your situation.

I'm going to close this bug.

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

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

end of thread, other threads:[~2022-06-05 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-08 11:51 [Bug python/16820] New: Value in Python object is not updated and propagated to GDB unless the print statement is called bogdan.tabacaru88 at yahoo dot com
2014-04-08 11:52 ` [Bug python/16820] " bogdan.tabacaru88 at yahoo dot com
2022-06-05 16:48 ` 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).