This is the mail archive of the
mailing list for the GDB project.
Re: How to write native (i.e. C/C++) plugin for gdb?
- From: Dmitry Samersoff <dms at samersoff dot net>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Hui Zhu <teawater at gmail dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>, abhijit dot k dot halder at gmail dot com
- Date: Wed, 25 Dec 2013 20:51:18 +0400
- Subject: Re: How to write native (i.e. C/C++) plugin for gdb?
- Authentication-results: sourceware.org; auth=none
- References: <52B97EB4 dot 9070100 at samersoff dot net> <CANFwon3gOuaopfsJ_Eord=14U__zD2JrBorKz_4bMBYPtZy4cQ at mail dot gmail dot com> <52B9966B dot 8050104 at samersoff dot net> <20131224144704 dot GJ4558 at adacore dot com> <52BAFA96 dot 8060407 at samersoff dot net>
-----BEGIN PGP SIGNED MESSAGE-----
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
2) python performance is not always acceptable and you not always
ever able to run a python.
To get a better picture of native plugins in action, please, take a
look at solaris mdb.
On 2013-12-25 19:32, Dmitry Samersoff wrote:
> 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?
> 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
>> 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?
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/
-----END PGP SIGNATURE-----