From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10479 invoked by alias); 9 Oct 2012 17:15:01 -0000 Received: (qmail 10462 invoked by uid 22791); 9 Oct 2012 17:14:59 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Oct 2012 17:14:54 +0000 Received: by mail-pb0-f41.google.com with SMTP id rq2so6115171pbb.0 for ; Tue, 09 Oct 2012 10:14:54 -0700 (PDT) Received: by 10.66.85.233 with SMTP id k9mr54292148paz.73.1349802894163; Tue, 09 Oct 2012 10:14:54 -0700 (PDT) Received: from archlinux ([117.192.153.251]) by mx.google.com with ESMTPS id uq5sm12666892pbc.56.2012.10.09.10.14.52 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 10:14:53 -0700 (PDT) From: chandan r To: gdb@sourceware.org Subject: Extending GDB: Python: Wrong handling of 64-bit pointers User-agent: mu4e 0.9.8.5; emacs 24.2.1 Date: Tue, 09 Oct 2012 17:15:00 -0000 Message-ID: <87y5jfr1ri.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes 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 X-SW-Source: 2012-10/txt/msg00045.txt.bz2 Hi all, As the following CLI interactions show, GDB's python support code seems to be mishandling 64-bit pointers (GNU/Linux on x86-64): NOTE: "p" is a pointer of type "struct task_struct *" (gdb) python print gdb.parse_and_eval("p") 0xffff88001f5f7600 (gdb) python print long(gdb.parse_and_eval("p")) -131940868983296 (gdb) show version show version GNU gdb (GDB) 7.5 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". For bug reporting instructions, please see: . Is it GDB or am I messing up something here? -- Chandan