Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'debug': 0.07; 'variables': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'wrote': 0.14; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'true:': 0.16; 'subject:python': 0.16; 'attach': 0.16; 'all,': 0.19; 'trying': 0.19; 'value.': 0.19; 'import': 0.22; 'preferred': 0.22; 'separate': 0.22; 'script.': 0.24; 'script': 0.25; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'generally': 0.29; 'idea,': 0.31; 'another': 0.32; 'test': 0.35; 'but': 0.35; 'two': 0.37; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'simple': 0.61; 'here': 0.66; 'ing': 0.84; 'subject::': 0.85 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re:gdb python how to output integer for examine memory Date: Mon, 24 Mar 2014 08:22:59 -0400 (EDT) Organization: news.gmane.org References: X-Gmane-NNTP-Posting-Host: dpc6744198232.direcpc.com X-Newsreader: PiaoHong Usenet NewsReaders 1.36 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395663507 news.xs4all.nl 2924 [2001:888:2000:d::a6]:45463 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68873 Wesley Wrote in message: > Hi all, > I am trying to use gdb debug python script. > I am using gdb7.7 and python2.7.6, here is my simple test script: > import time > > def next(i): > time.sleep(10) > i = 1 - i > > i = 1 > while True: > next(i) > When this script running, gdb attach to it, and here is snippet: > I cannot help with gdb, but I can point out that you have two separate variables here. Decrement ing the local has no effect on the global value. The preferred way is to return any values from the function that you want to use after it exits. def next(i): time.sleep(10) i = 1 - i return i i = 1 while True: i =next(i) Another possibility, generally a bad idea, is declaring i global in the function. -- DaveA