This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/16820] New: Value in Python object is not updated and propagated to GDB unless the print statement is called


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]