From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29553 invoked by alias); 27 Dec 2013 14:15:24 -0000 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 Received: (qmail 29538 invoked by uid 89); 27 Dec 2013 14:15:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mircat.net Received: from mircat.net (HELO mircat.net) (81.9.105.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 27 Dec 2013 14:15:20 +0000 Received: from [192.168.0.77] (port=36977 helo=dooku.mircat.net) by mircat.net with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.77) (envelope-from ) id 1VwYC1-0005ke-Sg; Fri, 27 Dec 2013 18:15:13 +0400 Message-ID: <52BD8B71.3050506@samersoff.net> Date: Fri, 27 Dec 2013 14:15:00 -0000 From: Dmitry Samersoff User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Doug Evans CC: Joel Brobecker , Hui Zhu , "gdb@sourceware.org" , Abhijith Halder Subject: Re: How to write native (i.e. C/C++) plugin for gdb? References: <52B97EB4.9070100@samersoff.net> <52B9966B.8050104@samersoff.net> <20131224144704.GJ4558@adacore.com> <52BAFA96.8060407@samersoff.net> <52BB0D06.3000208@samersoff.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00083.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Doug, Unfortunately, sustaining - i.e. fixing customer side issues, - has different requirements comparing to development - you have much less control on environment and have to support more versions and configuration than usual. see also below. On 2013-12-27 02:55, Doug Evans wrote: > On Wed, Dec 25, 2013 at 8:51 AM, Dmitry Samersoff > wrote: Everyone, > > Just found a year old discussion about Abhijit proposal. > > So answering to upcoming question - why not a Python. > > Python is very good staff if your speak about source level > debugging. If you have to debug optimized binary python doesn't > help match for two reason - > > 1) you have to port all native data structure you plan to work > with to python. >> This typically isn't that hard an exercise, have you looked into >> it? I really like python (e.g. here is pure python elf reader and disassemblers for arm, sparc and x86 http://www.samersoff.net/hg/pydas/ written as a part of larger project) but ... Typical deadlock case requires me to deal with 10-20 structures. Counting different versions and separate big- and little- endian representation in Python, it creates a real zoo. And it's a pain to keep this zoo in sync with C version. In some case I can invoke target process code and it gives an alleviation but it not always possible. Use appropriate c headers directly and write simple native plugin is much easy and safer approach. Both windbg and mdb supports native plugins so I had a chance to compare different options in practice. > 2) python performance is not always acceptable and you not always > ever able to run a python. > >> I'd like to see the data that shows the performance isn't >> acceptable. This could just be mistaken impressions. On many of arm or mips boards overhead of python interpreter within debugging session is not acceptable. Not mentioning the fact, that I have to install python to this board first as it typically not there. (Yes, emulation helps but it's not always an option - e.g. it doesn't help to find that the program doesn't save one of FPU register on some version of hardware) Other example - walking through java heap. Re-implementation of garbage collector code in Python to optimize the walking is rather costly but without optimization it takes a while. - -Dmitry > To get a better picture of native plugins in action, please, take > a look at solaris mdb. > > -Dmitry > > On 2013-12-25 19:32, Dmitry Samersoff wrote: >>>> Joel, >>>> >>>> Thank you for the response. >>>> >>>> I found this patch >>>> https://sourceware.org/ml/gdb-patches/2012-05/msg00500.html - >>>> many thanks to Abhijit. >>>> >>>> 1. What is the reason to keep it off main trunk? Is there a >>>> chance to have it changed? >>>> >>>> 2. What API is available from within a plugin? i.e. how I >>>> can access coredump memory? >>>> >>>> -Dmitry >>>> >>>> On 2013-12-24 18:47, Joel Brobecker wrote: >>>>>> I need to implement scenario like one below: >>>>>> >>>>>> (gdb) load-plugin libgdbjvm.so (gdb) attach PID (gdb) >>>>>> jvm show loaded-classes (gdb) jvm show java-threads (gdb) >>>>>> jvm show code-cache >>>> >>>>> Maybe you could add some routines in your program that are >>>>> solely intended for debugging purposes, and then define >>>>> commands that call those routines. Off hand, that's the >>>>> only way I can think of. Otherwise, interface the C++ stuff >>>>> you need from Python - if necessary, export some stuff to >>>>> C? >>>> >>>> >>>> >>>> > - -- Dmitry Samersoff Saint Petersburg, Russia, http://devnull.samersoff.net * There will come soft rains ... -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSvYtxAAoJEHEy08c4gIABuNYH/RLGcE+cF1wkcALL+Jnoj3iV xHPjQ0FsTakAPzuVin+9eXXS6I+Ap3ShNO+mhklAslIuf+Cb8xdK8Ocap0LyZ6o+ j23CRcKqDLVR3IZzgdlVbopm4fh1tqiy4CbSRGi8Yd7A0Z7i0eDvWEkRCLkbm7WU IpQtcjB+ZUJXEFAqJZ4pVbg7lzUVtBx86o00BbUqbJxGtW+aFGULXCZyu5PZAans 7/5cA7u9GI94bXt2vX95SPgBJN9LSRjyMOI6InMGIVOhAtNbwsThYAqaZ577Qt5g cgw3lWO+4P3g8qcxZs6U4W1tdTOXrhIYzLlq21Tn26Rx/eg/4m9gG5LfOHHrNFU= =GZ8+ -----END PGP SIGNATURE-----