Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34441
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '+++': 0.03; 'else:': 0.03; 'binary': 0.05; 'debug': 0.05; '-0500': 0.07; 'python': 0.09; '16)': 0.09; '===': 0.09; 'advice.': 0.09; 'be:': 0.09; 'likewise': 0.09; 'subject:using': 0.09; 'def': 0.10; 'extension': 0.13; 'receives': 0.13; 'resulting': 0.13; 'applies': 0.15; 'dec': 0.15; 'stack': 0.15; '"set': 0.16; 'assumptions': 0.16; 'correctly,': 0.16; 'examples:': 0.16; 'frames': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'hexadecimal': 0.16; 'integer.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'octal': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:Problem': 0.16; 'subject:etc.': 0.16; 'string': 0.17; 'wrote:': 0.17; 'fix': 0.17; 'thu,': 0.17; '>>>': 0.18; "python's": 0.23; "haven't": 0.23; "i've": 0.23; 'seems': 0.23; 'patch': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '---': 0.26; 'values': 0.26; 'wondering': 0.26; 'trouble': 0.28; 'attempting': 0.29; 'closer': 0.29; 'decimal': 0.29; 'received:192.168.1.3': 0.29; 'subject: [': 0.29; 'though.': 0.29; 'convert': 0.29; 'this.': 0.29; "i'm": 0.29; '(from': 0.30; 'checked': 0.30; 'received:84': 0.32; 'could': 0.32; 'shorter': 0.33; 'problem': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'follows:': 0.35; 'identified': 0.35; 'subject:]': 0.35; 'posting': 0.35; 'there': 0.35; 'but': 0.36; 'ok,': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'some': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'easy': 0.60; 'subject:, ': 0.61; 'identify': 0.61; 'information': 0.63; 'skip:= 30': 0.64; 'here': 0.65; 'offer': 0.65; 'subject:. ': 0.66; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; '7.4': 0.84; 'briefly,': 0.84; 'each,': 0.84; 'reply- to:addr:python.org': 0.84; 'subject:during': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=O5K7TWBW c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=O2Kvzccb_dQA:10 a=hXgbQenUUXoA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=BHwUKFPk1zYA:10 a=-n02ExiHPbnuQZHJAFIA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Fri, 07 Dec 2012 00:37:22 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Problem using py-bt, py-locals, etc. during GDB debugging [solved] |
| References | <20121206213941.GA5363@mshroyer-d> <20121207002212.GB5363@mshroyer-d> |
| In-Reply-To | <20121207002212.GB5363@mshroyer-d> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.595.1354840827.29569.python-list@python.org> (permalink) |
| Lines | 72 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1354840827 news.xs4all.nl 6871 [2001:888:2000:d::a6]:59505 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34441 |
Show key headers only | View raw
On 2012-12-07 00:22, Mark Shroyer wrote:
> On Thu, Dec 06, 2012 at 04:39:41PM -0500, Mark Shroyer wrote:
>> I'm having trouble with the py-bt, py-locals, etc. GDB commands (from
>> Python's python-gdb.py) while using GDB 7.4 to debug Python 2.7.3; I was
>> wondering if anyone here could offer advice.
>>
>> Briefly, py-bt seems to identify the python stack frames correctly, but
>> shows "(unable to read python frame information)" for each, and likewise
>> py-locals fails with "Unable to read information on python frame".
>
> OK, I took a closer look at this and I've identified the issue; posting
> my fix here in case someone else Googles this.
>
> The problem in my case was that the python-gdb.py extension makes some
> fragile assumptions about the format of values it receives from GDB, and
> I had the line "set output-radix 16" in my .gdbinit, ultimately
> resulting in the extension attempting to convert the string
> representation of a hexadecimal number into an integer.
>
> So there are two easy workarounds:
>
> 1. set output-radix 10 in GDB, or
>
> 2. Patch Python 2.7.3's python-gdb.py as follows:
>
> === 8< =================================
>
> --- python-gdb.py.orig 2012-12-06 15:12:18.666760664 -0500
> +++ python-gdb.py 2012-12-06 19:17:19.588356874 -0500
> @@ -1074,7 +1074,11 @@
>
>
> def int_from_int(gdbval):
> - return int(str(gdbval))
> + int_str = str(gdbval)
> + if int_str.startswith("0x"):
> + return int(int_str[2:], 16)
> + else:
> + return int(int_str)
>
>
> def stringify(val):
>
> === 8< =================================
>
> I haven't checked to see whether this also applies to the GDB extension
> for Python 3, though.
>
A shorter fix would be:
def int_from_int(gdbval):
return int(str(gdbval), 0)
Some examples:
>>> # Decimal
>>> int("12", 0)
12
>>> # Hexadecimal
>>> int("0x12", 0)
18
>>> # Octal
>>> int("012", 0)
10
>>> # Octal
>>> int("0o12", 0)
10
>>> # Binary
>>> int("0b11", 0)
3
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Problem using py-bt, py-locals, etc. during GDB debugging [solved] MRAB <python@mrabarnett.plus.com> - 2012-12-07 00:37 +0000
csiph-web