From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1889 invoked by alias); 10 Sep 2012 09:50:24 -0000 Received: (qmail 1874 invoked by uid 22791); 10 Sep 2012 09:50:23 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f169.google.com (HELO mail-vc0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 09:50:10 +0000 Received: by vcbfl13 with SMTP id fl13so1316492vcb.0 for ; Mon, 10 Sep 2012 02:50:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.221.13.202 with SMTP id pn10mr12713911vcb.57.1347270609651; Mon, 10 Sep 2012 02:50:09 -0700 (PDT) Received: by 10.58.178.202 with HTTP; Mon, 10 Sep 2012 02:50:09 -0700 (PDT) In-Reply-To: References: Date: Mon, 10 Sep 2012 09:50:00 -0000 Message-ID: Subject: Python debugging in gdb From: Dov Grobgeld 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: 2012-09/txt/msg00015.txt.bz2 I would like to write some glue functions that allow debugging python code within gdb. We have an embedded environment that in the call stack calls back and forth between C++ and python multiple times. It would be great if it was possible to debug this system in a single environment. To do this, I would like to define the following gdb commands: py-break : Create a break point at line in a python file. py-step: Step the next python statement. py-next : Run the next python statement. py-finish: Finish the current python function. In a way this would create a relationship between python and C similar to the current difference between step and stepi, where the former steps in the compiled language and the latter in assembler language. So for python I would like to have one higher abstraction layer. (It would make sense to create a dispatcher that does `py-break` on a python file and `break` on a C++ file so you can always use the same command to create break points.) Is this feasible? Can someone give me some ideas and pointers of how to go about implementing this? Regards, Dov