This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using Python to infer some internal data


Hi,
I've been using GDB to debug a FreeBSD kernel running inside a VMWare.
I can connect gdb to VMWare as described on this blog[1]. VMWare seems
to act as some kind of remote target, which gdb can connect to via
TCP. Now it is my understanding that the code inside VMWare which
speaks to gdb must know about the host OS, so that it can reply with
information about processes, threads, etc. Since VMWare doesn't know
what guess is running inside it there are some configure options which
give VMWare the offsets to different kernel data. VMWare then can look
at the kernel data and infer different things, such as
process/threads/etc.

However, this approach only works for Linux, because VMWare was coded
with Linux explicitly in mind. So, I had another idea. What if I coded
some python that ran in GDB which could examine different kernel data,
and determine which threads and processes are running, and then
somehow update this state inside GDB. I have already done something
similar, by writing a simple script which can examine the FreeBSD
kernel's data and determine which kernel modules are loaded, and then
correctly load symbols for them inside GDB [2].

So my question is. Is it possible for a python script to tell GDB
about what processes/threads are currently running? If it is not
possible, why not? If it will be possible one day, but not yet, is
there any way I can help?
Also, is it possible for a python script to set a breakpoint, and be
able to handle it itself without user interference? I would like this
so that if a new kernel module is loaded, that a piece of my code is
executed to load new symbols.

thank very much
Andrew

P.S If someone wouldn't mind, could they look at [2], and advice me if
I used this new python gdb feature correctly? I have never coded in
python, and I'm quite new to gdb.

[1] http://stackframe.blogspot.com/2007/09/application-debugging-with-recordreplay.html
[2] http://bramp.net/blog/autoload-symbols-for-freebsd-kernel-module


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]