From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4457 invoked by alias); 23 Mar 2011 10:46:20 -0000 Received: (qmail 4377 invoked by uid 22791); 23 Mar 2011 10:46:17 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BJ X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Mar 2011 10:46:10 +0000 Received: by vws4 with SMTP id 4so7063963vws.0 for ; Wed, 23 Mar 2011 03:46:08 -0700 (PDT) Received: by 10.220.127.101 with SMTP id f37mr1531120vcs.132.1300877168193; Wed, 23 Mar 2011 03:46:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.200.3 with HTTP; Wed, 23 Mar 2011 03:45:48 -0700 (PDT) In-Reply-To: References: From: Kevin Pouget Date: Wed, 23 Mar 2011 10:46:00 -0000 Message-ID: Subject: Re: Python objfile-gdb.py file -- how to handle reloading properly ? To: mark florisson Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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-03/txt/msg00131.txt.bz2 symbolic breakpoints would solve half of my problem, I still need to lookup some global variable addresses when my library has been loaded, so that I can read the right memory and understand the meaning of my breakpoint hit thanks for sharing cydbg, it's always good to have some working examples ! On Wed, Mar 23, 2011 at 6:06 AM, mark florisson wrote: > On 23 March 2011 11:01, mark florisson wrote: >> On 23 March 2011 10:05, Kevin Pouget wrote: >>> Hello, >>> >>> I'm not writing a pretty-printer, but something quite similar to >>> thread-event notification (eg, thread creation/death, where some >>> special locations are breakpointed, and an action is trigger upon >>> hitting the bp). >>> >>> So in this case, maybe the autoloading discussed before is not >>> actually the best solution. What I would like to do is: >>> >>>> (at gdb startup) Load the process-independent part of my --python-- module >>>> (at application startup/shared library loading) Set my breakpoint, resolve addresses and enable process-dependent commands >> >> You can set (symbolic) breakpoints even before your shared library is >> loaded ('set breakpoint pending on'). >> >> If you want to provide process independent functionality, create a >> Python wrapper script that starts gdb and has it import the >> process-independent code. If you need some inspiration, you could take >> a look at this: >> https://github.com/markflorisson88/cython/blob/master/Cython/Debugger/Cygdb.py >> . It writes gdb commands to a tempfile and then loads gdb which reads >> the commands from the tempfile. > > In fact, if you don't have multi-line commands, you can simply use > gdb's -ex option: gdb -ex 'python import mymodule' > >> Good luck! >> >> Mark >> >