This is the mail archive of the
mailing list for the GDB project.
Re: RFC GDB Linux Awareness analysis
- From: Peter Griffin <peter dot griffin at linaro dot org>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>, lee dot jones at linaro dot org
- Date: Wed, 30 Sep 2015 09:02:05 +0100
- Subject: Re: RFC GDB Linux Awareness analysis
- Authentication-results: sourceware.org; auth=none
- References: <20150603142858 dot GA19370 at griffinp-ThinkPad-X1-Carbon-2nd> <CADPb22QsOz-ToWB+Fp8yoxy0Tecxdae+TbTOEjn0RCHNQjU6YQ at mail dot gmail dot com>
On Thu, 04 Jun 2015, Doug Evans wrote:
Thanks for your feedback, and apologies for taking so long to get back to you.
No doubt you thought I'd been hit by the proverbial bus. The other activites
I've been working on are now almost finished, so I should be able to start work
on this GDB activity again.
> On Wed, Jun 3, 2015 at 7:28 AM, Peter Griffin <email@example.com> wrote:
> > Hi GDB community,
> > Overview
> > ========
> > The purpose of this email is to describe a useful feature which has been developed
> > by STMicroelectronics inside of GDB for debugging Linux kernels. I will cover at
> > a high level some of the implementation details and what I see as the advantages
> > / disadvantages of the implementation. I will also cover some other alternative
> > approaches that I'm aware of.
> > The purpose is to facilitate discussion with the GDB experts on this
> > mailing list as to what the "correct" way to implement this functionality would
> > be.
> > The end goal is to have an upstream implementation of this functionality.
> > ...
> > Questions
> > - Do GDB community mind Linux specific custom commands being added to GDB code base?
> In principal, no. But the devil is in the details of course.
> gdb already has "info proc foo" to dump bits of /proc.
> Plus obviously we encode various linux-specific bits
> needed to debug userland apps.
Ok thanks, I wasn't aware of that functionality. It's good to know about where
all the current OS specific parts are in GDB.
> > My current opinion is that helper commands which can be, should be migrated from C code
> > into Python, and merged into the kernel source tree (and then retired from the LKD patchset).
> I can't speak to what, if anything, "should" live in the kernel tree
> (as opposed to somewhere else, but not necessarily in gdb).
> Encoding application-specific knowledge in gdb is obviously not ideal,
> but then again the kernel is not your average app.
Certainly some python has already been accepted into the kernel, and moving
parts of LKD which can be migrated into python seems like a good first step.
Both from seeing how easy it is to get merged into the kernel perspective
and also getting an idea of what bits maybe missing from the python API
> > If you got here, thanks for reading this far! Like I said at the beginning, the purpose of
> > this email is to stimulate some discussion on what you folks consider the 'correct' way to
> > implement this OS awareness functionality is.
> If we can put most/all this in python, awesome.
> I wouldn't be opposed to extending gdb's python API to support this
> (where appropriate).
Something which I believe is missing currently is the ability to add a new thread
via the python interface. Is that something you would consider appropriate?
By way of example, currently the kernel python scripts add a "lx-ps" which
parses the task_structs, and builds a list of threads. This is the beginning
of task-awareness in python, but currently the list is simply printed
Being able to either return this thread list to GDB, or actually create thread
objects inside GDB via the python interface would appear to be the next logical
> Can we proceed by making "do it in python" the default choice,
> and then address each issue as needed?
Ok, sounds good to me. This was also my gut feeling when starting this
analysis, but to have it confirmed by you is encouraging :).