Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68873

Re:gdb python how to output integer for examine memory

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 <python-python-list@m.gmane.org>
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 <davea@davea.name>
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 <e1e8c3a2-5d8d-4aae-9a5d-82af79be8c4c@googlegroups.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8447.1395663507.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


 Wesley <nispray@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

gdb python how to output integer for examine memory Wesley <nispray@gmail.com> - 2014-03-24 03:20 -0700
  Re:gdb python how to output integer for examine memory Dave Angel <davea@davea.name> - 2014-03-24 08:22 -0400
    Re: gdb python how to output integer for examine memory Wesley <nispray@gmail.com> - 2014-03-24 06:37 -0700
  Re: gdb python how to output integer for examine memory dieter <dieter@handshake.de> - 2014-03-25 08:49 +0100
    Re: gdb python how to output integer for examine memory Wesley <nispray@gmail.com> - 2014-03-25 01:07 -0700
      Re: gdb python how to output integer for examine memory dieter <dieter@handshake.de> - 2014-03-26 08:10 +0100
        Re: gdb python how to output integer for examine memory Wesley <nispray@gmail.com> - 2014-03-26 18:04 -0700

csiph-web