From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13332 invoked by alias); 18 Feb 2017 15:00:44 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 13009 invoked by uid 89); 18 Feb 2017 15:00:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-PHP-Originating-Script:rcube.php, H*u:1.2.3, H*UA:1.2.3 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Feb 2017 15:00:25 +0000 Received: by simark.ca (Postfix, from userid 33) id 6C9C71E936; Sat, 18 Feb 2017 10:00:23 -0500 (EST) To: Maxim Akhmedov Subject: Re: Default value for option "python print-stack" X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 18 Feb 2017 15:00:00 -0000 From: Simon Marchi Cc: gdb@sourceware.org In-Reply-To: <97321487117014@webcorp03e.yandex-team.ru> References: <97321487117014@webcorp03e.yandex-team.ru> Message-ID: <5528d675aa4c171442a7c8b1aba9c135@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00040.txt.bz2 On 2017-02-14 19:03, Maxim Akhmedov wrote: > Hi, > > Currently the default value for an option "python print-stack" is > "message" > that enables show only the messages of Python exceptions, but not their > tracebacks nor line numbers. > > Though, usually the message of a Python error itself is pretty useless > as it > doesn't point you where exactly the error happened. Like, suppose you > have a > pretty-printer written in Python, and then you get the following > output: > > (gdb) yp lastKey > Python Exception local variable > 'value_data' referenced before assignment: > Error occurred in Python command: local variable 'value_data' > referenced before > assignment > > it doesn't really tell you anything, there may be lots of usages of a > mentioned > variable, and due to the dynamic nature of Python you may easily mess > somewhere > and it's particularly hard to find out the exact place by this message. > Also, > the exception message is duplicated. > > I see two options here. > First one is choosing "full" as a default value for this option. Is > their any > rationale for not doing that? Python tracebacks are usually not that > large to > intentionally suppress them. > Second one is appending the sourcefile:lineno to the message. Like: > "/path/to/source.py:123". I believe it should be possible to extract > this > information from the traceback object you get after invoking the Python > code. > > From my point of view, it's a good idea to implement both of this > options. I agree with the first one, I spent so much time tracking bugs in my Python code before knowing about this setting. Simon