Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python.': 0.02; 'interpreter': 0.05; 'answering': 0.09; 'works.': 0.09; 'python': 0.11; "wouldn't": 0.14; 'block.': 0.16; 'breakpoints': 0.16; 'bytecode': 0.16; 'discovery.': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'learn?': 0.16; 'message- id:@timgolden.me.uk': 0.16; 'metaclasses': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:Conditional': 0.16; 'tjg': 0.16; 'weekend.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; '(not': 0.18; 'code.': 0.18; 'bit': 0.19; 'trying': 0.19; 'pointed': 0.19; 'header:User-Agent:1': 0.23; 'received:192.168.100': 0.24; 'posts': 0.26; 'query': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'code': 0.31; 'getting': 0.31; 'lightning': 0.31; 'url:category': 0.31; 'quite': 0.32; 'url:python': 0.33; 'implemented': 0.33; 'classes': 0.35; 'but': 0.35; 'there': 0.35; 'doing': 0.36; "didn't": 0.36; 'useful': 0.36; 'two': 0.37; 'level': 0.37; 'step': 0.37; 'nov': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'little': 0.38; 'short': 0.38; 'explain': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'areas': 0.61; 'new': 0.61; 'took': 0.61; 'further': 0.61; 'first': 0.61; 'information': 0.63; 'decided': 0.64; 'therefore,': 0.64; 'more': 0.64; 'different': 0.65; 'wall': 0.65; 'series': 0.66; 'due': 0.66; 'realized': 0.68; 'computers': 0.72; 'led': 0.72; 'felt': 0.74; 'lack': 0.78; 'from:addr:mail': 0.83; 'partially': 0.84; 'surface': 0.84; 'touching': 0.84; 'fascinating': 0.91; 'eli': 0.93; 'journey': 0.93; '2013': 0.98 Date: Tue, 12 Nov 2013 15:49:52 +0000 From: Tim Golden User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Conditional breakpoints in ceval.c References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384271428 news.xs4all.nl 15955 [2001:888:2000:d::a6]:34054 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59209 On 12/11/2013 15:40, Demian Brecht wrote: > On Sat, Nov 9, 2013 at 5:33 AM, wrote: >> I don't know how to use gdb the way you want, but it sounds like you are on a fascinating journey of discovery. What are you trying to learn? Perhaps we can talk about how the interpreter works. > > Apologies for not getting to this sooner, I took a much needed short > hiatus from touching all things computers over the long weekend. > > A little backstory to how I got to this sticking point: > > I decided to write a series of blog posts about the lesser-known areas > of the Python stdlib (I was considering doing a lightning talk about > one or two of them). First stop was abc's. When digging into that, I > realized that the implementation of abcs is a bit different than other > modules in the stdlib: It's only partially implemented in Python. > > After digging into that more and figuring out how that was all > implemented in C, I also found that, while I understood how to use > metaclasses, I didn't quite understand how the interpreter used > metaclasses to build new classes (I had read the docs, but felt that I > couldn't explain it to my grandmother and therefore, a blog post on > metaclasses likely would only be surface level and wouldn't include > any information outside of what's readily available through the docs). > > At that point, I had spent quite a bit of time grep'ing and grok'ing > various parts of the interpreter code. I felt there /had/ to be a be a > more efficient way to see what's going on for a particular code block. > Further digging pointed me to compile/dis to get the bytecode > generated by code blocks. This then led me to ceval.c, setting > breakpoints to step through and see what actually happens with the > code. This is where I ran into a bit of a wall due to my lack of > practice with gdb. You may well have seem them but, in case you haven't, look at Eli Bendersky's occasional blog series: http://eli.thegreenplace.net/category/programming/python/python-internals/ (Not answering your current query but hopefully useful anyway). TJG