From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20577 invoked by alias); 12 Apr 2011 09:44:29 -0000 Received: (qmail 20567 invoked by uid 22791); 12 Apr 2011 09:44:28 -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-qw0-f41.google.com (HELO mail-qw0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 09:44:24 +0000 Received: by qwa26 with SMTP id 26so4902493qwa.0 for ; Tue, 12 Apr 2011 02:44:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.173.212 with SMTP id q20mr5196844qaz.27.1302601463360; Tue, 12 Apr 2011 02:44:23 -0700 (PDT) Received: by 10.229.224.206 with HTTP; Tue, 12 Apr 2011 02:44:22 -0700 (PDT) Date: Tue, 12 Apr 2011 09:44:00 -0000 Message-ID: Subject: passing gdb.Value pointers to ctypes function calls From: Christoph Mathys To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 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/msg00035.txt.bz2 Hello! I'm trying to write a pretty printer for gdb 7.2 using python, to be concrete I would like to print an Xml node (libxml2) as text. I've managed to get the pointers to node and document. Now I'm trying to call libxml using ctypes module, passing the pointer values as c_void_p. But gdb keeps crashing on me. Is this supposed to work at all? I allocate some buffer, pass it to libxml functions along with some addresses I obtain from the debugged process using gdb, and as a result I expect the string representation of the node in the buffer. For converting between gdb.Value and ctypes usable stuff I use something like: ptr = int(str(gdbValNode), 16) c_void_p(ptr) I'm attached to the running process. But as far as I understand, this should work on the running process as well as the core file. Thanks for insight! Christoph