From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13887 invoked by alias); 13 Apr 2011 07:22:00 -0000 Received: (qmail 13858 invoked by uid 22791); 13 Apr 2011 07:21:59 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BX,TW_IB,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qy0-f169.google.com (HELO mail-qy0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Apr 2011 07:21:54 +0000 Received: by qyk2 with SMTP id 2so2893405qyk.0 for ; Wed, 13 Apr 2011 00:21:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.182.75 with SMTP id cb11mr3709697qab.125.1302679313844; Wed, 13 Apr 2011 00:21:53 -0700 (PDT) Received: by 10.229.83.194 with HTTP; Wed, 13 Apr 2011 00:21:53 -0700 (PDT) In-Reply-To: References: Date: Wed, 13 Apr 2011 07:22:00 -0000 Message-ID: Subject: Re: passing gdb.Value pointers to ctypes function calls From: Christoph Mathys To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 2011-04/txt/msg00040.txt.bz2 On Tue, Apr 12, 2011 at 11:17 PM, Phil Muldoon wrote: > Christoph Mathys writes: > >> call libxml using ctypes module, passing the pointer values as >> c_void_p. But gdb keeps crashing on me. > > If GDB ever crashes it is a bug. =C2=A0Can you file a bug for this? I don't mind filing a bug report, but I'm not sure what else gdb should do considering what I'm doing: Accessing possibly invalid memory inside gdb itself. The code below is what I think happens in my script. The difference is that I have a more complicated way of getting the wrong pointer and call a different C function. This is in crash.py: from ctypes import * ptr =3D c_void_p(1) libc =3D CDLL('libc.so.6') libc.printf('%s\n', ptr) Fire up gdb and do: python execfile('crash.py'). For me, this crashes gdb, but this is somewhat expected. > It should, but without more concrete information it is difficult to > diagnose the issue. =C2=A0I am concerned about the GDB crash though, that > should be fixed. It was suggested that what I'm trying to do can't work. gdb lives in another address space than my inferior, so pointers from my inferior don't make sense to a library loaded into gdbs address space. Christoph